Fix link in category for authorization, fix update of auth users

This commit is contained in:
chris 2013-10-02 12:18:20 +08:00
parent b18e61a6c0
commit 433c8d5da6
2 changed files with 4 additions and 4 deletions

View File

@ -185,18 +185,18 @@ class ModuleApp
user_ids = self.auth_approvals.inject([]) do |users, auth| user_ids = self.auth_approvals.inject([]) do |users, auth|
users += auth.authorized_users.map{|user| user.id} users += auth.authorized_users.map{|user| user.id}
end end
update_attribute(:auth_approval_users, user_ids.uniq) self.update_attribute(:auth_approval_users, user_ids.uniq)
end end
def update_auth_manager_users def update_auth_manager_users
update_attribute(:auth_manager_users, self.auth_manager_authorized_users.map{|user| user.id}) self.update_attribute(:auth_manager_users, self.auth_manager_authorized_users.map{|user| user.id})
end end
def update_auth_sub_manager_users def update_auth_sub_manager_users
user_ids = self.auth_sub_managers.inject([]) do |users, auth| user_ids = self.auth_sub_managers.inject([]) do |users, auth|
users += auth.authorized_users.map{|user| user.id} users += auth.authorized_users.map{|user| user.id}
end end
update_attribute(:auth_sub_manager_users, user_ids.uniq) self.update_attribute(:auth_sub_manager_users, user_ids.uniq)
end end
def managers def managers

View File

@ -10,7 +10,7 @@
<li><%= link_to show_toggle_archive_btn(category) , toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li> <li><%= link_to show_toggle_archive_btn(category) , toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li>
<% end %> <% end %>
<% if is_manager? || is_admin? %> <% if is_manager? || is_admin? %>
<li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category', category.id) %></li> <li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category_authorization', category.id) %></li>
<% end %> <% end %>
</ul> </ul>
</div> </div>