From 804431c44abe0bce70103cb236456ac51ef533df Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 18 Sep 2025 10:05:04 +0300 Subject: [PATCH] adjust account preferences --- app/javascript/elements/submit_form.js | 4 + app/views/accounts/show.html.erb | 132 ++++++++++++++----------- 2 files changed, 81 insertions(+), 55 deletions(-) diff --git a/app/javascript/elements/submit_form.js b/app/javascript/elements/submit_form.js index 7a27ed5f..164a069e 100644 --- a/app/javascript/elements/submit_form.js +++ b/app/javascript/elements/submit_form.js @@ -4,6 +4,10 @@ export default class extends HTMLElement { this.interval = setInterval(() => { this.querySelector('form').requestSubmit() }, parseInt(this.dataset.interval)) + } else if (this.dataset.on) { + this.lastElementChild.addEventListener(this.dataset.on, () => { + this.lastElementChild.form.requestSubmit() + }) } else { this.querySelector('form').requestSubmit() } diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index aae5a3eb..4152d1d0 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -51,13 +51,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('force_2fa_with_authenticator_app') %> +
+ <%= t('force_2fa_with_authenticator_app') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value %> +
<% end %> <% end %> @@ -66,13 +68,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('add_signature_id_to_the_documents') %> +
+ <%= t('add_signature_id_to_the_documents') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()', disabled: can?(:manage, :cfr) %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value, disabled: can?(:manage, :cfr) %> +
<% end %> <% end %> @@ -81,13 +85,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('require_signing_reason') %> +
+ <%= t('require_signing_reason') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()', disabled: can?(:manage, :cfr) %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value, disabled: can?(:manage, :cfr) %> +
<% end %> <% end %> @@ -96,13 +102,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('allow_typed_text_signatures') %> +
+ <%= t('allow_typed_text_signatures') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false %> +
<% end %> <% end %> @@ -111,13 +119,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('allow_to_resubmit_completed_forms') %> +
+ <%= t('allow_to_resubmit_completed_forms') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false %> +
<% end %> <% end %> @@ -126,13 +136,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('allow_to_decline_documents') %> +
+ <%= t('allow_to_decline_documents') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false %> +
<% end %> <% end %> @@ -141,13 +153,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('remember_and_pre_fill_signatures') %> +
+ <%= t('remember_and_pre_fill_signatures') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false %> +
<% end %> <% end %> @@ -156,13 +170,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('expirable_file_download_links') %> +
+ <%= t('expirable_file_download_links') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value != false, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value != false %> +
<% end %> <% end %> @@ -171,13 +187,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('require_authentication_for_file_download_links') %> +
+ <%= t('require_authentication_for_file_download_links') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value %> +
<% end %> <% end %> @@ -186,13 +204,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('combine_completed_documents_and_audit_log') %> +
+ <%= t('combine_completed_documents_and_audit_log') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value %> +
<% end %> <% end %> @@ -202,13 +222,15 @@ <%= form_for account_config, url: account_configs_path, method: :post do |f| %> <%= f.hidden_field :key %>
-
-
- <%= t('always_enforce_signing_order') %> +
+ <%= t('always_enforce_signing_order') %> + <%= svg_icon('info_circle', class: 'hidden md:inline-block w-4 h-4 shrink-0') %> -
+
- <%= f.check_box :value, class: 'toggle', checked: account_config.value, onchange: 'this.form.requestSubmit()' %> + + <%= f.check_box :value, class: 'toggle', checked: account_config.value %> +
<% end %> <% end %>