Fix LineLength haml-lint in app/views/auth area (#28664)

This commit is contained in:
Matt Jankowski 2024-01-09 11:03:16 -05:00 committed by GitHub
parent 09ab073f0c
commit eed4eef39a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 130 additions and 28 deletions

View file

@ -1,16 +1,14 @@
# This configuration was generated by # This configuration was generated by
# `haml-lint --auto-gen-config` # `haml-lint --auto-gen-config`
# on 2024-01-09 10:00:31 -0500 using Haml-Lint version 0.53.0. # on 2024-01-09 10:48:44 -0500 using Haml-Lint version 0.53.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base. # one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again. # versions of Haml-Lint, may require this file to be generated again.
linters: linters:
# Offense count: 5 # Offense count: 3
LineLength: LineLength:
exclude: exclude:
- 'app/views/admin/roles/_form.html.haml' - 'app/views/admin/roles/_form.html.haml'
- 'app/views/auth/registrations/edit.html.haml'
- 'app/views/auth/registrations/new.html.haml'
- 'app/views/media/player.html.haml' - 'app/views/media/player.html.haml'

View file

@ -5,7 +5,11 @@
= f.input :return_to, as: :hidden = f.input :return_to, as: :hidden
.field-group .field-group
= f.input :current_password, wrapper: :with_block_label, input_html: { autocomplete: 'current-password', autofocus: true }, label: t('challenge.prompt'), required: true = f.input :current_password,
input_html: { autocomplete: 'current-password', autofocus: true },
label: t('challenge.prompt'),
required: true,
wrapper: :with_block_label
.actions .actions
= f.button :button, t('challenge.confirm'), type: :submit = f.button :button, t('challenge.confirm'), type: :submit

View file

@ -21,7 +21,13 @@
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource
.fields-group .fields-group
= f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, readonly: current_user.present?, hint: current_user.present? && t('auth.confirmations.wrong_email_hint') = f.input :email,
autofocus: true,
hint: current_user.present? && t('auth.confirmations.wrong_email_hint'),
input_html: { 'aria-label': t('simple_form.labels.defaults.email') },
label: t('simple_form.labels.defaults.email'),
readonly: current_user.present?,
wrapper: :with_label
.actions .actions
= f.button :button, t('auth.resend_confirmation'), type: :submit = f.button :button, t('auth.resend_confirmation'), type: :submit

View file

@ -8,9 +8,18 @@
= f.input :reset_password_token, as: :hidden = f.input :reset_password_token, as: :hidden
.fields-group .fields-group
= f.input :password, wrapper: :with_label, autofocus: true, label: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, required: true = f.input :password,
autofocus: true,
input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last },
label: t('simple_form.labels.defaults.new_password'),
required: true,
wrapper: :with_label
.fields-group .fields-group
= f.input :password_confirmation, wrapper: :with_label, label: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, required: true = f.input :password_confirmation,
input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' },
label: t('simple_form.labels.defaults.confirm_new_password'),
required: true,
wrapper: :with_label
.actions .actions
= f.button :button, t('auth.set_new_password'), type: :submit = f.button :button, t('auth.set_new_password'), type: :submit

View file

@ -5,7 +5,12 @@
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource
.fields-group .fields-group
= f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, hint: false = f.input :email,
autofocus: true,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email') },
label: t('simple_form.labels.defaults.email'),
wrapper: :with_label
.actions .actions
= f.button :button, t('auth.reset_password'), type: :submit = f.button :button, t('auth.reset_password'), type: :submit

View file

@ -5,7 +5,9 @@
= fa_icon 'warning' = fa_icon 'warning'
.log-entry__content .log-entry__content
.log-entry__title .log-entry__title
= t('disputes.strikes.title', action: t(account_warning.action, scope: 'disputes.strikes.title_actions'), date: l(account_warning.created_at.to_date)) = t 'disputes.strikes.title',
action: t(account_warning.action, scope: 'disputes.strikes.title_actions'),
date: l(account_warning.created_at.to_date)
.log-entry__timestamp .log-entry__timestamp
%time.formatted{ datetime: account_warning.created_at.iso8601 }= l(account_warning.created_at) %time.formatted{ datetime: account_warning.created_at.iso8601 }= l(account_warning.created_at)

View file

@ -3,7 +3,9 @@
%span{ title: session.user_agent }< %span{ title: session.user_agent }<
= fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session) = fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session)
&nbsp; &nbsp;
= t 'sessions.description', browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s) = t 'sessions.description',
browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s),
platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s)
%td %td
%samp= session.ip %samp= session.ip
%td %td

View file

@ -15,15 +15,33 @@
- if (!use_seamless_external_login? || resource.encrypted_password.present?) && !omniauth_only? - if (!use_seamless_external_login? || resource.encrypted_password.present?) && !omniauth_only?
.fields-row .fields-row
.fields-row__column.fields-group.fields-row__column-6 .fields-row__column.fields-group.fields-row__column-6
= f.input :email, wrapper: :with_label, input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, required: true, disabled: current_account.suspended? = f.input :email,
disabled: current_account.suspended?,
input_html: { 'aria-label': t('simple_form.labels.defaults.email') },
required: true,
wrapper: :with_label
.fields-row__column.fields-group.fields-row__column-6 .fields-row__column.fields-group.fields-row__column-6
= f.input :current_password, wrapper: :with_label, input_html: { 'aria-label': t('simple_form.labels.defaults.current_password'), autocomplete: 'current-password' }, required: true, disabled: current_account.suspended?, hint: false = f.input :current_password,
disabled: current_account.suspended?,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.current_password'), autocomplete: 'current-password' },
required: true,
wrapper: :with_label
.fields-row .fields-row
.fields-row__column.fields-group.fields-row__column-6 .fields-row__column.fields-group.fields-row__column-6
= f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, hint: t('simple_form.hints.defaults.password'), disabled: current_account.suspended? = f.input :password,
disabled: current_account.suspended?,
hint: t('simple_form.hints.defaults.password'),
input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last },
label: t('simple_form.labels.defaults.new_password'),
wrapper: :with_label
.fields-row__column.fields-group.fields-row__column-6 .fields-row__column.fields-group.fields-row__column-6
= f.input :password_confirmation, wrapper: :with_label, label: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, disabled: current_account.suspended? = f.input :password_confirmation,
disabled: current_account.suspended?,
input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' },
label: t('simple_form.labels.defaults.confirm_new_password'),
wrapper: :with_label
.actions .actions
= f.button :button, t('generic.save_changes'), type: :submit, class: 'button', disabled: current_account.suspended? = f.button :button, t('generic.save_changes'), type: :submit, class: 'button', disabled: current_account.suspended?

View file

@ -19,25 +19,61 @@
.fields-group .fields-group
= f.simple_fields_for :account do |ff| = f.simple_fields_for :account do |ff|
= ff.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.username'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 }, append: "@#{site_hostname}" = ff.input :username,
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'username' }, hint: false append: "@#{site_hostname}",
= f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, hint: false input_html: { 'aria-label': t('simple_form.labels.defaults.username'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 },
= f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_password'), autocomplete: 'new-password' }, hint: false label: false,
= f.input :confirm_password, as: :string, placeholder: t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), required: false, input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), autocomplete: 'off' }, hint: false required: true,
= f.input :website, as: :url, wrapper: :with_label, label: t('simple_form.labels.defaults.honeypot', label: 'Website'), required: false, input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: 'Website'), autocomplete: 'off' } wrapper: :with_label
= f.input :email,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'username' },
placeholder: t('simple_form.labels.defaults.email'),
required: true
= f.input :password,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last },
placeholder: t('simple_form.labels.defaults.password'),
required: true
= f.input :password_confirmation,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_password'), autocomplete: 'new-password' },
placeholder: t('simple_form.labels.defaults.confirm_password'),
required: true
= f.input :confirm_password,
as: :string,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), autocomplete: 'off' },
placeholder: t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')),
required: false
= f.input :website,
as: :url,
input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: 'Website'), autocomplete: 'off' },
label: t('simple_form.labels.defaults.honeypot', label: 'Website'),
required: false,
wrapper: :with_label
- if approved_registrations? && @invite.blank? - if approved_registrations? && @invite.blank?
%p.lead= t('auth.sign_up.manual_review', domain: site_hostname) %p.lead= t('auth.sign_up.manual_review', domain: site_hostname)
.fields-group .fields-group
= f.simple_fields_for :invite_request, resource.invite_request || resource.build_invite_request do |invite_request_fields| = f.simple_fields_for :invite_request, resource.invite_request || resource.build_invite_request do |invite_request_fields|
= invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: Setting.require_invite_text, label: false, hint: false = invite_request_fields.input :text,
as: :text,
hint: false,
label: false,
required: Setting.require_invite_text,
wrapper: :with_block_label
= hidden_field_tag :accept, params[:accept] = hidden_field_tag :accept, params[:accept]
= f.input :invite_code, as: :hidden = f.input :invite_code, as: :hidden
.fields-group .fields-group
= f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.privacy_policy_agreement_html', rules_path: about_more_path, privacy_policy_path: privacy_policy_path), required: true = f.input :agreement,
as: :boolean,
label: t('auth.privacy_policy_agreement_html', rules_path: about_more_path, privacy_policy_path: privacy_policy_path),
required: true,
wrapper: :with_label
.actions .actions
= f.button :button, @invite.present? ? t('auth.register') : sign_up_message, type: :submit = f.button :button, @invite.present? ? t('auth.register') : sign_up_message, type: :submit

View file

@ -10,11 +10,25 @@
%p.lead= t('auth.sign_in.preamble_html', domain: site_hostname) %p.lead= t('auth.sign_in.preamble_html', domain: site_hostname)
.fields-group .fields-group
- if use_seamless_external_login? - if use_seamless_external_login?
= f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label': t('simple_form.labels.defaults.username_or_email') }, hint: false = f.input :email,
autofocus: true,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.username_or_email') },
label: t('simple_form.labels.defaults.username_or_email'),
wrapper: :with_label
- else - else
= f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, hint: false = f.input :email,
autofocus: true,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email') },
label: t('simple_form.labels.defaults.email'),
wrapper: :with_label
.fields-group .fields-group
= f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'current-password' }, hint: false = f.input :password,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'current-password' },
label: t('simple_form.labels.defaults.password'),
wrapper: :with_label
.actions .actions
= f.button :button, t('auth.login'), type: :submit = f.button :button, t('auth.login'), type: :submit

View file

@ -5,7 +5,12 @@
%p.hint.authentication-hint= t('simple_form.hints.sessions.otp') %p.hint.authentication-hint= t('simple_form.hints.sessions.otp')
.fields-group .fields-group
= f.input :otp_attempt, type: :number, wrapper: :with_label, label: t('simple_form.labels.defaults.otp_attempt'), input_html: { 'aria-label': t('simple_form.labels.defaults.otp_attempt'), autocomplete: 'one-time-code' }, autofocus: true = f.input :otp_attempt,
autofocus: true,
input_html: { 'aria-label': t('simple_form.labels.defaults.otp_attempt'), autocomplete: 'one-time-code' },
label: t('simple_form.labels.defaults.otp_attempt'),
type: :number,
wrapper: :with_label
.actions .actions
= f.button :button, t('auth.login'), type: :submit = f.button :button, t('auth.login'), type: :submit

View file

@ -16,7 +16,10 @@
%p.lead= t('auth.setup.email_below_hint_html') %p.lead= t('auth.setup.email_below_hint_html')
.fields-group .fields-group
= f.input :email, required: true, hint: false, input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off' } = f.input :email,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off' },
required: true
.actions .actions
= f.button :button, t('auth.resend_confirmation'), type: :submit, class: 'button timer-button', disabled: true = f.button :button, t('auth.resend_confirmation'), type: :submit, class: 'button timer-button', disabled: true