aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorRobert2017-05-23 09:30:56 +0200
committerRobert2017-05-23 09:30:56 +0200
commit5e3c2d8daba5617a72d0bfd06e0b6b3f03628f56 (patch)
tree714d9cb0fd8c177c34bdb3601d8a29da8278bf2a /app
parentb8b9af8b1f7cd29d8974607a946120f379aaf79a (diff)
parentf17e77619409283db7040f270e276813339f919f (diff)
downloadchouette-core-5e3c2d8daba5617a72d0bfd06e0b6b3f03628f56.tar.bz2
Merge branch '3449_timetable_policies'
Diffstat (limited to 'app')
-rw-r--r--app/policies/time_table_policy.rb4
-rw-r--r--app/views/time_tables/show.html.slim4
2 files changed, 6 insertions, 2 deletions
diff --git a/app/policies/time_table_policy.rb b/app/policies/time_table_policy.rb
index 6ca02f451..82e4ca194 100644
--- a/app/policies/time_table_policy.rb
+++ b/app/policies/time_table_policy.rb
@@ -17,6 +17,10 @@ class TimeTablePolicy < ApplicationPolicy
organisation_match? && user.has_permission?('time_tables.destroy')
end
+ def duplicate?
+ organisation_match? && create?
+ end
+
def update? ; edit? end
def new? ; create? end
end
diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim
index 46c32f4b0..1c5984a7d 100644
--- a/app/views/time_tables/show.html.slim
+++ b/app/views/time_tables/show.html.slim
@@ -17,8 +17,8 @@
/- if policy(@time_table).create? && @referential.organisation == current_organisation
= link_to t('actions.combine'), new_referential_time_table_time_table_combination_path(@referential, @time_table), class: 'btn btn-primary'
- - if policy(@time_table).create? && @referential.organisation == current_organisation
- = link_to t('actions.clone'), duplicate_referential_time_table_path(@referential, @time_table), class: 'btn btn-primary'
+ - if policy(@time_table).duplicate?
+ = link_to t('actions.duplicate'), duplicate_referential_time_table_path(@referential, @time_table), class: 'btn btn-primary'
- if policy(@time_table).destroy?
= link_to referential_time_table_path(@referential, @time_table), method: :delete, data: {confirm: t('time_tables.actions.destroy_confirm')}, class: 'btn btn-primary' do