From 9d56c1949b1c2f9fefde88021ec82745b9aae495 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 28 Sep 2023 10:23:35 -0400 Subject: [PATCH] Fix haml-lint `InstanceVariables` rule for admin/webhooks/_form (#26062) --- .haml-lint_todo.yml | 9 ++++----- app/views/admin/webhooks/_form.html.haml | 18 +++++++----------- app/views/admin/webhooks/edit.html.haml | 5 ++++- app/views/admin/webhooks/new.html.haml | 5 ++++- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index e8791e05c..39e7b2990 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,13 +1,13 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2023-08-28 13:08:37 -0400 using Haml-Lint version 0.50.0. +# on 2023-09-28 10:03:39 -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: 945 + # Offense count: 946 LineLength: enabled: false @@ -15,7 +15,7 @@ linters: UnnecessaryStringOutput: enabled: false - # Offense count: 57 + # Offense count: 59 RuboCop: enabled: false @@ -26,12 +26,11 @@ linters: - 'app/views/admin/reports/show.html.haml' - 'app/views/disputes/strikes/show.html.haml' - # Offense count: 28 + # Offense count: 25 InstanceVariables: exclude: - 'app/views/admin/reports/_actions.html.haml' - 'app/views/admin/roles/_form.html.haml' - - '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/relationships/_account.html.haml' diff --git a/app/views/admin/webhooks/_form.html.haml b/app/views/admin/webhooks/_form.html.haml index c870e943f..6c4574fd3 100644 --- a/app/views/admin/webhooks/_form.html.haml +++ b/app/views/admin/webhooks/_form.html.haml @@ -1,14 +1,10 @@ -= simple_form_for @webhook, url: @webhook.new_record? ? admin_webhooks_path : admin_webhook_path(@webhook) do |f| - = render 'shared/error_messages', object: @webhook += render 'shared/error_messages', object: form.object - .fields-group - = f.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' } +.fields-group + = form.input :url, wrapper: :with_block_label, input_html: { placeholder: 'https://' } - .fields-group - = f.input :events, collection: Webhook::EVENTS, wrapper: :with_block_label, include_blank: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', disabled: Webhook::EVENTS.filter { |event| !current_user.role.can?(Webhook.permission_for_event(event)) } +.fields-group + = form.input :events, collection: Webhook::EVENTS, wrapper: :with_block_label, include_blank: false, as: :check_boxes, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li', disabled: Webhook::EVENTS.filter { |event| !current_user.role.can?(Webhook.permission_for_event(event)) } - .fields-group - = f.input :template, wrapper: :with_block_label, input_html: { placeholder: '{ "content": "Hello {{object.username}}" }' } - - .actions - = f.button :button, @webhook.new_record? ? t('admin.webhooks.add_new') : t('generic.save_changes'), type: :submit +.fields-group + = form.input :template, wrapper: :with_block_label, input_html: { placeholder: '{ "content": "Hello {{object.username}}" }' } diff --git a/app/views/admin/webhooks/edit.html.haml b/app/views/admin/webhooks/edit.html.haml index 3dc0ace9b..2c2a7aa03 100644 --- a/app/views/admin/webhooks/edit.html.haml +++ b/app/views/admin/webhooks/edit.html.haml @@ -1,4 +1,7 @@ - content_for :page_title do = t('admin.webhooks.edit') -= render partial: 'form' += simple_form_for @webhook, url: admin_webhook_path(@webhook) do |form| + = render partial: 'form', object: form + .actions + = form.button :button, t('generic.save_changes'), type: :submit diff --git a/app/views/admin/webhooks/new.html.haml b/app/views/admin/webhooks/new.html.haml index 1258df74a..f51b039ce 100644 --- a/app/views/admin/webhooks/new.html.haml +++ b/app/views/admin/webhooks/new.html.haml @@ -1,4 +1,7 @@ - content_for :page_title do = t('admin.webhooks.new') -= render partial: 'form' += simple_form_for @webhook, url: admin_webhooks_path do |form| + = render partial: 'form', object: form + .actions + = form.button :button, t('admin.webhooks.add_new'), type: :submit