Fix haml-lint `InstanceVariables` rule for invites/_form (#26064)
parent
1da3c588ca
commit
e6b903b21e
|
@ -1,13 +1,13 @@
|
|||
# This configuration was generated by
|
||||
# `haml-lint --auto-gen-config`
|
||||
# on 2023-07-20 09:47:50 -0400 using Haml-Lint version 0.48.0.
|
||||
# on 2023-08-28 13:08:37 -0400 using Haml-Lint version 0.50.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the lints are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of Haml-Lint, may require this file to be generated again.
|
||||
|
||||
linters:
|
||||
# Offense count: 951
|
||||
# Offense count: 945
|
||||
LineLength:
|
||||
enabled: false
|
||||
|
||||
|
@ -26,7 +26,7 @@ linters:
|
|||
- 'app/views/admin/reports/show.html.haml'
|
||||
- 'app/views/disputes/strikes/show.html.haml'
|
||||
|
||||
# Offense count: 32
|
||||
# Offense count: 28
|
||||
InstanceVariables:
|
||||
exclude:
|
||||
- 'app/views/admin/reports/_actions.html.haml'
|
||||
|
@ -34,14 +34,11 @@ linters:
|
|||
- 'app/views/admin/webhooks/_form.html.haml'
|
||||
- 'app/views/auth/registrations/_status.html.haml'
|
||||
- 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml'
|
||||
- 'app/views/authorize_interactions/_post_follow_actions.html.haml'
|
||||
- 'app/views/invites/_form.html.haml'
|
||||
- 'app/views/relationships/_account.html.haml'
|
||||
- 'app/views/shared/_og.html.haml'
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 2
|
||||
IdNames:
|
||||
exclude:
|
||||
- 'app/views/authorize_interactions/error.html.haml'
|
||||
- 'app/views/oauth/authorizations/error.html.haml'
|
||||
- 'app/views/shared/_error_messages.html.haml'
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module InvitesHelper
|
||||
def invites_max_uses_options
|
||||
[1, 5, 10, 25, 50, 100]
|
||||
end
|
||||
|
||||
def invites_expires_options
|
||||
[30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week]
|
||||
end
|
||||
end
|
|
@ -14,7 +14,8 @@
|
|||
- if policy(:invite).create?
|
||||
%p= t('invites.prompt')
|
||||
|
||||
= render 'invites/form'
|
||||
= simple_form_for(@invite, url: admin_invites_path) do |form|
|
||||
= render partial: 'invites/form', object: form
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
= simple_form_for(@invite, url: controller.is_a?(Admin::InvitesController) ? admin_invites_path : invites_path) do |f|
|
||||
= render 'shared/error_messages', object: @invite
|
||||
= render 'shared/error_messages', object: form.object
|
||||
|
||||
.fields-row
|
||||
.fields-row
|
||||
.fields-row__column.fields-row__column-6.fields-group
|
||||
= f.input :max_uses, wrapper: :with_label, collection: [1, 5, 10, 25, 50, 100], label_method: ->(num) { I18n.t('invites.max_uses', count: num) }, prompt: I18n.t('invites.max_uses_prompt')
|
||||
= form.input :max_uses, wrapper: :with_label, collection: invites_max_uses_options, label_method: ->(num) { I18n.t('invites.max_uses', count: num) }, prompt: I18n.t('invites.max_uses_prompt')
|
||||
.fields-row__column.fields-row__column-6.fields-group
|
||||
= f.input :expires_in, wrapper: :with_label, collection: [30.minutes, 1.hour, 6.hours, 12.hours, 1.day, 1.week].map(&:to_i), label_method: ->(i) { I18n.t("invites.expires_in.#{i}") }, prompt: I18n.t('invites.expires_in_prompt')
|
||||
= form.input :expires_in, wrapper: :with_label, collection: invites_expires_options.map(&:to_i), label_method: ->(i) { I18n.t("invites.expires_in.#{i}") }, prompt: I18n.t('invites.expires_in_prompt')
|
||||
|
||||
.fields-group
|
||||
= f.input :autofollow, wrapper: :with_label
|
||||
.fields-group
|
||||
= form.input :autofollow, wrapper: :with_label
|
||||
|
||||
.actions
|
||||
= f.button :button, t('invites.generate'), type: :submit
|
||||
.actions
|
||||
= form.button :button, t('invites.generate'), type: :submit
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
- if policy(:invite).create?
|
||||
%p= t('invites.prompt')
|
||||
|
||||
= render 'form'
|
||||
= simple_form_for(@invite, url: invites_path) do |form|
|
||||
= render partial: 'form', object: form
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
|
|
Loading…
Reference in New Issue