added access levels to this module

This commit is contained in:
Harry Bomrah 2014-07-31 17:12:13 +08:00
parent bc7b77f5c8
commit 9fc4bffff3
3 changed files with 18 additions and 13 deletions

View File

@ -24,7 +24,6 @@ class Admin::AnnouncementsController < OrbitAdminController
def new
@tags = @module_app.tags
@categories = @module_app.categories.enabled
@statuses = []
@bulletin = Bulletin.new
@bulletin.email_sentdate = Time.now
@ -46,10 +45,14 @@ class Admin::AnnouncementsController < OrbitAdminController
end
def edit
if can_edit_or_delete?(@bulletin)
@tags = @module_app.tags
@categories = @module_app.categories.enabled
@statuses = []
@bulletin.email_sentdate = Time.now if @bulletin.email_sent == false
else
render_401
end
end
def update

View File

@ -19,9 +19,11 @@
<a href="<%=page_for_bulletin(b)%>" target="_blank"><%= b.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><a href="/admin/announcements/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="detail-row" onclick="$('#<%= "#{b.id.to_s}-detail" %>').slideToggle(300); return false;"><%= t(:detail) %></a></li>
<% if can_edit_or_delete?(b) %>
<li><a href="/admin/announcements/<%=b.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/announcements/<%=b.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
</td>

View File

@ -14,7 +14,7 @@ module Announcement
side_bar do
head_label_i18n 'announcement.announcement', icon_class: "icons-megaphone"
available_for [:admin,:manager,:sub_manager]
available_for "users"
active_for_controllers (['admin/announcements'])
head_link_path "admin_announcements_path"
@ -22,26 +22,26 @@ module Announcement
:link_path=>"admin_announcements_path" ,
:priority=>1,
:active_for_action=>{'admin/announcements'=>'index'},
:available_for => [:all]
:available_for => 'users'
context_link 'new_',
:link_path=>"new_admin_announcement_path" ,
:priority=>2,
:active_for_action=>{'admin/announcements'=>'new'},
:available_for => [:sub_manager]
:available_for => 'sub_managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
:priority=>3,
:active_for_action=>{'admin/announcements'=>'categories'},
:active_for_category => 'Announcement',
:available_for => [:manager]
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
:priority=>4,
:active_for_action=>{'admin/announcements'=>'tags'},
:active_for_tag => 'Announcement',
:available_for => [:manager]
:available_for => 'managers'
end
end