Update bakend index display fields.

This commit is contained in:
BoHung Chiu 2022-04-19 12:31:17 +08:00
parent 4008b699e4
commit bfe87b3a6d
2 changed files with 10 additions and 1 deletions

View File

@ -58,8 +58,14 @@ class Admin::AnnouncementsController < OrbitAdminController
Bulletin.remove_expired_status Bulletin.remove_expired_status
@tags = @module_app.tags @tags = @module_app.tags
@table_fields = [:status, :category, :title, :start_date, :end_date, "announcement.comment", :last_modified] @table_fields = [:status, :category, :title, :start_date, :end_date, "announcement.comment", :last_modified]
setting = AnnouncementSetting.first
@annc_depts = []
if (setting.enable_annc_dept rescue false)
@table_fields.insert(1, "announcement.annc_dept")
@annc_depts = setting.annc_depts
end
@current_user = current_user @current_user = current_user
if AnnouncementSetting.first.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app) if setting.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app)
current_user_is_sub_manager = !current_user.is_manager?(@module_app) && (current_user.is_sub_manager?(@module_app) || current_user.is_sub_manager_with_role?(@module_app)) rescue false current_user_is_sub_manager = !current_user.is_manager?(@module_app) && (current_user.is_sub_manager?(@module_app) || current_user.is_sub_manager_with_role?(@module_app)) rescue false
if current_user_is_sub_manager if current_user_is_sub_manager
@categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue [] @categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue []

View File

@ -16,6 +16,9 @@
<td> <td>
<%= b.status_for_table %> <%= b.status_for_table %>
</td> </td>
<td>
<%= b.annc_dept ? @annc_depts[b.annc_dept] : '' rescue "" %>
</td>
<td> <td>
<%= b.category.title rescue "" %> <%= b.category.title rescue "" %>
<% if (b.category.disable rescue false) %> <% if (b.category.disable rescue false) %>