This commit is contained in:
BoHung Chiu 2022-05-12 15:35:53 +08:00
parent e7aafff59b
commit b7680a7b61
2 changed files with 3 additions and 3 deletions

View File

@ -103,7 +103,7 @@ class Admin::AsksController < OrbitAdminController
@ask_setting = AskSetting.first
@ask_setting = AskSetting.create() if @ask_setting.nil?
@tags = @module_app.tags
@categories = @module_app.categories.enabled.sort_by{|category| (((module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
@categories = @module_app.categories.enabled.sort_by{|category| (((@module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
@filter_fields = filter_fields(@categories, @tags)
# 列表欄位
@table_fields = [:situation, :category, 'title' , 'ask.name', 'ask.phone', 'ask.appointment','ask.created_at']
@ -139,7 +139,7 @@ class Admin::AsksController < OrbitAdminController
end
def category_setting
@default_ask_setting = AskSetting.first
@categories = current_user.approved_categories_for_module(@module_app).sort_by{|category| (((module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
@categories = current_user.approved_categories_for_module(@module_app).sort_by{|category| (((@module_app.asc rescue true) ? category.sort_number.to_i : -category.sort_number.to_i) rescue category.id)}
@category_ids = @categories.collect(&:id)
@category_titles = @categories.collect{|v| v.title}

View File

@ -18,7 +18,7 @@ module Admin::AsksHelper
access_level = OrbitHelper.user_access_level?
if access_level == "sub_manager"
cats_relations = current_user.approved_categories_for_module(@module_app).map{|c| [c.id.to_s, c.title]}
else
elsif access_level && access_level != "user"
cats = @module_app.categories.enabled
cats_relations = [["",t(:all)]] + cats.map{|c| [c.id.to_s, c.title]}
end