Skip to content

Commit

Permalink
add confim and locales to it, move revert button to right bottom of t…
Browse files Browse the repository at this point in the history
…he container
  • Loading branch information
AndriyAndriyovuch committed Sep 17, 2023
1 parent 5f760dd commit 433774d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/pages/feature_flags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ input[type="submit"] {
background-color: darkred !important;
}
}

.right-bottom {
right: 0;
bottom: 0;
}
18 changes: 9 additions & 9 deletions app/views/account/site_settings/edit.html.slim
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions config/locales/en/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions config/locales/uk/uk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ uk:
edit:
site_settings: Налаштування сайту
site_features: Особливості сайту
confirm_default: Ви впевнені, що бажаєте повернути налаштування за замовчуванням для назви та значка сайту?
feature_flags:
submit_button: "Зберегти"
new_calculator_design:
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 433774d

Please sign in to comment.