added access levels

This commit is contained in:
Harry Bomrah 2014-07-31 17:11:38 +08:00
parent 6eb36f2374
commit dd60393057
3 changed files with 11 additions and 4 deletions

View File

@ -12,6 +12,7 @@
<td> <td>
<%= banner.title %> <%= banner.title %>
<div class="quick-edit"> <div class="quick-edit">
<% if can_edit_or_delete?(banner) %>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li> <li>
<a data-title="Edit Banner" data-id="<%= banner.id.to_s %>" data-fx="<%= banner.ad_fx %>" data-form="<%= banner.data_attribute_hash.to_s %>" class="open-slide" href="#">Edit</a> <a data-title="Edit Banner" data-id="<%= banner.id.to_s %>" data-fx="<%= banner.ad_fx %>" data-form="<%= banner.data_attribute_hash.to_s %>" class="open-slide" href="#">Edit</a>
@ -20,6 +21,7 @@
<a href="/admin/ad_banners/<%= banner.id.to_s %>" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a> <a href="/admin/ad_banners/<%= banner.id.to_s %>" data-method="delete" data-confirm="Are you sure?" ><%= t(:delete_) %></a>
</li> </li>
</ul> </ul>
<% end %>
</div> </div>
</td> </td>
<td><%= banner.ad_fx %></td> <td><%= banner.ad_fx %></td>

View File

@ -14,6 +14,7 @@
<td> <td>
<%= image.title %> <%= image.title %>
<div class="quick-edit"> <div class="quick-edit">
<% if can_edit_or_delete?(image) %>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li> <li>
<a href="/<%= I18n.locale %>/admin/ad_images/<%= image.id.to_s %>/edit"><%= t(:edit) %></a> <a href="/<%= I18n.locale %>/admin/ad_images/<%= image.id.to_s %>/edit"><%= t(:edit) %></a>
@ -22,6 +23,7 @@
<a class="text-error" href="/<%= I18n.locale %>/admin/ad_images/<%= image.id.to_s %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a> <a class="text-error" href="/<%= I18n.locale %>/admin/ad_images/<%= image.id.to_s %>" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a>
</li> </li>
</ul> </ul>
<% end %>
</div> </div>
</td> </td>
<td><%= format_value image.postdate %></td> <td><%= format_value image.postdate %></td>

View File

@ -12,24 +12,27 @@ module AdBanner
side_bar do side_bar do
head_label_i18n 'ad_banner.ad_banner', icon_class: "icons-landscape" 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']) active_for_controllers (['admin/ad_banners','admin/ad_images'])
head_link_path "admin_ad_banners_path" head_link_path "admin_ad_banners_path"
context_link 'ad_banner.all', context_link 'ad_banner.all',
:link_path=>"admin_ad_images_path" , :link_path=>"admin_ad_images_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/ad_images'=>"index"} :active_for_action=>{'admin/ad_images'=>"index"},
:available_for => 'users'
context_link 'ad_banner.add', context_link 'ad_banner.add',
:link_path=>"new_admin_ad_image_path" , :link_path=>"new_admin_ad_image_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/ad_images'=>"new"} :active_for_action=>{'admin/ad_images'=>"new"},
:available_for => 'managers'
context_link 'ad_banner.banner', context_link 'ad_banner.banner',
:link_path=>"admin_ad_banners_path" , :link_path=>"admin_ad_banners_path" ,
:priority=>3, :priority=>3,
:active_for_action=>{'admin/ad_banners'=>"index"} :active_for_action=>{'admin/ad_banners'=>"index"},
:available_for => 'users'
end end
end end
end end