diff --git a/app/javascript/application.js b/app/javascript/application.js index 75178c96..458a7a4e 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -164,6 +164,7 @@ safeRegisterElement('template-builder', class extends HTMLElement { this.app = createApp(TemplateBuilder, { template, customFields: reactive(JSON.parse(this.dataset.customFields || '[]')), + dateFormats: JSON.parse(this.dataset.dateFormats || '[]'), dynamicDocuments: reactive(JSON.parse(this.dataset.dynamicDocuments || '[]')), backgroundColor: '#faf7f5', locale: this.dataset.locale, diff --git a/app/models/account_config.rb b/app/models/account_config.rb index 5881302e..fa6d89b7 100644 --- a/app/models/account_config.rb +++ b/app/models/account_config.rb @@ -60,6 +60,7 @@ class AccountConfig < ApplicationRecord COMBINE_PDF_RESULT_KEY = 'combine_pdf_result_key' DOCUMENT_FILENAME_FORMAT_KEY = 'document_filename_format' TEMPLATE_CUSTOM_FIELDS_KEY = 'template_custom_fields' + TEMPLATE_DATE_FORMATS_KEY = 'template_date_formats' POLICY_LINKS_KEY = 'policy_links' ENABLE_MCP_KEY = 'enable_mcp' diff --git a/app/views/templates/edit.html.erb b/app/views/templates/edit.html.erb index 5ef4c41f..e02bc39b 100644 --- a/app/views/templates/edit.html.erb +++ b/app/views/templates/edit.html.erb @@ -6,4 +6,7 @@ <%= button_to nil, user_configs_path, method: :post, params: { user_config: { key: UserConfig::SHOW_APP_TOUR, value: true } }, class: 'hidden', id: 'start_tour_button' %> <% end %> <% end %> - +<% account_configs = current_account.account_configs.where(key: [AccountConfig::TEMPLATE_CUSTOM_FIELDS_KEY, AccountConfig::TEMPLATE_DATE_FORMATS_KEY]).to_a %> +<% custom_fields = account_configs.find { |e| e.key == AccountConfig::TEMPLATE_CUSTOM_FIELDS_KEY }&.value || [] %> +<% date_formats = account_configs.find { |e| e.key == AccountConfig::TEMPLATE_DATE_FORMATS_KEY }&.value || [] %> +