From 636a7aa71d4d6447b5a078be8336d6fae63bccd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 31 Dec 2022 16:05:26 +0800 Subject: [PATCH] fix error --- app/controllers/admin/asks_controller.rb | 6 ++++-- app/helpers/admin/asks_helper.rb | 2 +- app/views/admin/asks/do_export.xlsx.axlsx | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/asks_controller.rb b/app/controllers/admin/asks_controller.rb index 49644c6..8c7c903 100644 --- a/app/controllers/admin/asks_controller.rb +++ b/app/controllers/admin/asks_controller.rb @@ -439,7 +439,7 @@ class Admin::AsksController < OrbitAdminController def get_fields_with_key(s) fields_with_key = {} fields_with_key['default_values'] = s.default_setting.collect{|k,v| [k, process_trans(s.field_name_translations(k))] if v && !['ask_category_id','recaptcha'].include?(k)}.compact - fields_with_key['default_values'] = [['ask_category_id', process_trans(s.field_name_translations('ask_category_id'))]] + fields_with_key['default_values'] + fields_with_key['default_values'] = [['ask_category_id', process_trans(s.field_name_translations('ask_category_id'))]] + [['situation', process_trans(I18n.available_locales.map{|v| [v.to_s, I18n.with_locale(v){I18n.t('ask.situation')}]}.to_h)]] + fields_with_key['default_values'] fields_with_key['default_values'] = fields_with_key['default_values'].to_h fields_with_key['custom_values'] = s.custom_fields.collect{|k, field_setting| [k, process_trans(field_setting['field'])]}.to_h fields_with_key @@ -460,6 +460,7 @@ class Admin::AsksController < OrbitAdminController end ask_category_settings[nil] = ask_default_setting fields_with_key_group[nil] = get_fields_with_key(ask_default_setting) + situations = AskTicketStatus.all.collect{|situation| [situation.key, situation.get_title_translations]} render xlsx: 'do_export.xlsx', handlers: ['axlsx'], filename: "Questions-#{date_start}-#{date_end}.xlsx", @@ -467,7 +468,8 @@ class Admin::AsksController < OrbitAdminController :ask_category_settings => ask_category_settings, :fields_with_key_group => fields_with_key_group, :categories => categories.collect{|c| [c.id, c]}.to_h, - :ask_questions => ask_questions + :ask_questions => ask_questions, + :situations => situations } end diff --git a/app/helpers/admin/asks_helper.rb b/app/helpers/admin/asks_helper.rb index 4d8c872..97555ba 100644 --- a/app/helpers/admin/asks_helper.rb +++ b/app/helpers/admin/asks_helper.rb @@ -329,7 +329,7 @@ module Admin::AsksHelper file_value = value[0] rescue nil file_path = value[1] rescue nil file_required = v['required']=='true' ? 'required="required"' : '' - readonly ? "\"#{file_value}\"" : "