From 056b5ed72f6d980bceeb49eb249b8365fe8fce66 Mon Sep 17 00:00:00 2001 From: Eugen Rochko <eugen@zeonfederated.com> Date: Wed, 12 Jul 2017 03:24:04 +0200 Subject: [PATCH] Improve UI of admin site settings (#4163) --- app/controllers/admin/settings_controller.rb | 6 +- app/javascript/styles/forms.scss | 87 +++++++++++++----- app/models/form/admin_settings.rb | 29 ++++++ app/views/admin/settings/edit.html.haml | 88 ++++++------------- config/initializers/simple_form.rb | 4 +- config/locales/ca.yml | 2 - config/locales/de.yml | 2 - config/locales/en.yml | 40 ++++----- config/locales/fa.yml | 2 - config/locales/fr.yml | 2 - config/locales/he.yml | 2 - config/locales/id.yml | 2 - config/locales/io.yml | 2 - config/locales/ja.yml | 2 - config/locales/ko.yml | 2 - config/locales/nl.yml | 2 - config/locales/no.yml | 2 - config/locales/oc.yml | 2 - config/locales/pl.yml | 8 +- config/locales/pt-BR.yml | 2 - config/locales/pt.yml | 2 - config/locales/ru.yml | 2 - config/locales/th.yml | 2 - config/locales/tr.yml | 2 - config/locales/uk.yml | 2 - config/locales/zh-CN.yml | 2 - config/locales/zh-HK.yml | 2 - config/locales/zh-TW.yml | 2 - .../admin/settings_controller_spec.rb | 8 +- 29 files changed, 151 insertions(+), 161 deletions(-) create mode 100644 app/models/form/admin_settings.rb diff --git a/app/controllers/admin/settings_controller.rb b/app/controllers/admin/settings_controller.rb index 29b590d7a3..5985d62829 100644 --- a/app/controllers/admin/settings_controller.rb +++ b/app/controllers/admin/settings_controller.rb @@ -22,7 +22,7 @@ module Admin ).freeze def edit - @settings = Setting.all_as_records + @admin_settings = Form::AdminSettings.new end def update @@ -38,12 +38,12 @@ module Admin private def settings_params - params.permit(ADMIN_SETTINGS) + params.require(:form_admin_settings).permit(ADMIN_SETTINGS) end def value_for_update(key, value) if BOOLEAN_SETTINGS.include?(key) - value == 'true' + value == '1' else value end diff --git a/app/javascript/styles/forms.scss b/app/javascript/styles/forms.scss index e723b50ff3..e1de36d554 100644 --- a/app/javascript/styles/forms.scss +++ b/app/javascript/styles/forms.scss @@ -57,10 +57,7 @@ code { } } - .input.file, - .input.select, - .input.radio_buttons, - .input.check_boxes { + .input.with_label { padding: 15px 0; margin-bottom: 0; @@ -71,6 +68,44 @@ code { display: block; padding-top: 5px; } + + &.boolean { + padding: initial; + margin-bottom: initial; + + .label_input > label { + font-family: inherit; + font-size: 14px; + color: $primary-text-color; + display: block; + width: auto; + } + + label.checkbox { + position: relative; + padding-left: 25px; + flex: 1 1 auto; + } + } + } + + .input.with_block_label { + & > label { + font-family: inherit; + font-size: 16px; + color: $primary-text-color; + display: block; + padding-top: 5px; + } + + .hint { + margin-bottom: 15px; + } + + li { + float: left; + width: 50%; + } } .fields-group { @@ -106,7 +141,7 @@ code { input[type=checkbox] { position: absolute; left: 0; - top: 1px; + top: 5px; margin: 0; } @@ -116,6 +151,29 @@ code { } } + .check_boxes { + .checkbox { + label { + font-family: inherit; + font-size: 14px; + color: $primary-text-color; + display: block; + width: auto; + position: relative; + padding-top: 5px; + padding-left: 25px; + flex: 1 1 auto; + } + + input[type=checkbox] { + position: absolute; + left: 0; + top: 5px; + margin: 0; + } + } + } + input[type=text], input[type=number], input[type=email], @@ -390,25 +448,6 @@ code { } } -.user_filtered_languages { - & > label { - font-family: inherit; - font-size: 16px; - color: $primary-text-color; - display: block; - padding-top: 5px; - } - - .hint { - margin-bottom: 15px; - } - - li { - float: left; - width: 50%; - } -} - .post-follow-actions { text-align: center; color: $ui-primary-color; diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb new file mode 100644 index 0000000000..c3a04ba652 --- /dev/null +++ b/app/models/form/admin_settings.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class Form::AdminSettings + include ActiveModel::Model + + delegate( + :site_contact_username, + :site_contact_username=, + :site_contact_email, + :site_contact_email=, + :site_title, + :site_title=, + :site_description, + :site_description=, + :site_extended_description, + :site_extended_description=, + :site_terms, + :site_terms=, + :open_registrations, + :open_registrations=, + :closed_registrations_message, + :closed_registrations_message=, + :open_deletion, + :open_deletion=, + :timeline_preview, + :timeline_preview=, + to: Setting + ) +end diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml index 59192530b7..9f8a6640b2 100644 --- a/app/views/admin/settings/edit.html.haml +++ b/app/views/admin/settings/edit.html.haml @@ -1,64 +1,32 @@ - content_for :page_title do = t('admin.settings.title') -= form_tag(admin_settings_path, method: :put, class: 'simple_form', style: 'max-width: 100%') do - %table.table - %thead - %tr - %th{ width: '40%' } - = t('admin.settings.setting') - %th - %tbody - %tr - %td - %strong= t('admin.settings.contact_information.label') - %td= text_field_tag :site_contact_username, @settings['site_contact_username'].value, place_holder: t('admin.settings.contact_information.username') - %tr - %td - %strong= t('admin.accounts.email') - %td= text_field_tag :site_contact_email, @settings['site_contact_email'].value, place_holder: t('admin.settings.contact_information.email') - %tr - %td - %strong= t('admin.settings.site_title') - %td= text_field_tag :site_title, @settings['site_title'].value - %tr - %td - %strong= t('admin.settings.site_description.title') - %p= t('admin.settings.site_description.desc_html') - %td= text_area_tag :site_description, @settings['site_description'].value, rows: 8 - %tr - %td - %strong= t('admin.settings.site_description_extended.title') - %p= t('admin.settings.site_description_extended.desc_html') - %td= text_area_tag :site_extended_description, @settings['site_extended_description'].value, rows: 8 - %tr - %td - %strong= t('admin.settings.site_terms.title') - %p= t('admin.settings.site_terms.desc_html') - %td= text_area_tag :site_terms, @settings['site_terms'].value, rows: 8 - %tr - %td - %strong= t('admin.settings.registrations.open.title') - %p= t('admin.settings.registrations.open.desc_html') - %td - = select_tag :open_registrations, options_for_select({ t('simple_form.no') => false, t('simple_form.yes') => true }, @settings['open_registrations'].value) - %tr - %td - %strong= t('admin.settings.registrations.closed_message.title') - %p= t('admin.settings.registrations.closed_message.desc_html') - %td= text_area_tag :closed_registrations_message, @settings['closed_registrations_message'].value, rows: 8 - %tr - %td - %strong= t('admin.settings.registrations.deletion.title') - %p= t('admin.settings.registrations.deletion.desc_html') - %td - = select_tag :open_deletion, options_for_select({ t('simple_form.no') => false, t('simple_form.yes') => true }, @settings['open_deletion'].value) - %tr - %td - %strong= t('admin.settings.timeline_preview.title') - %p= t('admin.settings.timeline_preview.desc_html') - %td - = select_tag :timeline_preview, options_for_select({ t('simple_form.no') => false, t('simple_form.yes') => true }, @settings['timeline_preview'].value) += simple_form_for @admin_settings, url: admin_settings_path, html: { method: :patch } do |f| + .fields-group + = f.input :site_title, placeholder: t('admin.settings.site_title') + = f.input :site_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_description.title'), hint: t('admin.settings.site_description.desc_html'), input_html: { rows: 8 } + = f.input :site_contact_username, placeholder: t('admin.settings.contact_information.username') + = f.input :site_contact_email, placeholder: t('admin.settings.contact_information.email') - .simple_form.actions - = button_tag t('generic.save_changes'), type: :submit, class: :btn + %hr/ + + .fields-group + = f.input :timeline_preview, as: :boolean, wrapper: :with_label, label: t('admin.settings.timeline_preview.title'), hint: t('admin.settings.timeline_preview.desc_html') + + .fields-group + = f.input :open_registrations, as: :boolean, wrapper: :with_label, label: t('admin.settings.registrations.open.title'), hint: t('admin.settings.registrations.open.desc_html') + + .fields-group + = f.input :open_deletion, as: :boolean, wrapper: :with_label, label: t('admin.settings.registrations.deletion.title'), hint: t('admin.settings.registrations.deletion.desc_html') + + .fields-group + = f.input :closed_registrations_message, as: :text, wrapper: :with_block_label, label: t('admin.settings.registrations.closed_message.title'), hint: t('admin.settings.registrations.closed_message.desc_html'), input_html: { rows: 8 } + + %hr/ + + .fields-group + = f.input :site_extended_description, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_description_extended.title'), hint: t('admin.settings.site_description_extended.desc_html'), input_html: { rows: 8 } + = f.input :site_terms, wrapper: :with_block_label, as: :text, label: t('admin.settings.site_terms.title'), hint: t('admin.settings.site_terms.desc_html'), input_html: { rows: 8 } + + .actions + = f.button :button, t('generic.save_changes'), type: :submit diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index ca7531748e..5983918cd4 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -50,14 +50,14 @@ SimpleForm.setup do |config| # b.use :full_error, wrap_with: { tag: :span, class: :error } end - config.wrappers :with_label, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b| + config.wrappers :with_label, class: [:input, :with_label], hint_class: :field_with_hint, error_class: :field_with_errors do |b| b.use :html5 b.use :label_input, wrap_with: { tag: :div, class: :label_input } b.use :hint, wrap_with: { tag: :span, class: :hint } b.use :error, wrap_with: { tag: :span, class: :error } end - config.wrappers :with_block_label, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b| + config.wrappers :with_block_label, class: [:input, :with_block_label], hint_class: :field_with_hint, error_class: :field_with_errors do |b| b.use :html5 b.use :label b.use :hint, wrap_with: { tag: :span, class: :hint } diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 10c34498bf..f63aee3e68 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -155,7 +155,6 @@ ca: settings: contact_information: email: Introduir una adreça de correu electrònic pùblica - label: Informació de contacte username: Introduir un nom d'usuari registrations: closed_message: @@ -163,7 +162,6 @@ ca: title: Missatge de registre tancat open: title: Registre obert - setting: Ajust site_description: desc_html: Es mostra com un parà graf a la pà gina principal i s'utilitza com una etiqueta meta.<br>Pots utilitzar etiquetes HTML, en particular <code><a></code> i <code><em></code>. title: Descripció del lloc diff --git a/config/locales/de.yml b/config/locales/de.yml index 2bdb87708e..b084aca315 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -129,7 +129,6 @@ de: settings: contact_information: email: Eine öffentliche E-Mail-Adresse angeben - label: Kontaktinformationen username: Einen Benutzernamen angeben registrations: closed_message: @@ -137,7 +136,6 @@ de: title: Nachricht über geschlossene Registrierung open: title: Offene Registrierung - setting: Einstellung site_description: desc_html: Wird als Absatz auf der Frontseite angezeigt und als Meta-Tag benutzt.<br>Du kannst HTML-Tags benutzen, insbesondere <code><a></code> und <code><em></code>. title: Seitenbeschreibung diff --git a/config/locales/en.yml b/config/locales/en.yml index e33dde0389..c9b5d9ab8f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -168,33 +168,31 @@ en: view: View settings: contact_information: - email: Enter a public e-mail address - label: Contact information - username: Enter a username + email: Business e-mail + username: Contact username registrations: closed_message: - desc_html: Displayed on frontpage when registrations are closed<br>You can use HTML tags + desc_html: Displayed on frontpage when registrations are closed. You can use HTML tags title: Closed registration message + deletion: + desc_html: Allow anyone to delete their account + title: Open account deletion open: desc_html: Allow anyone to create an account title: Open registration - deletion: - desc_html: Allow anyone to delete their account - title: Open deletion - timeline_preview: - desc_html: Display public timeline on landing page - title: Timeline preview - setting: Setting site_description: - desc_html: Displayed as a paragraph on the frontpage and used as a meta tag.<br>You can use HTML tags, in particular <code><a></code> and <code><em></code>. - title: Site description + desc_html: Introductory paragraph on the frontpage and in meta tags. You can use HTML tags, in particular <code><a></code> and <code><em></code>. + title: Instance description site_description_extended: - desc_html: Displayed on extended information page<br>You can use HTML tags - title: Extended site description + desc_html: A good place for your code of conduct, rules, guidelines and other things that set your instance apart. You can use HTML tags + title: Custom extended information site_terms: - desc_html: Displayed on terms page<br>You can use HTML tags - title: Privacy policy - site_title: Site title + desc_html: You can write your own privacy policy, terms of service or other legalese. You can use HTML tags + title: Custom terms of service + site_title: Instance name + timeline_preview: + desc_html: Display public timeline on landing page + title: Timeline preview title: Site Settings subscriptions: callback_url: Callback URL @@ -230,12 +228,12 @@ en: authorize_follow: error: Unfortunately, there was an error looking up the remote account follow: Follow - following: 'Success! You are now following:' follow_request: 'You have sent a follow request to:' + following: 'Success! You are now following:' post_follow: - web: Go to web - return: Return to the user's profile close: Or, you can just close this window. + return: Return to the user's profile + web: Go to web prompt_html: 'You (<strong>%{self}</strong>) have requested to follow:' title: Follow %{acct} datetime: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 6f0bd0839e..ade76d6702 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -141,7 +141,6 @@ fa: settings: contact_information: email: یک نشانی ایمیل عمومی وارد کنید - label: اطلاعات تماس username: یک نام کاربری وارد کنید registrations: closed_message: @@ -149,7 +148,6 @@ fa: title: پیغام برای Ùعال‌نبودن ثبت نام open: title: امکان ثبت نام - setting: تنظیمات site_description: desc_html: روی صÙØÙ‡Ù” اصلی نمایش می‌یابد Ùˆ همچنین به عنوان تگ‌های HTML.<br>می‌توانید HTML بنویسید, به‌ویژه <code><a></code> Ùˆ <code><em></code>. title: دربارهٔ سایت diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9eeafaa6e9..c2efd0c851 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -155,7 +155,6 @@ fr: settings: contact_information: email: Entrez une adresse courriel publique - label: Informations de contact username: Entrez un nom d’utilisateurâ‹…ice registrations: closed_message: @@ -163,7 +162,6 @@ fr: title: Message de fermeture des inscriptions open: title: Inscriptions - setting: Paramètre site_description: desc_html: Affichée sous la forme d’un paragraphe sur la page d’accueil et utilisée comme balise meta.<br>Vous pouvez utiliser des balises HTML, en particulier <code><a></code> et <code><em></code>. title: Description du site diff --git a/config/locales/he.yml b/config/locales/he.yml index 760ddac003..21f8f1dc4c 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -149,7 +149,6 @@ he: settings: contact_information: email: × × ×œ×”×§×œ×™×“ כתובת דו×"ל פומבית - label: פרטי התקשרות username: × × ×œ×”×›× ×™×¡ ×©× ×ž×©×ª×ž×© registrations: closed_message: @@ -157,7 +156,6 @@ he: title: מסר סגירת הרשמות open: title: הרשמה פתוחה - setting: הגדרה site_description: desc_html: מוצג כפסקה על הדף הר×שי ומשמש כתגית מט×.<br>× ×™×ª×Ÿ להשתמש בתגיות HTML, ובמיוחד ב־<code><a></code> ו־<code><em></code>. title: תי×ור ×”×תר diff --git a/config/locales/id.yml b/config/locales/id.yml index 4bcd8f2ed7..e3fe963317 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -140,7 +140,6 @@ id: settings: contact_information: email: Masukkan alamat email - label: Informasi kontak username: Masukkan nama pengguna registrations: closed_message: @@ -148,7 +147,6 @@ id: title: Pesan penutupan pendaftaran open: title: Pendaftaran terbuka - setting: Pengaturan site_description: desc_html: Ditampilkan sebagai sebuah paragraf di halaman depan dan digunakan sebagai tag meta.<br>Anda bisa menggunakan tag HTML, khususnya <code><a></code> dan <code><em></code>. title: Deskripsi situs diff --git a/config/locales/io.yml b/config/locales/io.yml index 8eb48c3033..b587d4bc63 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -128,7 +128,6 @@ io: settings: contact_information: email: Enter a public e-mail address - label: Contact information username: Enter a username registrations: closed_message: @@ -136,7 +135,6 @@ io: title: Closed registration message open: title: Open registration - setting: Setting site_description: desc_html: Displayed as a paragraph on the frontpage and used as a meta tag.<br>You can use HTML tags, in particular <code><a></code> and <code><em></code>. title: Site description diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 5b91aa75d0..d57fe8da26 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -155,7 +155,6 @@ ja: settings: contact_information: email: 公開ã™ã‚‹ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’入力 - label: é€£çµ¡å…ˆæƒ…å ± username: ユーザーåを入力 registrations: closed_message: @@ -163,7 +162,6 @@ ja: title: æ–°è¦ç™»éŒ²åœæ¢æ™‚ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ open: title: æ–°è¦ç™»éŒ²ã‚’å—ã‘付ã‘ã‚‹ - setting: è¨å®š site_description: desc_html: トップページã¸ã®è¡¨ç¤ºã¨ meta ã‚¿ã‚°ã«ä½¿ç”¨ã•ã‚Œã¾ã™ã€‚<br>HTMLã‚¿ã‚°ã€ç‰¹ã«<code><a></code> 㨠<code><em></code>ãŒåˆ©ç”¨å¯èƒ½ã§ã™ã€‚ title: サイトã®èª¬æ˜Žæ–‡ diff --git a/config/locales/ko.yml b/config/locales/ko.yml index c8ad38d418..bafc199934 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -155,7 +155,6 @@ ko: settings: contact_information: email: ê³µê°œí• ë©”ì¼ ì£¼ì†Œë¥¼ ìž…ë ¥ - label: ì—°ë½ì²˜ ì •ë³´ username: ì•„ì´ë””를 ìž…ë ¥ registrations: closed_message: @@ -163,7 +162,6 @@ ko: title: ì‹ ê·œ ë“±ë¡ ì •ì§€ ì‹œ 메시지 open: title: ì‹ ê·œ 등ë¡ì„ ë°›ìŒ - setting: ì„¤ì • site_description: desc_html: 탑 페ì´ì§€ì™€ meta íƒœê·¸ì— ì‚¬ìš©ë©ë‹ˆë‹¤.<br>HTML 태그, 예를 들어<code><a></code> 태그와 <code><em></code> 태그를 ì‚¬ìš©í• ìˆ˜ 있습니다. title: 사ì´íŠ¸ 설명 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 633061b064..dfc58f6b35 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -55,7 +55,6 @@ nl: settings: contact_information: email: Vul een openbaar gebruikt e-mailadres in - label: Contactgegevens username: Vul een gebruikersnaam in registrations: closed_message: @@ -63,7 +62,6 @@ nl: title: Bericht wanneer registratie is uitgeschakeld open: title: Open registratie - setting: Instelling site_description: desc_html: Dit wordt als een alinea op de voorpagina getoond en gebruikt als meta-tag in de paginabron.<br>Je kan HTML gebruiken, zoals <code><a></code> en <code><em></code>. title: Omschrijving Mastodon-server diff --git a/config/locales/no.yml b/config/locales/no.yml index 05714959df..004e1ff803 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -142,7 +142,6 @@ settings: contact_information: email: Skriv en offentlig e-postadresse - label: Kontaktinformasjon username: Skriv brukernavn registrations: closed_message: @@ -150,7 +149,6 @@ title: Melding for lukket registrering open: title: Ã…pen registrering - setting: Innstilling site_description: desc_html: Vises som et avsnitt pÃ¥ forsiden og brukes som en meta-tagg.<br> Du kan bruke HTML-tagger, spesielt <code><a></code> og <code><em></code>. title: Nettstedsbeskrivelse diff --git a/config/locales/oc.yml b/config/locales/oc.yml index 30d5258a5d..91a6ca7910 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -149,7 +149,6 @@ oc: settings: contact_information: email: Picatz una adreça de corrièl - label: Informacions de contacte username: Picatz un nom d’utilizaire registrations: closed_message: @@ -157,7 +156,6 @@ oc: title: Messatge de barradura de las inscripcions open: title: Inscripcions - setting: Paramètre site_description: desc_html: Afichada jos la forma de paragrafe sus la pagina d’acuèlh e utilizada coma balisa meta.<br> Podètz utilizar de balisas HTML, coma <code><a></code> et <code><em></code>. title: Descripcion del site diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 018ff3c7bf..c6588e8464 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -155,7 +155,6 @@ pl: settings: contact_information: email: Wprowadź publiczny adres e-mail - label: Informacje kontaktowe username: Wprowadź nazwÄ™ użytkownika registrations: closed_message: @@ -163,7 +162,6 @@ pl: title: Wiadomość o nieaktywnej rejestracji open: title: Otwarta rejestracja - setting: Ustawienie site_description: desc_html: WyÅ›wietlany jako nagłówek na stronie głównej oraz jako meta tag.<br>Możesz korzystać z tagów HTML, w szczególnoÅ›ci z <code><a></code> i <code><em></code>. title: Opis strony @@ -208,12 +206,12 @@ pl: authorize_follow: error: Niestety, podczas sprawdzania zdalnego konta wystÄ…piÅ‚ bÅ‚Ä…d follow: Åšledź - following: 'PomyÅ›lnie! Od teraz Å›ledzisz:' follow_request: 'WysÅ‚ano proÅ›bÄ™ o pozwolenie na obserwacjÄ™:' + following: 'PomyÅ›lnie! Od teraz Å›ledzisz:' post_follow: - web: Przejdź do sieci - return: Powróć do strony użytkownika close: Ewentualnie, możesz po prostu zamknąć tÄ… stronÄ™. + return: Powróć do strony użytkownika + web: Przejdź do sieci prompt_html: 'Ty (<strong>%{self}</strong>) chcesz Å›ledzić:' title: Åšledź %{acct} datetime: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index fb5e03c8c7..355c20d05f 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -141,7 +141,6 @@ pt-BR: settings: contact_information: email: Entre um endereço de email público - label: Informação de contato username: Entre com usuário registrations: closed_message: @@ -149,7 +148,6 @@ pt-BR: title: Mensagem de registro fechados open: title: Aberto para registro - setting: Preferências site_description: desc_html: Mostrar como parágrafo e usado como meta tag.<br/>Vôce pode usar tags HTML, em particular <code><a></code> e <code><em></code>. title: Descrição do site diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 0f59185a76..40be8a6c56 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -136,7 +136,6 @@ pt: settings: contact_information: email: Inserir um endereço de email para tornar público - label: Informação de contacto username: Insira um nome de utilizador registrations: closed_message: @@ -144,7 +143,6 @@ pt: title: Mensagem de registos encerrados open: title: Aceitar novos registos - setting: Preferências site_description: desc_html: Mostrar como parágrafo na página inicial e usado como meta tag.<br/>Podes usar tags HTML, em particular <code><a></code> e <code><em></code>. title: Descrição do site diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 414d39dd21..5cfc2b1caf 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -123,7 +123,6 @@ ru: settings: contact_information: email: Введите публичный e-mail - label: ÐšÐ¾Ð½Ñ‚Ð°ÐºÑ‚Ð½Ð°Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ username: Введите Ð¸Ð¼Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ registrations: closed_message: @@ -131,7 +130,6 @@ ru: title: Сообщение о закрытой региÑтрации open: title: Открыть региÑтрацию - setting: ÐаÑтройка site_description: desc_html: ОтображаетÑÑ Ð² качеÑтве параграфа на титульной Ñтранице и иÑпользуетÑÑ Ð² качеÑтве мета-тега.<br>Можно иÑпользовать HTML-теги, в оÑобенноÑти <code><a></code> и <code><em></code>. title: ОпиÑание Ñайта diff --git a/config/locales/th.yml b/config/locales/th.yml index a71252afef..263babdd01 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -142,7 +142,6 @@ th: settings: contact_information: email: à¸à¸£à¸à¸à¸—ี่à¸à¸¢à¸¹à¹ˆà¸à¸µà¹€à¸¡à¸¥à¹Œà¸ªà¸²à¸˜à¸²à¸£à¸“ะ - label: ข้à¸à¸¡à¸¹à¸¥à¸—ี่ติดต่ภusername: à¸à¸£à¸à¸à¸Šà¸·à¹ˆà¸à¸œà¸¹à¹‰à¹ƒà¸Šà¹‰ registrations: closed_message: @@ -150,7 +149,6 @@ th: title: ปิดข้à¸à¸„วามลงทะเบียน open: title: เปิดรับลงทะเบียน - setting: ตั้งค่า site_description: desc_html: Displayed as a paragraph on the frontpage and used as a meta tag.<br> ใช้ HTML tags ได้, in particular <code><a></code> à¹à¸¥à¸° <code><em></code>. title: คำà¸à¸˜à¸´à¸šà¸²à¸¢à¹„ซต์ diff --git a/config/locales/tr.yml b/config/locales/tr.yml index a8927eaa85..e7864cc579 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -141,7 +141,6 @@ tr: settings: contact_information: email: Herkese açık e-posta adresiniz - label: Ä°letiÅŸim bilgisi username: Bir kullanıcı adı giriniz registrations: closed_message: @@ -149,7 +148,6 @@ tr: title: Kayıt alımları kapatılma mesajı open: title: Kayıt alımları - setting: Ayar adı site_description: desc_html: Ana sayfada paragraf olarak görüntülenecek bilgidir.<br>Özellikle <code><a></code> ve <code><em></code> olmak suretiyle HTML etiketlerini kullanabilirsiniz. title: Site açıklaması diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 65f1aabf52..129fc5bb79 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -123,7 +123,6 @@ uk: settings: contact_information: email: Введіть публічний email - label: Контактна Ñ–Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ñ–Ñ username: Введіть ім'Ñ ÐºÐ¾Ñ€Ð¸Ñтувача registrations: closed_message: @@ -131,7 +130,6 @@ uk: title: ÐŸÐ¾Ð²Ñ–Ð´Ð¾Ð¼Ð»ÐµÐ½Ð½Ñ Ð¿Ñ€Ð¾ закриту реєÑтрацію open: title: Відкрити реєÑтрацію - setting: ÐÐ°Ð»Ð°ÑˆÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ site_description: desc_html: ВідображаєтьÑÑ Ñƒ ÑкоÑÑ‚Ñ– параграфа на титульній Ñторінці та викориÑтовуєтьÑÑ Ñƒ ÑкоÑÑ‚Ñ– мета-тега.<br>Можна викориÑтовувати HTML-теги, оÑобливо <code><a></code> Ñ– <code><em></code>. title: ÐžÐ¿Ð¸Ñ Ñайту diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index d5d1b672c4..650d4bd159 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -148,7 +148,6 @@ zh-CN: settings: contact_information: email: è¾“å…¥ä¸€ä¸ªå…¬å¼€çš„ç”µé‚®åœ°å€ - label: è”ç³»æ•°æ® username: 输入用户å称 registrations: closed_message: @@ -156,7 +155,6 @@ zh-CN: title: æš‚åœæ³¨å†Œæ¶ˆæ¯ open: title: 开放注册 - setting: 设置 site_description: desc_html: 在首页显示,åŠåœ¨ meta æ ‡ç¾ä¸ç”¨ä½œç½‘站介ç»ã€‚<br>ä½ å¯ä»¥åœ¨æ¤ä½¿ç”¨ HTML æ ‡ç¾ï¼Œå°¤å…¶æ˜¯<code><a></code> å’Œ <code><em></code>。 title: æœ¬ç«™ä»‹ç» diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index aa9f27912c..d2db78be16 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -141,7 +141,6 @@ zh-HK: settings: contact_information: email: è¼¸å…¥ä¸€å€‹å…¬é–‹çš„é›»éƒµåœ°å€ - label: è¯çµ¡è³‡æ–™ username: 輸入用戶å稱 registrations: closed_message: @@ -149,7 +148,6 @@ zh-HK: title: æš«åœè¨»å†Šè¨Šæ¯ open: title: 開放註冊 - setting: è¨å®š site_description: desc_html: 在首é 顯示,åŠåœ¨ meta 標籤使用作網站介紹。<br/> ä½ å¯ä»¥åœ¨æ¤ä½¿ç”¨ <code><a></code> å’Œ <code><em></code> ç‰ HTML 標籤。 title: 本站介紹 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 58caf78481..67aa2830fa 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -102,7 +102,6 @@ zh-TW: settings: contact_information: email: 請輸入輸入一個公開電åä¿¡ç®± - label: è¯çµ¡è³‡è¨Š username: 請輸入使用者å稱 registrations: closed_message: @@ -110,7 +109,6 @@ zh-TW: title: é—œé–‰è¨»å†Šè¨Šæ¯ open: title: 開放註冊 - setting: è¨å®š site_description: desc_html: 顯示在首é 並且作為 meta 標籤的çŸæ–‡ã€‚<br>å¯ä½¿ç”¨ HTML 標籤,包括 <code><a></code> åŠ <code><em></code>。 title: 網站æè¿° diff --git a/spec/controllers/admin/settings_controller_spec.rb b/spec/controllers/admin/settings_controller_spec.rb index d9dde3c92a..609bc762b8 100644 --- a/spec/controllers/admin/settings_controller_spec.rb +++ b/spec/controllers/admin/settings_controller_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Admin::SettingsController, type: :controller do it 'cannot create a setting value for a non-admin key' do expect(Setting.new_setting_key).to be_blank - patch :update, params: { new_setting_key: 'New key value' } + patch :update, params: { form_admin_settings: { new_setting_key: 'New key value' } } expect(response).to redirect_to(edit_admin_settings_path) expect(Setting.new_setting_key).to be_nil @@ -40,7 +40,7 @@ RSpec.describe Admin::SettingsController, type: :controller do it 'creates a settings value that didnt exist before for eligible key' do expect(Setting.site_extended_description).to be_blank - patch :update, params: { site_extended_description: 'New key value' } + patch :update, params: { form_admin_settings: { site_extended_description: 'New key value' } } expect(response).to redirect_to(edit_admin_settings_path) expect(Setting.site_extended_description).to eq 'New key value' @@ -56,7 +56,7 @@ RSpec.describe Admin::SettingsController, type: :controller do it 'updates a settings value' do Setting.site_title = 'Original' - patch :update, params: { site_title: 'New title' } + patch :update, params: { form_admin_settings: { site_title: 'New title' } } expect(response).to redirect_to(edit_admin_settings_path) expect(Setting.site_title).to eq 'New title' @@ -72,7 +72,7 @@ RSpec.describe Admin::SettingsController, type: :controller do it 'typecasts open_registrations to boolean' do Setting.open_registrations = false - patch :update, params: { open_registrations: 'true' } + patch :update, params: { form_admin_settings: { open_registrations: '1' } } expect(response).to redirect_to(edit_admin_settings_path) expect(Setting.open_registrations).to eq true -- GitLab