From f4d549d30081478b1fe2bde9d340262e132bb891 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 18 Sep 2018 16:45:58 +0200 Subject: Redesign forms, verify link ownership with rel="me" (#8703) * Verify link ownership with rel="me" * Add explanation about verification to UI * Perform link verifications * Add click-to-copy widget for verification HTML * Redesign edit profile page * Redesign forms * Improve responsive design of settings pages * Restore landing page sign-up form * Fix typo * Support tags, add spec * Fix links not being verified on first discovery and passive updates --- config/initializers/simple_form.rb | 29 ++++++++++++++++++++++++++++- config/locales/en.yml | 6 +++++- config/locales/simple_form.en.yml | 3 +++ 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'config') diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb index e413cdb44..386ede654 100644 --- a/config/initializers/simple_form.rb +++ b/config/initializers/simple_form.rb @@ -1,4 +1,15 @@ # Use this setup block to configure all options available in SimpleForm. + +module AppendComponent + def append(wrapper_options = nil) + @append ||= begin + options[:append].to_s.html_safe if options[:append].present? + end + end +end + +SimpleForm.include_component(AppendComponent) + SimpleForm.setup do |config| # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the @@ -52,6 +63,22 @@ SimpleForm.setup do |config| config.wrappers :with_label, class: [:input, :with_label], hint_class: :field_with_hint, error_class: :field_with_errors do |b| b.use :html5 + + b.wrapper tag: :div, class: :label_input do |ba| + ba.use :label + + ba.wrapper tag: :div, class: :label_input__wrapper do |bb| + bb.use :input + bb.optional :append, wrap_with: { tag: :div, class: 'label_input__append' } + end + end + + b.use :hint, wrap_with: { tag: :span, class: :hint } + b.use :error, wrap_with: { tag: :span, class: :error } + end + + config.wrappers :with_floating_label, class: [:input, :with_floating_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 } @@ -111,7 +138,7 @@ SimpleForm.setup do |config| # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. - # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } + config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil diff --git a/config/locales/en.yml b/config/locales/en.yml index 5cbb790dd..f883b17a1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -48,6 +48,7 @@ en: other: Followers following: Following joined: Joined %{date} + link_verified_on: Ownership of this link was checked on %{date} media: Media moved_html: "%{name} has moved to %{new_profile_link}:" network_hidden: This information is not available @@ -460,7 +461,7 @@ en: warning: Be very careful with this data. Never share it with anyone! your_token: Your access token auth: - agreement_html: By signing up you agree to follow the rules of the instance and our terms of service. + agreement_html: By clicking "Sign up" below you agree to follow the rules of the instance and our terms of service. change_password: Password confirm_email: Confirm email delete_account: Delete account @@ -921,3 +922,6 @@ en: otp_lost_help_html: If you lost access to both, you may get in touch with %{email} seamless_external_login: You are logged in via an external service, so password and e-mail settings are not available. signed_in_as: 'Signed in as:' + verification: + explanation_html: 'You can verify yourself as the owner of the links in your profile metadata. For that, the linked website must contain a link back to your Mastodon profile. The link back must have a rel="me" attribute. The text content of the link does not matter. Here is an example:' + verification: Verification diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 2e4cb1eff..c2e572997 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -11,6 +11,7 @@ en: display_name: one: 1 character left other: %{count} characters left + email: You will be sent a confirmation e-mail fields: You can have up to 4 items displayed as a table on your profile header: PNG, GIF or JPG. At most %{size}. Will be downscaled to %{dimensions}px inbox_url: Copy the URL from the frontpage of the relay you want to use @@ -20,12 +21,14 @@ en: note: one: 1 character left other: %{count} characters left + password: Use at least 8 characters phrase: Will be matched regardless of casing in text or content warning of a toot scopes: Which APIs the application will be allowed to access. If you select a top-level scope, you don't need to select individual ones. setting_default_language: The language of your toots can be detected automatically, but it's not always accurate setting_hide_network: Who you follow and who follows you will not be shown on your profile setting_noindex: Affects your public profile and status pages setting_theme: Affects how Mastodon looks when you're logged in from any device. + username: Your username will be unique on %{domain} whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word imports: data: CSV file exported from another Mastodon instance -- cgit