fix sponsor test, fixes from rebase, remove admin area check from application controller, fix admin menu layout

This commit is contained in:
Stella Rouzi 2014-08-14 11:37:30 +03:00
parent 17ebad413e
commit ba6643a394
4 changed files with 17 additions and 26 deletions

View file

@ -3,7 +3,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :get_conferences
before_filter :store_location
before_filter :verify_user_admin
helper_method :date_string
# Ensure every controller authorizes resource or skips authorization (skip_authorization_check)
check_authorization unless: :devise_controller?
@ -34,16 +33,6 @@ class ApplicationController < ActionController::Base
@conferences =Conference.all
end
def verify_user_admin
if self.class.to_s.split('::').first == 'Admin' && verify_user
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
(current_user.has_role? :info_desk, :any) ||
(current_user.has_role? :volunteers_coordinator, :any) || current_user.is_admin
raise CanCan::AccessDenied.new('You are not authorized to access this area!')
end
end
end
def verify_user
:authenticate_user!

View file

@ -64,8 +64,8 @@ class ConferenceRegistrationController < ApplicationController
registration.conference_id = @conference.id
registration.save!
if user.subscriptions.where(conference: conference).blank?
subscription = Subscription.new(conference_id: conference.id, user_id: user.id)
if user.subscriptions.where(conference: @conference).blank?
subscription = Subscription.new(conference_id: @conference.id, user_id: user.id)
redirect_message = subscription.save ? 'You are now Registered and will be receiving Email Notifications.' : 'You are now Registered.'
end
else

View file

@ -32,22 +32,22 @@
= link_to(edit_admin_conference_path(@conference.short_title)) do
%span.fa.fa-home
Basics
- if can? :update, Contact.new(conference_id: @conference.id)
%ul
%ul
- if can? :update, Contact.new(conference_id: @conference.id)
%li{:class=> "#{active_nav_li(edit_admin_conference_contact_path(@conference.short_title))}"}
= link_to(edit_admin_conference_contact_path(@conference.short_title)) do
%span.fa.fa-envelope-o
Contact
- if can? :index, @conference.commercials.build
%li{:class=> "#{active_nav_li(admin_conference_commercials_path(@conference.short_title))}"}
= link_to(admin_conference_commercials_path(@conference.short_title)) do
%span.fa.fa-film
Commercials
- if can? :update, @conference.photos.build
%li{:class=> "#{active_nav_li(admin_conference_photos_path(@conference.short_title))}"}
= link_to(admin_conference_photos_path(@conference.short_title)) do
%span.fa.fa-picture-o
Photos
- if can? :index, @conference.commercials.build
%li{:class=> "#{active_nav_li(admin_conference_commercials_path(@conference.short_title))}"}
= link_to(admin_conference_commercials_path(@conference.short_title)) do
%span.fa.fa-film
Commercials
- if can? :update, @conference.photos.build
%li{:class=> "#{active_nav_li(admin_conference_photos_path(@conference.short_title))}"}
= link_to(admin_conference_photos_path(@conference.short_title)) do
%span.fa.fa-picture-o
Photos
- if can? :update, @conference.events.build
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
= link_to(admin_conference_events_path(@conference.short_title)) do

View file

@ -62,7 +62,9 @@ feature Sponsor do
# Remove sponsor
click_link 'Remove sponsor'
expect(page.all('div.nested-fields').count == 0).to be true
click_button 'Update Conference'
find('button', text: 'Update Conference').trigger('click')
expect(flash).to eq('Sponsorships were successfully updated.')
expect(page.all('div.nested-fields').count == 0).to be true
end