fix from rebase

Conflicts:
	app/views/layouts/_admin_sidebar.html.haml
This commit is contained in:
Stella Rouzi 2014-08-12 22:11:07 +03:00
parent f7ef401be7
commit f5081813d9
6 changed files with 29 additions and 53 deletions

View file

@ -190,7 +190,6 @@ module Admin
def edit
@conferences = Conference.all
@conference = Conference.find_by(short_title: params[:id])
@date_string = date_string(@conference.start_date, @conference.end_date)
respond_to do |format|
format.html

View file

@ -1,7 +1,7 @@
module Admin
class PhotosController < ApplicationController
before_action :set_conference
before_action :set_photo, only: [:edit, :update, :destroy]
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference
# GET /admin/photos
def index
@ -45,17 +45,6 @@ module Admin
end
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.
def photo_params
params[:photo]

View file

@ -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, Contact, 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
def guest

View file

@ -19,8 +19,8 @@ feature 'Has correct abilities' do
sign_in user
visit admin_conference_path(conference1.short_title)
expect(page.has_content?('Settings')).to be true
expect(page.has_content?('Manage')).to be true
expect(page.has_content?('Basics')).to be true
expect(page.has_content?('Dashboard')).to be true
expect(page.has_content?('Registrations')).to be true
expect(page.has_content?('Events')).to be true
expect(page.has_content?('Schedule')).to be true
@ -81,8 +81,8 @@ feature 'Has correct abilities' do
sign_in user
visit admin_conference_path(conference2.short_title)
expect(page.has_content?('Settings')).to be false
expect(page.has_content?('Manage')).to be true
expect(page.has_content?('Basics')).to be false
expect(page.has_content?('Dashboard')).to be true
# expect(page.has_content?('Registrations')).to be false
expect(page.has_content?('Events')).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?('Call for papers')).to be true
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)
expect(current_path).to eq(root_path)
@ -143,8 +143,8 @@ feature 'Has correct abilities' do
sign_in user
visit admin_conference_path(conference3.short_title)
expect(page.has_content?('Settings')).to be false
expect(page.has_content?('Manage')).to be true
expect(page.has_content?('Basics')).to be false
expect(page.has_content?('Dashboard')).to be true
expect(page.has_content?('Registrations')).to be true
expect(page.has_content?('Events')).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?('Call for papers')).to be false
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)
expect(current_path).to eq(root_path)
@ -206,8 +206,8 @@ feature 'Has correct abilities' do
sign_in user
visit admin_conference_path(conference4.short_title)
expect(page.has_content?('Settings')).to be false
expect(page.has_content?('Manage')).to be true
expect(page.has_content?('Basics')).to be false
expect(page.has_content?('Dashboard')).to be true
# expect(page.has_content?('Registrations')).to be false
expect(page.has_content?('Events')).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?('Call for papers')).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)
expect(current_path).to eq(root_path)

View file

@ -2,18 +2,16 @@ require 'spec_helper'
feature Contact do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
shared_examples 'update a contact' do |user|
shared_examples 'update a contact' do
scenario 'sucessfully', feature: true, js: true do
conference = create(:conference)
contact = conference.contact
expected_count = Contact.count
sign_in create(user)
sign_in organizer
visit edit_admin_conference_contact_path(conference.short_title)
click_link 'Edit'
@ -39,10 +37,6 @@ feature Contact do
end
end
describe 'admin' do
it_behaves_like 'update a contact', :admin
end
describe 'organizer' do
it_behaves_like 'update a contact', :organizer
end

View file

@ -2,16 +2,15 @@ require 'spec_helper'
feature Photo do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
let!(:conference) { create(:conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
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
expected_count = Photo.count + 1
conference = create(:conference)
sign_in create(user)
sign_in organizer
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
expected_count = Photo.count + 1
conference = create(:conference)
photo = create(:photo)
sign_in create(user)
photo = create(:photo, conference_id: conference.id)
sign_in organizer
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
expected_count = Photo.count
conference = create(:conference)
sign_in create(user)
sign_in organizer
visit new_admin_conference_photo_path(conference.short_title)
@ -64,12 +61,8 @@ feature Photo do
end
end
describe 'admin' do
it_behaves_like 'add and update photo', :admin
end
describe 'organizer' do
it_behaves_like 'add and update photo', :organizer
it_behaves_like 'add and update photo'
end
end