From 433774d88f0b40b78c6c81570891f6ebbfd5f5cd Mon Sep 17 00:00:00 2001 From: AndriiAndriyovuch Date: Sun, 17 Sep 2023 13:11:50 +0300 Subject: [PATCH] add confim and locales to it, move revert button to right bottom of the container --- .../stylesheets/pages/feature_flags.scss | 5 +++++ app/views/account/site_settings/edit.html.slim | 18 +++++++++--------- config/locales/en/en.yml | 1 + config/locales/uk/uk.yml | 1 + config/routes.rb | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/app/assets/stylesheets/pages/feature_flags.scss b/app/assets/stylesheets/pages/feature_flags.scss index 0ca26910a..0f74fc90b 100644 --- a/app/assets/stylesheets/pages/feature_flags.scss +++ b/app/assets/stylesheets/pages/feature_flags.scss @@ -62,3 +62,8 @@ input[type="submit"] { background-color: darkred !important; } } + +.right-bottom { + right: 0; + bottom: 0; +} diff --git a/app/views/account/site_settings/edit.html.slim b/app/views/account/site_settings/edit.html.slim index 994b1771a..e2c5288e5 100644 --- a/app/views/account/site_settings/edit.html.slim +++ b/app/views/account/site_settings/edit.html.slim @@ -1,17 +1,17 @@ fieldset.bordered legend.admin-legend = t(".site_settings") - = simple_form_for @site_setting, url: account_site_setting_path, html: { data: { controller: "handle-browser-tab" } } do |f| - .form-group.row - .col-12.has-float-label.my-auto - = f.input :title, class: "form-control", input_html: { data: { action: "input->handle-browser-tab#setTitle" } } - = f.input :favicon, class: "form-control", input_html: { data: { action: "change->handle-browser-tab#setIcon" } } - = render "browser_tab", site_setting: @site_setting + div.position-relative + = simple_form_for @site_setting, url: account_site_setting_path, html: { data: { controller: "handle-browser-tab" } } do |f| + .form-group.row + .col-12.has-float-label.my-auto + = f.input :title, class: "form-control", input_html: { data: { action: "input->handle-browser-tab#setTitle" } } + = f.input :favicon, class: "form-control", input_html: { data: { action: "change->handle-browser-tab#setIcon" } } + = render "browser_tab", site_setting: @site_setting - = f.submit t("buttons.update") - i.fa.fa-times-circle + = f.submit t("buttons.update"), class: "inline" - = button_to t("buttons.revert"), account_site_settings_revert_path, method: :get, class: "btn-revert mt-2" + = button_to t("buttons.revert"), account_site_settings_revert_path, onclick: "return confirm('#{j(t('.confirm_default'))}')", class: "btn-revert position-absolute right-bottom" fieldset.bordered legend.admin-legend diff --git a/config/locales/en/en.yml b/config/locales/en/en.yml index d063a5e09..07893db40 100644 --- a/config/locales/en/en.yml +++ b/config/locales/en/en.yml @@ -247,6 +247,7 @@ en: edit: site_settings: Site settings site_features: Site features + confirm_default: Are you sure you want to revert the title and favicon to their default settings? calculators: index: search_placeholder: "Search" diff --git a/config/locales/uk/uk.yml b/config/locales/uk/uk.yml index a33705cc1..66f04a6b6 100644 --- a/config/locales/uk/uk.yml +++ b/config/locales/uk/uk.yml @@ -254,6 +254,7 @@ uk: edit: site_settings: Налаштування сайту site_features: Особливості сайту + confirm_default: Ви впевнені, що бажаєте повернути налаштування за замовчуванням для назви та значка сайту? feature_flags: submit_button: "Зберегти" new_calculator_design: diff --git a/config/routes.rb b/config/routes.rb index 14fbef8e3..c9dfea1f2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -43,7 +43,7 @@ resource :app_config, only: [:edit, :update] patch "/feature_flags", to: "feature_flags#update", as: "features_flags" resource :site_setting, only: [:edit, :update] - get "site_settings/revert", to: "site_settings#revert" + post "site_settings/revert", to: "site_settings#revert" scope module: :calculators do resources :calculators, only: [], param: :slug do