From 8ffa8b1e86b64402fde189652f403ae373317534 Mon Sep 17 00:00:00 2001 From: Stella Rouzi Date: Thu, 15 Oct 2015 20:25:34 +0300 Subject: [PATCH] Venue has show action, not index. Make the ability to schedule an Event more clear. --- app/models/ability.rb | 2 +- app/views/admin/venues/show.html.haml | 9 +++------ app/views/layouts/_admin_sidebar.html.haml | 8 ++++---- spec/models/ability_spec.rb | 6 +++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index bd30a8fd..3f07fe43 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -154,7 +154,7 @@ class Ability can :manage, DifficultyLevel, conference_id: conf_ids_for_cfp can :manage, EmailSettings, conference_id: conf_ids_for_cfp can :manage, Room, conference_id: conf_ids_for_cfp - can :index, Venue, conference_id: conf_ids_for_cfp + can :show, Venue, conference_id: conf_ids_for_cfp can :manage, CallForPaper, conference_id: conf_ids_for_cfp can :manage, Commercial, commercialable_type: 'Event', commercialable_id: Event.where(conference_id: conf_ids_for_cfp).pluck(:id) diff --git a/app/views/admin/venues/show.html.haml b/app/views/admin/venues/show.html.haml index 900e2b9e..d4ed1b27 100644 --- a/app/views/admin/venues/show.html.haml +++ b/app/views/admin/venues/show.html.haml @@ -20,12 +20,9 @@ = @venue.country_name .row .col-md-12 - = link_to(edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do - Edit Venue - = link_to(admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger') do - Delete Venue + = link_to 'Edit Venue', edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :edit, @conference.venue) + = link_to 'Delete Venue', admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', disabled: !(can? :edit, @conference.venue) -else .row .col-md-12.text-right - = link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do - Create Venue \ No newline at end of file + = link_to 'Create Venue', new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :edit, @conference.venue) diff --git a/app/views/layouts/_admin_sidebar.html.haml b/app/views/layouts/_admin_sidebar.html.haml index 016c77a2..ea9931df 100644 --- a/app/views/layouts/_admin_sidebar.html.haml +++ b/app/views/layouts/_admin_sidebar.html.haml @@ -47,7 +47,7 @@ - if can? :update, @conference %li{:class=> active_nav_li(edit_admin_conference_splashpage_path(@conference.short_title))} = link_to 'Splashpage', admin_conference_splashpage_path(@conference.short_title) - - if can? :index, Venue.new(conference_id: @conference.id) + - if can? :show, Venue.new(conference_id: @conference.id) %li{:class=> "#{active_nav_li(admin_conference_venue_path(@conference.short_title))}"} = link_to(admin_conference_venue_path(@conference.short_title)) do %span.fa.fa-road @@ -59,14 +59,14 @@ - if can? :update, @conference.lodgings.build %li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) } = link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title) + - if can? :update, @conference.events.build %li %a %span.fa.fa-calendar Program %ul - - if can? :update, @conference.events.build - %li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} - = link_to 'Events', admin_conference_events_path(@conference.short_title) + %li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))} + = link_to 'Events', admin_conference_events_path(@conference.short_title) - if can? :update, CallForPaper.new(conference_id: @conference.id) %li{:class=> "#{active_nav_li(admin_conference_call_for_paper_path(@conference.short_title))}"} = link_to 'Call for Papers', admin_conference_call_for_paper_path(@conference.short_title) diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 73812dc1..192b8dac 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -176,7 +176,7 @@ describe 'User' do it{ should be_able_to(:manage, my_conference.call_for_paper) } it{ should_not be_able_to(:manage, conference_public.call_for_paper) } it{ should_not be_able_to(:manage, my_conference.venue) } - it{ should be_able_to(:index, my_conference.venue) } + it{ should be_able_to(:show, my_conference.venue) } it{ should_not be_able_to(:manage, conference_public.venue) } it{ should_not be_able_to(:manage, my_conference.lodgings.first) } it{ should_not be_able_to(:manage, conference_public.lodgings.first) } @@ -235,7 +235,7 @@ describe 'User' do it{ should_not be_able_to(:manage, my_conference.call_for_paper) } it{ should_not be_able_to(:manage, conference_public.call_for_paper) } it{ should_not be_able_to(:manage, my_conference.venue) } - it{ should_not be_able_to(:index, my_conference.venue) } + it{ should_not be_able_to(:show, my_conference.venue) } it{ should_not be_able_to(:manage, conference_public.venue) } it{ should_not be_able_to(:manage, my_conference.lodgings.first) } it{ should_not be_able_to(:manage, conference_public.lodgings.first) } @@ -294,7 +294,7 @@ describe 'User' do it{ should_not be_able_to(:manage, my_conference.call_for_paper) } it{ should_not be_able_to(:manage, conference_public.call_for_paper) } it{ should_not be_able_to(:manage, my_conference.venue) } - it{ should_not be_able_to(:index, my_conference.venue) } + it{ should_not be_able_to(:show, my_conference.venue) } it{ should_not be_able_to(:manage, conference_public.venue) } it{ should_not be_able_to(:manage, my_conference.lodgings.first) } it{ should_not be_able_to(:manage, conference_public.lodgings.first) }