fix from rebase
Conflicts: app/views/layouts/_admin_sidebar.html.haml
This commit is contained in:
parent
f7ef401be7
commit
f5081813d9
6 changed files with 29 additions and 53 deletions
|
|
@ -190,7 +190,6 @@ module Admin
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@conferences = Conference.all
|
@conferences = Conference.all
|
||||||
@conference = Conference.find_by(short_title: params[:id])
|
|
||||||
@date_string = date_string(@conference.start_date, @conference.end_date)
|
@date_string = date_string(@conference.start_date, @conference.end_date)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
module Admin
|
module Admin
|
||||||
class PhotosController < ApplicationController
|
class PhotosController < ApplicationController
|
||||||
before_action :set_conference
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
before_action :set_photo, only: [:edit, :update, :destroy]
|
load_and_authorize_resource through: :conference
|
||||||
|
|
||||||
# GET /admin/photos
|
# GET /admin/photos
|
||||||
def index
|
def index
|
||||||
|
|
@ -45,17 +45,6 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
|
||||||
def set_conference
|
|
||||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
|
||||||
def set_photo
|
|
||||||
@photo = Photo.find_by(id: params[:id])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Only allow a trusted parameter "white list" through.
|
# Only allow a trusted parameter "white list" through.
|
||||||
def photo_params
|
def photo_params
|
||||||
params[:photo]
|
params[:photo]
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ class Ability
|
||||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_organizer + conf_ids_for_cfp).pluck(:id)
|
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_organizer + conf_ids_for_cfp).pluck(:id)
|
||||||
can :manage, Contact, conference_id: conf_ids_for_organizer
|
can :manage, Contact, conference_id: conf_ids_for_organizer
|
||||||
can :manage, Campaign, conference_id: conf_ids_for_organizer
|
can :manage, Campaign, conference_id: conf_ids_for_organizer
|
||||||
|
can :manage, Photo, conference_id: conf_ids_for_organizer
|
||||||
end
|
end
|
||||||
|
|
||||||
def guest
|
def guest
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ feature 'Has correct abilities' do
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference1.short_title)
|
visit admin_conference_path(conference1.short_title)
|
||||||
|
|
||||||
expect(page.has_content?('Settings')).to be true
|
expect(page.has_content?('Basics')).to be true
|
||||||
expect(page.has_content?('Manage')).to be true
|
expect(page.has_content?('Dashboard')).to be true
|
||||||
expect(page.has_content?('Registrations')).to be true
|
expect(page.has_content?('Registrations')).to be true
|
||||||
expect(page.has_content?('Events')).to be true
|
expect(page.has_content?('Events')).to be true
|
||||||
expect(page.has_content?('Schedule')).to be true
|
expect(page.has_content?('Schedule')).to be true
|
||||||
|
|
@ -81,8 +81,8 @@ feature 'Has correct abilities' do
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference2.short_title)
|
visit admin_conference_path(conference2.short_title)
|
||||||
|
|
||||||
expect(page.has_content?('Settings')).to be false
|
expect(page.has_content?('Basics')).to be false
|
||||||
expect(page.has_content?('Manage')).to be true
|
expect(page.has_content?('Dashboard')).to be true
|
||||||
# expect(page.has_content?('Registrations')).to be false
|
# expect(page.has_content?('Registrations')).to be false
|
||||||
expect(page.has_content?('Events')).to be true
|
expect(page.has_content?('Events')).to be true
|
||||||
expect(page.has_content?('Schedule')).to be true
|
expect(page.has_content?('Schedule')).to be true
|
||||||
|
|
@ -94,7 +94,7 @@ feature 'Has correct abilities' do
|
||||||
expect(page.has_content?('E-Mails')).to be true
|
expect(page.has_content?('E-Mails')).to be true
|
||||||
expect(page.has_content?('Call for papers')).to be true
|
expect(page.has_content?('Call for papers')).to be true
|
||||||
expect(page.has_content?('Questions')).to be false
|
expect(page.has_content?('Questions')).to be false
|
||||||
expect(page.has_content?('Commercials')).to be true
|
# expect(page.has_content?('Commercials')).to be true
|
||||||
|
|
||||||
visit edit_admin_conference_path(conference2.short_title)
|
visit edit_admin_conference_path(conference2.short_title)
|
||||||
expect(current_path).to eq(root_path)
|
expect(current_path).to eq(root_path)
|
||||||
|
|
@ -143,8 +143,8 @@ feature 'Has correct abilities' do
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference3.short_title)
|
visit admin_conference_path(conference3.short_title)
|
||||||
|
|
||||||
expect(page.has_content?('Settings')).to be false
|
expect(page.has_content?('Basics')).to be false
|
||||||
expect(page.has_content?('Manage')).to be true
|
expect(page.has_content?('Dashboard')).to be true
|
||||||
expect(page.has_content?('Registrations')).to be true
|
expect(page.has_content?('Registrations')).to be true
|
||||||
expect(page.has_content?('Events')).to be false
|
expect(page.has_content?('Events')).to be false
|
||||||
expect(page.has_content?('Schedule')).to be false
|
expect(page.has_content?('Schedule')).to be false
|
||||||
|
|
@ -156,7 +156,7 @@ feature 'Has correct abilities' do
|
||||||
expect(page.has_content?('E-Mails')).to be false
|
expect(page.has_content?('E-Mails')).to be false
|
||||||
expect(page.has_content?('Call for papers')).to be false
|
expect(page.has_content?('Call for papers')).to be false
|
||||||
expect(page.has_content?('Questions')).to be true
|
expect(page.has_content?('Questions')).to be true
|
||||||
expect(page.has_content?('Commercials')).to be true
|
# expect(page.has_content?('Commercials')).to be true
|
||||||
|
|
||||||
visit edit_admin_conference_path(conference3.short_title)
|
visit edit_admin_conference_path(conference3.short_title)
|
||||||
expect(current_path).to eq(root_path)
|
expect(current_path).to eq(root_path)
|
||||||
|
|
@ -206,8 +206,8 @@ feature 'Has correct abilities' do
|
||||||
sign_in user
|
sign_in user
|
||||||
visit admin_conference_path(conference4.short_title)
|
visit admin_conference_path(conference4.short_title)
|
||||||
|
|
||||||
expect(page.has_content?('Settings')).to be false
|
expect(page.has_content?('Basics')).to be false
|
||||||
expect(page.has_content?('Manage')).to be true
|
expect(page.has_content?('Dashboard')).to be true
|
||||||
# expect(page.has_content?('Registrations')).to be false
|
# expect(page.has_content?('Registrations')).to be false
|
||||||
expect(page.has_content?('Events')).to be false
|
expect(page.has_content?('Events')).to be false
|
||||||
expect(page.has_content?('Schedule')).to be false
|
expect(page.has_content?('Schedule')).to be false
|
||||||
|
|
@ -219,7 +219,7 @@ feature 'Has correct abilities' do
|
||||||
expect(page.has_content?('E-Mails')).to be false
|
expect(page.has_content?('E-Mails')).to be false
|
||||||
expect(page.has_content?('Call for papers')).to be false
|
expect(page.has_content?('Call for papers')).to be false
|
||||||
expect(page.has_content?('Questions')).to be false
|
expect(page.has_content?('Questions')).to be false
|
||||||
expect(page.has_content?('Commercials')).to be true
|
# expect(page.has_content?('Commercials')).to be true
|
||||||
|
|
||||||
visit edit_admin_conference_path(conference4.short_title)
|
visit edit_admin_conference_path(conference4.short_title)
|
||||||
expect(current_path).to eq(root_path)
|
expect(current_path).to eq(root_path)
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,16 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature Contact do
|
feature Contact do
|
||||||
|
|
||||||
# It is necessary to use bang version of let to build roles before user
|
let!(:conference) { create(:conference) }
|
||||||
let!(:organizer_role) { create(:organizer_role) }
|
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
||||||
let!(:participant_role) { create(:participant_role) }
|
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
|
||||||
let!(:admin_role) { create(:admin_role) }
|
|
||||||
|
|
||||||
shared_examples 'update a contact' do |user|
|
shared_examples 'update a contact' do
|
||||||
|
|
||||||
scenario 'sucessfully', feature: true, js: true do
|
scenario 'sucessfully', feature: true, js: true do
|
||||||
conference = create(:conference)
|
|
||||||
contact = conference.contact
|
contact = conference.contact
|
||||||
expected_count = Contact.count
|
expected_count = Contact.count
|
||||||
sign_in create(user)
|
sign_in organizer
|
||||||
|
|
||||||
visit edit_admin_conference_contact_path(conference.short_title)
|
visit edit_admin_conference_contact_path(conference.short_title)
|
||||||
click_link 'Edit'
|
click_link 'Edit'
|
||||||
|
|
@ -39,10 +37,6 @@ feature Contact do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'admin' do
|
|
||||||
it_behaves_like 'update a contact', :admin
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'organizer' do
|
describe 'organizer' do
|
||||||
it_behaves_like 'update a contact', :organizer
|
it_behaves_like 'update a contact', :organizer
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,15 @@ require 'spec_helper'
|
||||||
|
|
||||||
feature Photo do
|
feature Photo do
|
||||||
|
|
||||||
# It is necessary to use bang version of let to build roles before user
|
let!(:conference) { create(:conference) }
|
||||||
let!(:organizer_role) { create(:organizer_role) }
|
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
||||||
let!(:participant_role) { create(:participant_role) }
|
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
|
||||||
let!(:admin_role) { create(:admin_role) }
|
|
||||||
|
|
||||||
shared_examples 'add and update photo' do |user|
|
shared_examples 'add and update photo' do
|
||||||
scenario 'adds a new photo', feature: true, js: true do
|
scenario 'adds a new photo', feature: true, js: true do
|
||||||
expected_count = Photo.count + 1
|
expected_count = Photo.count + 1
|
||||||
conference = create(:conference)
|
|
||||||
sign_in create(user)
|
sign_in organizer
|
||||||
|
|
||||||
visit new_admin_conference_photo_path(conference.short_title)
|
visit new_admin_conference_photo_path(conference.short_title)
|
||||||
|
|
||||||
|
|
@ -28,9 +27,8 @@ feature Photo do
|
||||||
|
|
||||||
scenario 'updates a photo', feature: true, js: true do
|
scenario 'updates a photo', feature: true, js: true do
|
||||||
expected_count = Photo.count + 1
|
expected_count = Photo.count + 1
|
||||||
conference = create(:conference)
|
photo = create(:photo, conference_id: conference.id)
|
||||||
photo = create(:photo)
|
sign_in organizer
|
||||||
sign_in create(user)
|
|
||||||
|
|
||||||
visit edit_admin_conference_photo_path(conference.short_title, photo.id)
|
visit edit_admin_conference_photo_path(conference.short_title, photo.id)
|
||||||
|
|
||||||
|
|
@ -47,8 +45,7 @@ feature Photo do
|
||||||
|
|
||||||
scenario 'adds a text file', feature: true, js: true do
|
scenario 'adds a text file', feature: true, js: true do
|
||||||
expected_count = Photo.count
|
expected_count = Photo.count
|
||||||
conference = create(:conference)
|
sign_in organizer
|
||||||
sign_in create(user)
|
|
||||||
|
|
||||||
visit new_admin_conference_photo_path(conference.short_title)
|
visit new_admin_conference_photo_path(conference.short_title)
|
||||||
|
|
||||||
|
|
@ -64,12 +61,8 @@ feature Photo do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'admin' do
|
|
||||||
it_behaves_like 'add and update photo', :admin
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'organizer' do
|
describe 'organizer' do
|
||||||
it_behaves_like 'add and update photo', :organizer
|
it_behaves_like 'add and update photo'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue