mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-10 01:25:15 +00:00
Fix haml-lint InstanceVariables
rule for admin/roles/_form (#26063)
This commit is contained in:
parent
f9eefb2785
commit
89a17878ef
|
@ -1,13 +1,13 @@
|
|||
# This configuration was generated by
|
||||
# `haml-lint --auto-gen-config`
|
||||
# on 2023-09-28 10:03:39 -0400 using Haml-Lint version 0.50.0.
|
||||
# on 2023-09-28 10:26:23 -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: 946
|
||||
# Offense count: 944
|
||||
LineLength:
|
||||
enabled: false
|
||||
|
||||
|
@ -26,11 +26,10 @@ linters:
|
|||
- 'app/views/admin/reports/show.html.haml'
|
||||
- 'app/views/disputes/strikes/show.html.haml'
|
||||
|
||||
# Offense count: 25
|
||||
# Offense count: 18
|
||||
InstanceVariables:
|
||||
exclude:
|
||||
- 'app/views/admin/reports/_actions.html.haml'
|
||||
- 'app/views/admin/roles/_form.html.haml'
|
||||
- 'app/views/auth/registrations/_status.html.haml'
|
||||
- 'app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml'
|
||||
- 'app/views/relationships/_account.html.haml'
|
||||
|
|
|
@ -1,40 +1,36 @@
|
|||
= simple_form_for @role, url: @role.new_record? ? admin_roles_path : admin_role_path(@role) do |f|
|
||||
= render 'shared/error_messages', object: @role
|
||||
= render 'shared/error_messages', object: form.object
|
||||
|
||||
- if @role.everyone?
|
||||
- if form.object.everyone?
|
||||
.flash-message.info
|
||||
= t('admin.roles.everyone_full_description_html')
|
||||
- else
|
||||
- else
|
||||
.fields-group
|
||||
= f.input :name, wrapper: :with_label
|
||||
= form.input :name, wrapper: :with_label
|
||||
|
||||
- unless current_user.role.id == @role.id
|
||||
- unless current_user.role == form.object
|
||||
.fields-group
|
||||
= f.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
|
||||
= form.input :position, wrapper: :with_label, input_html: { max: current_user.role.position - 1 }
|
||||
|
||||
.fields-group
|
||||
= f.input :color, wrapper: :with_label, input_html: { placeholder: '#000000', type: 'color' }
|
||||
= form.input :color, wrapper: :with_label, input_html: { placeholder: '#000000', type: 'color' }
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
.fields-group
|
||||
= f.input :highlighted, wrapper: :with_label
|
||||
= form.input :highlighted, wrapper: :with_label
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
- unless current_user.role.id == @role.id
|
||||
- unless current_user.role == form.object
|
||||
|
||||
.field-group
|
||||
.input.with_block_label
|
||||
%label= t('simple_form.labels.user_role.permissions_as_keys')
|
||||
%span.hint= t('simple_form.hints.user_role.permissions_as_keys')
|
||||
|
||||
- (@role.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
|
||||
- (form.object.everyone? ? UserRole::Flags::CATEGORIES.slice(:invites) : UserRole::Flags::CATEGORIES).each do |category, permissions|
|
||||
%h4= t(category, scope: 'admin.roles.categories')
|
||||
|
||||
= f.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: ->(privilege) { safe_join([t("admin.roles.privileges.#{privilege}"), content_tag(:span, t("admin.roles.privileges.#{privilege}_description"), class: 'hint')]) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label: false, hint: false, disabled: permissions.filter { |privilege| UserRole::FLAGS[privilege] & current_user.role.computed_permissions == 0 }
|
||||
= form.input :permissions_as_keys, collection: permissions, wrapper: :with_block_label, include_blank: false, label_method: ->(privilege) { safe_join([t("admin.roles.privileges.#{privilege}"), content_tag(:span, t("admin.roles.privileges.#{privilege}_description"), class: 'hint')]) }, required: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', label: false, hint: false, disabled: permissions.filter { |privilege| UserRole::FLAGS[privilege] & current_user.role.computed_permissions == 0 }
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
.actions
|
||||
= f.button :button, @role.new_record? ? t('admin.roles.add_new') : t('generic.save_changes'), type: :submit
|
||||
|
|
|
@ -4,4 +4,7 @@
|
|||
- content_for :heading_actions do
|
||||
= link_to t('admin.roles.delete'), admin_role_path(@role), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive' if can?(:destroy, @role)
|
||||
|
||||
= render partial: 'form'
|
||||
= simple_form_for @role, url: admin_role_path(@role) do |form|
|
||||
= render partial: 'form', object: form
|
||||
.actions
|
||||
= form.button :button, t('generic.save_changes'), type: :submit
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
- content_for :page_title do
|
||||
= t('admin.roles.add_new')
|
||||
|
||||
= render partial: 'form'
|
||||
= simple_form_for @role, url: admin_roles_path do |form|
|
||||
= render partial: 'form', object: form
|
||||
.actions
|
||||
= form.button :button, t('admin.roles.add_new'), type: :submit
|
||||
|
|
Loading…
Reference in a new issue