]> cat aescling's git repositories - mastodon.git/commitdiff
Add submit button to the top of preferences pages (#13068)
authorguigeekz <pattusg@gmail.com>
Sun, 8 Mar 2020 15:04:03 +0000 (16:04 +0100)
committerGitHub <noreply@github.com>
Sun, 8 Mar 2020 15:04:03 +0000 (16:04 +0100)
* Move submit button to the top of the edit page

* Duplicate save button on long form

* Fix click submit on profile spec

app/views/admin/settings/edit.html.haml
app/views/settings/preferences/appearance/show.html.haml
app/views/settings/preferences/notifications/show.html.haml
app/views/settings/preferences/other/show.html.haml
app/views/settings/profiles/show.html.haml
spec/features/profile_spec.rb

index dc08f0141bd69a4c61b8ccd25412a762b4a58064..f37775aa985a7bca1866fce95b936dc51d3c9591 100644 (file)
@@ -4,7 +4,10 @@
 - content_for :page_title do
   = t('admin.settings.title')
 
-= simple_form_for @admin_settings, url: admin_settings_path, html: { method: :patch } do |f|
+  - content_for :heading_actions do
+    = button_tag t('generic.save_changes'), class: 'button', form: 'edit_admin'
+
+= simple_form_for @admin_settings, url: admin_settings_path, html: { method: :patch, id: 'edit_admin' } do |f|
   = render 'shared/error_messages', object: @admin_settings
 
   .fields-group
index d2b05513e39df390c11072dadbe33e605d785237..acddf78844e35240436cd6a0481bd7d3fb52f3e4 100644 (file)
@@ -1,7 +1,10 @@
 - content_for :page_title do
   = t('settings.appearance')
 
-= simple_form_for current_user, url: settings_preferences_appearance_path, html: { method: :put } do |f|
+- content_for :heading_actions do
+  = button_tag t('generic.save_changes'), class: 'button', form: 'edit_user'
+
+= simple_form_for current_user, url: settings_preferences_appearance_path, html: { method: :put, id: 'edit_user' } do |f|
   .fields-row
     .fields-group.fields-row__column.fields-row__column-6
       = f.input :locale, collection: I18n.available_locales, wrapper: :with_label, include_blank: false, label_method: lambda { |locale| human_locale(locale) }, selected: I18n.locale, hint: false
index a496be21b239cd2e17f4699ff1223731f048b3f7..d7cc1ed5d16b6b625b9d953ca0248ca84cb3746d 100644 (file)
@@ -1,7 +1,10 @@
 - content_for :page_title do
   = t('settings.notifications')
 
-= simple_form_for current_user, url: settings_preferences_notifications_path, html: { method: :put } do |f|
+- content_for :heading_actions do
+  = button_tag t('generic.save_changes'), class: 'button', form: 'edit_notification'
+
+= simple_form_for current_user, url: settings_preferences_notifications_path, html: { method: :put, id: 'edit_notification' } do |f|
   = render 'shared/error_messages', object: current_user
 
   %h4= t 'notifications.email_events'
@@ -32,6 +35,3 @@
       = ff.input :must_be_follower, as: :boolean, wrapper: :with_label
       = ff.input :must_be_following, as: :boolean, wrapper: :with_label
       = ff.input :must_be_following_dm, as: :boolean, wrapper: :with_label
-
-  .actions
-    = f.button :button, t('generic.save_changes'), type: :submit
index db7d806bc05445eed383840606b674be059d0b2a..539a700561e61db31358e18ce03a7223f3e51553 100644 (file)
@@ -1,7 +1,10 @@
 - content_for :page_title do
   = t('settings.preferences')
 
-= simple_form_for current_user, url: settings_preferences_other_path, html: { method: :put } do |f|
+- content_for :heading_actions do
+  = button_tag t('generic.save_changes'), class: 'button', form: 'edit_preferences'
+
+= simple_form_for current_user, url: settings_preferences_other_path, html: { method: :put, id: 'edit_preferences' } do |f|
   = render 'shared/error_messages', object: current_user
 
   .fields-group
index 6929f54f30dbdff6f30c5e277b8b0464790194d2..c55ab7b9083d3f9fb128f8273fbe447aacbda02b 100644 (file)
@@ -1,7 +1,10 @@
 - content_for :page_title do
   = t('settings.edit_profile')
 
-= simple_form_for @account, url: settings_profile_path, html: { method: :put } do |f|
+- content_for :heading_actions do
+  = button_tag t('generic.save_changes'), class: 'button', form: 'edit_profile'
+
+= simple_form_for @account, url: settings_profile_path, html: { method: :put, id: 'edit_profile' } do |f|
   = render 'shared/error_messages', object: @account
 
   .fields-row
index 3202167cab51eaa44cd5d5d30d57dfb953af7af3..b6de3e9d155b610502b3cf4b697d1b02ab4e79cb 100644 (file)
@@ -39,7 +39,7 @@ feature 'Profile' do
     visit settings_profile_path
     fill_in 'Display name', with: 'Bob'
     fill_in 'Bio', with: 'Bob is silent'
-    click_on 'Save changes'
+    first('.btn[type=submit]').click
     is_expected.to have_content 'Changes successfully saved!'
 
     # View my own public profile and see the changes