From dd6039305708a7a419d10819cac5d2858f747d6a Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 31 Jul 2014 17:11:38 +0800 Subject: [PATCH] added access levels --- app/views/admin/ad_banners/_index.html.erb | 2 ++ app/views/admin/ad_images/index.html.erb | 2 ++ lib/ad_banner/engine.rb | 11 +++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb index e2c71e2..9386712 100644 --- a/app/views/admin/ad_banners/_index.html.erb +++ b/app/views/admin/ad_banners/_index.html.erb @@ -12,6 +12,7 @@ <%= banner.title %>
+ <% if can_edit_or_delete?(banner) %> + <% end %>
<%= banner.ad_fx %> diff --git a/app/views/admin/ad_images/index.html.erb b/app/views/admin/ad_images/index.html.erb index 856ab43..c36888f 100644 --- a/app/views/admin/ad_images/index.html.erb +++ b/app/views/admin/ad_images/index.html.erb @@ -14,6 +14,7 @@ <%= image.title %>
+ <% if can_edit_or_delete?(image) %> + <% end %>
<%= format_value image.postdate %> diff --git a/lib/ad_banner/engine.rb b/lib/ad_banner/engine.rb index 9c4ad6d..74079f2 100644 --- a/lib/ad_banner/engine.rb +++ b/lib/ad_banner/engine.rb @@ -12,24 +12,27 @@ module AdBanner side_bar do head_label_i18n 'ad_banner.ad_banner', icon_class: "icons-landscape" - available_for [:admin,:manager,:sub_manager] + available_for "users" active_for_controllers (['admin/ad_banners','admin/ad_images']) head_link_path "admin_ad_banners_path" context_link 'ad_banner.all', :link_path=>"admin_ad_images_path" , :priority=>1, - :active_for_action=>{'admin/ad_images'=>"index"} + :active_for_action=>{'admin/ad_images'=>"index"}, + :available_for => 'users' context_link 'ad_banner.add', :link_path=>"new_admin_ad_image_path" , :priority=>1, - :active_for_action=>{'admin/ad_images'=>"new"} + :active_for_action=>{'admin/ad_images'=>"new"}, + :available_for => 'managers' context_link 'ad_banner.banner', :link_path=>"admin_ad_banners_path" , :priority=>3, - :active_for_action=>{'admin/ad_banners'=>"index"} + :active_for_action=>{'admin/ad_banners'=>"index"}, + :available_for => 'users' end end end