From a8297a934991adf5b7df89500d6874859537af62 Mon Sep 17 00:00:00 2001 From: maki Date: Tue, 4 Jun 2024 13:58:53 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20m=C3=A1s=20lints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bootstrap/_custom_checkbox_for_field.haml | 6 ++++- app/views/build_stats/index.haml | 7 ++++-- .../mailer/invitation_instructions.html.haml | 15 ++++++++---- app/views/devise/registrations/edit.haml | 3 ++- app/views/devise/registrations/new.haml | 10 ++++++-- app/views/devise/sessions/new.haml | 6 +++-- app/views/layouts/_breadcrumb.haml | 12 ++++++---- app/views/layouts/_details.haml | 5 +++- app/views/layouts/application.html.haml | 23 ++++++++++++++----- .../posts/attribute_ro/_related_posts.haml | 3 ++- app/views/posts/attributes/_draft.haml | 13 ----------- app/views/posts/index.haml | 5 ++-- app/views/schemas/_filter.haml | 2 +- app/views/sites/_form.haml | 3 ++- app/views/sites/_header.haml | 10 ++++---- app/views/stats/index.haml | 4 +++- 16 files changed, 78 insertions(+), 49 deletions(-) diff --git a/app/views/bootstrap/_custom_checkbox_for_field.haml b/app/views/bootstrap/_custom_checkbox_for_field.haml index a6d85879..8c12de57 100644 --- a/app/views/bootstrap/_custom_checkbox_for_field.haml +++ b/app/views/bootstrap/_custom_checkbox_for_field.haml @@ -2,5 +2,9 @@ - id = "#{field.object_name}_#{name}" - name = "#{field.object_name}[#{name}]" -= render 'bootstrap/custom_checkbox', id: id, name: name, content: content, required: local_assigns[:required], value: '1' do += render 'bootstrap/custom_checkbox', id: id, + name: name, + content: content, + required: local_assigns[:required], + value: '1' do = yield diff --git a/app/views/build_stats/index.haml b/app/views/build_stats/index.haml index c6ba4dfc..d505b2d4 100644 --- a/app/views/build_stats/index.haml +++ b/app/views/build_stats/index.haml @@ -1,6 +1,6 @@ %main.row %aside.menu.col-12.col-lg-3 - = render 'sites/header', site: @site + = render 'sites/header', site: @site, filter_params: @filter_params .col %h1= t('.title') @@ -14,7 +14,10 @@ - row[:urls].each do |url| %tr %th{ scope: 'row' }= row[:title] - %td= link_to_if (url.present? && url.scheme.present?), url.to_s, url.to_s, class: 'word-break-all' + %td= link_to_if (url.present? && url.scheme.present?), + url.to_s, + url.to_s, + class: 'word-break-all' %td %time{ datetime: row[:seconds][:machine] }= row[:seconds][:human] %td= row[:size] diff --git a/app/views/devise/mailer/invitation_instructions.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml index d2d44a67..779c5021 100644 --- a/app/views/devise/mailer/invitation_instructions.html.haml +++ b/app/views/devise/mailer/invitation_instructions.html.haml @@ -10,15 +10,20 @@ - if @resource.needs_invitation_link? %p= link_to t('devise.mailer.invitation_instructions.accept'), - accept_invitation_url(@resource, invitation_token: @token, change_locale_to: @resource.lang) + accept_invitation_url(@resource, + invitation_token: @token, + change_locale_to: @resource.lang) - if @resource.invitation_due_at %p= t('devise.mailer.invitation_instructions.accept_until', - due_date: l(@resource.invitation_due_at, - format: :'devise.mailer.invitation_instructions.accept_until_format')) + due_date: l(@resource.invitation_due_at, + format: :'devise.mailer.invitation_instructions.accept_until_format')) %p= t('devise.mailer.invitation_instructions.ignore') - elsif !@resource.confirmed? && @resource.confirmation_token - = confirmation_url(@resource, confirmation_token: @resource.confirmation_token, change_locale_to: @resource.lang) + = confirmation_url(@resource, + confirmation_token: @resource.confirmation_token, + change_locale_to: @resource.lang) - else - %p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url(change_locale_to: @resource.lang) + %p= link_to t('devise.mailer.invitation_instructions.sign_in'), + root_url(change_locale_to: @resource.lang) diff --git a/app/views/devise/registrations/edit.haml b/app/views/devise/registrations/edit.haml index 98b883fb..8574e88e 100644 --- a/app/views/devise/registrations/edit.haml +++ b/app/views/devise/registrations/edit.haml @@ -30,7 +30,8 @@ .form-group = f.label :password = f.password_field :password, autocomplete: 'new-password', - class: 'form-control', aria: { describedby: 'password-help' } + class: 'form-control', + aria: { describedby: 'password-help' } %small.text-muted.form-text#password-help = t('.leave_blank_if_you_don_t_want_to_change_it') - if @minimum_password_length diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index 0c800a1f..d19251d2 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -22,7 +22,8 @@ .form-group = f.label :password, class: 'sr-only' = f.password_field :password, autocomplete: 'new-password', - class: 'form-control', min: @minimum_password_length, + class: 'form-control', + min: @minimum_password_length, aria: { describedby: 'minimum-password-length' }, placeholder: t(password) - if @minimum_password_length @@ -47,7 +48,12 @@ - content = t(".#{field}.label") - href = t(".#{field}.href", default: '') - help_content = t(".#{field}.help") - = render 'bootstrap/custom_checkbox', id: id, name: name, content: content, required: required, value: '1' do + = render 'bootstrap/custom_checkbox', + id: id, + name: name, + content: content, + required: required, + value: '1' do - if href.present? = link_to help_content, href, target: '_blank', rel: 'noopener' - else diff --git a/app/views/devise/sessions/new.haml b/app/views/devise/sessions/new.haml index be1e01f8..e1bc85bb 100644 --- a/app/views/devise/sessions/new.haml +++ b/app/views/devise/sessions/new.haml @@ -28,8 +28,10 @@ placeholder: t('login.password') - if devise_mapping.rememberable? .form-group - = render 'bootstrap/custom_checkbox_for_field', field: f, name: :remember_me do - = t('login.remember_me', remember_for: distance_of_time_in_words(Usuarie.remember_for)) + = render 'bootstrap/custom_checkbox_for_field', + field: f, name: :remember_me do + = t('login.remember_me', + remember_for: distance_of_time_in_words(Usuarie.remember_for)) .actions = f.submit t('.sign_in'), class: 'btn btn-secondary btn-lg btn-block' diff --git a/app/views/layouts/_breadcrumb.haml b/app/views/layouts/_breadcrumb.haml index 974b271f..639d4a27 100644 --- a/app/views/layouts/_breadcrumb.haml +++ b/app/views/layouts/_breadcrumb.haml @@ -1,7 +1,8 @@ %nav.navbar.flex-md-nowrap.px-0 %a.navbar-brand.order-0{ href: '/' } = inline_svg_tag 'sutty.svg', class: 'black', aria: true, - title: t('svg.sutty.title'), desc: t('svg.sutty.desc') + title: t('svg.sutty.title'), + desc: t('svg.sutty.desc') - if breadcrumbs? %nav.flex-grow-1.order-2.order-md-1{ aria: { label: t('.title') } } @@ -13,11 +14,11 @@ - else = link_to crumb.name, crumb.url, class: 'line-clamp-1' - - if @current_usuarie || current_usuarie + - if usuarie || current_usuarie %ul.navbar-nav.order-1.order-md-2 - - if @site&.tienda? + - if site&.tienda? %li.nav-item - = link_to t('.tienda'), @site.tienda_url, + = link_to t('.tienda'), site.tienda_url, role: 'button', class: 'btn btn-secondary' %li.nav-item @@ -33,4 +34,5 @@ - next if locale == I18n.locale %li.nav-item - = link_to t("switch_locale.#{locale}"), params.to_h.merge(change_locale_to: locale) + = link_to t("switch_locale.#{locale}"), + params.to_h.merge(change_locale_to: locale) diff --git a/app/views/layouts/_details.haml b/app/views/layouts/_details.haml index c07ab121..5e8d566c 100644 --- a/app/views/layouts/_details.haml +++ b/app/views/layouts/_details.haml @@ -10,7 +10,10 @@ - local_assigns[:closed] ||= '▶'.html_safe - local_assigns[:open] ||= '▼'.html_safe -%details.details.py-2{ id: local_assigns[:id], data: { controller: 'details', action: 'toggle->details#store' }, class: local_assigns[:details_class] } +%details.details.py-2{ id: local_assigns[:id], + data: { controller: 'details', + action: 'toggle->details#store' }, + class: local_assigns[:details_class] } %summary.d-flex.flex-row.align-items-center.justify-content-between{ class: local_assigns[:summary_class] } %span= summary %span.hide-when-open{ class: local_assigns[:open_class] }= local_assigns[:closed] diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index eaa15eb4..f28c67af 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -13,16 +13,27 @@ %script{ type: 'text/javascript', src: '/env.js' } = csrf_meta_tags - = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' - = stylesheet_link_tag 'dark', rel: 'alternate stylesheet', media: 'all', 'data-turbolinks-track': 'reload', title: t('dark') - = javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', defer: true - = stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' - = favicon_link_tag 'sutty_cuadrada.png', rel: 'apple-touch-icon', type: 'image/png' + = stylesheet_link_tag 'application', + media: 'all', + 'data-turbolinks-track': 'reload' + = stylesheet_link_tag 'dark', + rel: 'alternate stylesheet', + media: 'all', + 'data-turbolinks-track': 'reload', + title: t('dark') + = javascript_pack_tag 'application', + 'data-turbolinks-track': 'reload', + defer: true + = stylesheet_pack_tag 'application', + 'data-turbolinks-track': 'reload' + = favicon_link_tag 'sutty_cuadrada.png', + rel: 'apple-touch-icon', + type: 'image/png' = render 'layouts/link_rel_alternate' %body{ class: yield(:body) } .container-fluid#sutty - = render 'layouts/breadcrumb' + = render 'layouts/breadcrumb', usuarie: @current_usuarie, site: @site = render 'layouts/flash' = yield diff --git a/app/views/posts/attribute_ro/_related_posts.haml b/app/views/posts/attribute_ro/_related_posts.haml index 5813e35c..2bf51367 100644 --- a/app/views/posts/attribute_ro/_related_posts.haml +++ b/app/views/posts/attribute_ro/_related_posts.haml @@ -2,7 +2,8 @@ %th= post_label_t(attribute, post: post) %td %ul{ dir: dir, lang: locale } - - site.indexed_posts.where(locale: post.lang.value, post_id: metadata.value).find_each do |p| + - site.indexed_posts.where(locale: post.lang.value, + post_id: metadata.value).find_each do |p| -# XXX: Ignorar todos los posts no encontrados (ej: fueron borrados o el uuid cambiĆ³) diff --git a/app/views/posts/attributes/_draft.haml b/app/views/posts/attributes/_draft.haml index 351edf01..e69de29b 100644 --- a/app/views/posts/attributes/_draft.haml +++ b/app/views/posts/attributes/_draft.haml @@ -1,13 +0,0 @@ -- if !@site.invitade?(cuenta) # esto ta mal - .form-check - = hidden_field_tag "#{base}[#{attribute}]", '0', id: '' - .custom-control.custom-switch - = check_box_tag "#{base}[#{attribute}]", '1', metadata.value, - class: "custom-control-input #{invalid(post, attribute)}", - aria: { describedby: id_for_help(attribute) }, - autofocus: autofocus - = label_tag "#{base}_#{attribute}", post_label_t(attribute, post: post), - class: 'custom-control-label' - - = render 'posts/attribute_feedback', - post: post, attribute: attribute, metadata: metadata diff --git a/app/views/posts/index.haml b/app/views/posts/index.haml index dbc5f4da..989e53ee 100644 --- a/app/views/posts/index.haml +++ b/app/views/posts/index.haml @@ -8,7 +8,7 @@ %main.row %aside.menu.col-lg-3 .mb-3 - = render 'sites/header', site: @site + = render 'sites/header', site: @site, filter_params: @filter_params = render 'sites/status', site: @site = render 'sites/build', site: @site, class: 'btn-block' = render 'sites/moderation_queue', site: @site, class: 'btn-block' @@ -89,7 +89,8 @@ - if @site.locales.size > 1 %nav#locales - @site.locales.each do |locale| - = link_to @site.data.dig(locale.to_s, 'locale') || locale, site_posts_path(@site, **@filter_params.merge(locale: locale)), + = link_to @site.data.dig(locale.to_s, 'locale') || locale, + site_posts_path(@site, **@filter_params.merge(locale: locale)), class: "mr-2 mt-2 mb-2 #{locale == @locale ? 'active font-weight-bold' : ''}" - if @posts.empty? diff --git a/app/views/schemas/_filter.haml b/app/views/schemas/_filter.haml index b1bdd078..de4c03a7 100644 --- a/app/views/schemas/_filter.haml +++ b/app/views/schemas/_filter.haml @@ -4,7 +4,7 @@ name: 'layout[]', class: '', value: schema.name, - checked: @filter_params[:layout]&.include?(key.to_s) } + checked: filter[:layout]&.include?(key.to_s) } %label.custom-control-label.font-weight-normal{ for: schema }= schema.humanized_name -# XXX: Solo un nivel de recursividad diff --git a/app/views/sites/_form.haml b/app/views/sites/_form.haml index 4945d53e..20c15fb6 100644 --- a/app/views/sites/_form.haml +++ b/app/views/sites/_form.haml @@ -94,7 +94,8 @@ = f.radio_button :licencia_id, licencia.id, checked: licencia.id == site.licencia_id, required: true, class: 'custom-control-input' - = f.label "licencia_id_#{licencia.id}", class: 'custom-control-label' do + = f.label "licencia_id_#{licencia.id}", + class: 'custom-control-label' do = licencia.name = sanitize_markdown licencia.description, tags: %w[p a strong em ul ol li h1 h2 h3 h4 h5 h6] diff --git a/app/views/sites/_header.haml b/app/views/sites/_header.haml index 306297cf..01b76083 100644 --- a/app/views/sites/_header.haml +++ b/app/views/sites/_header.haml @@ -2,7 +2,7 @@ %h1= site.title %p.lead= site.description %form.mb-3{ action: site_posts_path } - - @filter_params.each do |param, values| + - filter_params.each do |param, values| - next if param == :q - [values].flatten.each do |value| @@ -14,19 +14,19 @@ .input-group %input.form-control.border.border-magenta.border-right-0#q{ type: 'search', name: 'q', - value: @filter_params[:q] } + value: filter_params[:q] } .input-group-append %span.input-group-text.background-white.magenta.border.border-magenta.border-top.border-left-0.border-right.border-bottom %i.fa.fa-fw.fa-search %input.sr-only{ type: 'submit' } - - @filter_params.each do |param, values| + - filter_params.each do |param, values| - [values].flatten.each do |value| - = link_to site_posts_path(@site, **filter_params_by(@filter_params, param, value)), + = link_to site_posts_path(site, **filter_params_by(filter_params, param, value)), class: 'btn btn-secondary btn-sm', title: t('posts.remove_filter_help', filter: value), aria: { labelledby: "help-filter-#{param}" } do - if param == :layout - = @site.layouts[value.to_sym].humanized_name + = site.layouts[value.to_sym].humanized_name - else = value × diff --git a/app/views/stats/index.haml b/app/views/stats/index.haml index 15fbdb9b..0546bee4 100644 --- a/app/views/stats/index.haml +++ b/app/views/stats/index.haml @@ -55,7 +55,9 @@ .form-group %button.btn.btn-secondary{ type: 'submit' }= t('.urls.submit') - if @normalized_urls.present? - = line_chart site_stats_uris_path(urls: @normalized_urls, **@chart_params), **@chart_options + = line_chart site_stats_uris_path(urls: @normalized_urls, + **@chart_params), + **@chart_options .row.mb-5.row-cols-1.row-cols-lg-2 - @columns.each_pair do |column, values|