From 247bad89a0afde1dbf44689c048fdb0f7e0960f5 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 11:38:55 +0300 Subject: [PATCH 01/25] setting up ERB linting (ACTION WILL NOT PASS) --- .better-html.yml | 3 +++ .erb_lint.yml | 22 ++++++++++++++++++++++ .github/workflows/ci-cd.yml | 23 +++++++++++++++++++++++ Gemfile | 1 + Gemfile.lock | 16 ++++++++++++++++ app/views/admin/create_site.html.erb | 2 +- 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .better-html.yml create mode 100644 .erb_lint.yml diff --git a/.better-html.yml b/.better-html.yml new file mode 100644 index 000000000..7ef90a3d8 --- /dev/null +++ b/.better-html.yml @@ -0,0 +1,3 @@ +# https://github.com/Shopify/better-html#configuration + +allow_single_quoted_attributes: false diff --git a/.erb_lint.yml b/.erb_lint.yml new file mode 100644 index 000000000..109613091 --- /dev/null +++ b/.erb_lint.yml @@ -0,0 +1,22 @@ +# configuration reference: https://github.com/Shopify/erb_lint?tab=readme-ov-file#configuration + +EnableDefaultLinters: false + +exclude: + - 'config/**/*' + - 'db/**/*' + - 'scripts/**/*' + - 'bin/**/*' + - 'lib/namespaced_env_cache.rb' + - 'vendor/bundle/**/*' +glob: '**/*.{html,text,js}{+*,}.erb' + +linters: + ErbSafety: + enabled: true + better_html_config: .better-html.yml + Rubocop: + enabled: true + rubocop_config: + inherit_from: + - .rubocop.yml diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b52fedc41..03d2f501b 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -12,6 +12,28 @@ env: RAILS_ENV: test jobs: + erb_lint: + name: ERB checking + runs-on: ubuntu-latest + + strategy: + matrix: + ruby_version: [3.1, 3.2] + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Setup dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -yqq libmagickwand-dev + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - run: bundle exec erb_lint --lint-all + rubocop: name: Rubocop checking runs-on: ubuntu-latest @@ -118,6 +140,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' }} needs: + - erb_lint - rubocop - typescript - tests diff --git a/Gemfile b/Gemfile index 47f6f9fc2..0cd2bfe84 100644 --- a/Gemfile +++ b/Gemfile @@ -51,6 +51,7 @@ gem 'whenever', '~> 1.0', require: false # Debugging, linting, testing. gem 'awesome_print', '~> 1.9' +gem 'erb_lint', '~> 0.9.0' gem 'rubocop', '~> 1' gem 'rubocop-rails', '~> 2.15' gem 'rubocop-rake', '~> 0.7.1' diff --git a/Gemfile.lock b/Gemfile.lock index 8eaa025e7..755dfa68b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -105,6 +105,13 @@ GEM base64 (0.3.0) bcrypt (3.1.20) benchmark (0.4.1) + better_html (2.1.1) + actionview (>= 6.0) + activesupport (>= 6.0) + ast (~> 2.0) + erubi (~> 1.4) + parser (>= 2.4) + smart_properties bigdecimal (3.2.2) bindex (0.8.1) builder (3.3.0) @@ -157,6 +164,13 @@ GEM e2mmap (0.1.0) erb (4.0.4) cgi (>= 0.3.3) + erb_lint (0.9.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop (>= 1) + smart_properties erubi (1.13.1) execjs (2.10.0) fastimage (2.4.0) @@ -405,6 +419,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) + smart_properties (1.17.0) spring (4.3.0) sprockets (4.1.1) concurrent-ruby (~> 1.0) @@ -483,6 +498,7 @@ DEPENDENCIES devise_saml_authenticatable (~> 1.9) diffy (~> 3.4) e2mmap (~> 0.1) + erb_lint (~> 0.9.0) fastimage (~> 2.2) flamegraph (~> 0.9) groupdate (~> 6.1) diff --git a/app/views/admin/create_site.html.erb b/app/views/admin/create_site.html.erb index 5333f94ad..feaa53b86 100644 --- a/app/views/admin/create_site.html.erb +++ b/app/views/admin/create_site.html.erb @@ -16,4 +16,4 @@

Once you are ready, click on the following button:

-To new site \ No newline at end of file +To new site From f9a3dbd4a9afb50b06b9ca537eb7c83231542fae Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 11:42:43 +0300 Subject: [PATCH 02/25] do not even try to run tests if linting fails --- .github/workflows/ci-cd.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 03d2f501b..d19893570 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -73,6 +73,10 @@ jobs: tests: name: Ruby on Rails tests runs-on: ubuntu-latest + needs: + - erb_lint + - rubocop + - typescript strategy: matrix: From c74f0f6181035fcddfa1b6d353d43e77fe00385a Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 11:48:43 +0300 Subject: [PATCH 03/25] fine, I'll specify permissions now, CodeQL --- .github/workflows/ci-cd.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index d19893570..9a3e6c522 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -11,6 +11,12 @@ on: env: RAILS_ENV: test +permissions: + actions: write + contents: read + issues: read + pull-requests: read + jobs: erb_lint: name: ERB checking From 05c15315b1a3f7f9fd8ca74e60123be3c6035c21 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:02:32 +0300 Subject: [PATCH 04/25] disabled Layout/TrailingEmptyLines for ERB linting (~3K errors) --- .erb_lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.erb_lint.yml b/.erb_lint.yml index 109613091..cf3ef4aa9 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -20,3 +20,5 @@ linters: rubocop_config: inherit_from: - .rubocop.yml + Layout/TrailingEmptyLines: + Enabled: false # enable when we are ready to solve ~3K errors From 14134b8dfb5e602d5d88da58ccf4936a18a3c9b6 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:05:39 +0300 Subject: [PATCH 05/25] disabled Layout/InitialIndentation due to thousands of false positives --- .erb_lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.erb_lint.yml b/.erb_lint.yml index cf3ef4aa9..31e8aa9bb 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -22,3 +22,5 @@ linters: - .rubocop.yml Layout/TrailingEmptyLines: Enabled: false # enable when we are ready to solve ~3K errors + Layout/InitialIndentation: + Enabled: false # false positives on embedded Ruby indentation in tags From 56e2f3e6e61aeae94e9ba4520fd3388fee41f469 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:09:24 +0300 Subject: [PATCH 06/25] disabled Lint/UselessAssignment due to hundreds of false positives --- .erb_lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.erb_lint.yml b/.erb_lint.yml index 31e8aa9bb..3c999799c 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -20,7 +20,9 @@ linters: rubocop_config: inherit_from: - .rubocop.yml - Layout/TrailingEmptyLines: - Enabled: false # enable when we are ready to solve ~3K errors Layout/InitialIndentation: Enabled: false # false positives on embedded Ruby indentation in tags + Layout/TrailingEmptyLines: + Enabled: false # enable when we are ready to solve ~3K errors + Lint/UselessAssignment: + Enabled: false # false positives on single-line embedded Ruby assignments From 267401a470612242a2f867ba8630d2abd87d4471 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:26:38 +0300 Subject: [PATCH 07/25] added specific files to ERB lint exclusion list as they cause clobbering --- .erb_lint.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.erb_lint.yml b/.erb_lint.yml index 3c999799c..586162de6 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -9,6 +9,17 @@ exclude: - 'bin/**/*' - 'lib/namespaced_env_cache.rb' - 'vendor/bundle/**/*' + # TODO: fix clobbering (autocorrect conflics) first: + - 'app/views/admin/_error_report.html.erb' + - 'app/views/categories/show.html.erb' + - 'app/views/micro_auth/authentication/initiate.html.erb' + - 'app/views/reactions/_form.html.erb' + - 'app/views/reports/reactions.html.erb' + - 'app/views/suggested_edit/category_index.html.erb' + - 'app/views/questions/_list.html.erb' + - 'app/views/tags/category.html.erb' + - 'app/views/users/_activity_items.html.erb' + glob: '**/*.{html,text,js}{+*,}.erb' linters: From a94cbf120fc81efb4c2eefb14233e9ff106b4a76 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:31:28 +0300 Subject: [PATCH 08/25] disabled Layout/LeadingEmptyLine due to false positives --- .erb_lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.erb_lint.yml b/.erb_lint.yml index 586162de6..d04c942d6 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -31,6 +31,8 @@ linters: rubocop_config: inherit_from: - .rubocop.yml + Layout/LeadingEmptyLines: + Enabled: false # false positives on embedded Ruby indentation in tags Layout/InitialIndentation: Enabled: false # false positives on embedded Ruby indentation in tags Layout/TrailingEmptyLines: From d44dc06648fc19965c29fc480b72ad3ed4290f4d Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 12:44:38 +0300 Subject: [PATCH 09/25] disabled Layout/TrailingWhitespace due to false positives --- .erb_lint.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.erb_lint.yml b/.erb_lint.yml index d04c942d6..93a4a25d6 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -37,5 +37,7 @@ linters: Enabled: false # false positives on embedded Ruby indentation in tags Layout/TrailingEmptyLines: Enabled: false # enable when we are ready to solve ~3K errors + Layout/TrailingWhitespace: + Enabled: false # false positives on embedded Ruby indentation in tags Lint/UselessAssignment: Enabled: false # false positives on single-line embedded Ruby assignments From 927f736f781d8cfabfe113dbe73e62b00eb70071 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 15:02:24 +0300 Subject: [PATCH 10/25] applying a couple of trivial fixes --- app/views/admin/admin_email.html.erb | 2 +- app/views/admin/all_email.html.erb | 48 ++++++++++---------- app/views/comments/_reply_to_thread.html.erb | 2 +- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/views/admin/admin_email.html.erb b/app/views/admin/admin_email.html.erb index 1f8627051..abee41002 100644 --- a/app/views/admin/admin_email.html.erb +++ b/app/views/admin/admin_email.html.erb @@ -6,7 +6,7 @@ <%= form_with url: send_moderator_email_path do |f| %>
<%= f.label :subject, t('g.subject').capitalize, class: 'form-element' %> - <%= f.text_field :subject, class: 'form-element' %> + <%= f.text_field :subject, class: 'form-element' %>
<%= render 'shared/body_field', f: f, field_name: :body_markdown, field_label: t('g.body').capitalize, post: nil %> diff --git a/app/views/admin/all_email.html.erb b/app/views/admin/all_email.html.erb index ade37ea36..f48e1f539 100644 --- a/app/views/admin/all_email.html.erb +++ b/app/views/admin/all_email.html.erb @@ -1,24 +1,24 @@ -<%= render 'posts/markdown_script' %> - -
-

- Please be careful, as this tool sends a lot of emails. -

-
- -

<%= t 'admin.tools.email_all' %>

-

<%= t 'admin.email_all_blurb' %>

- -<%= form_with url: send_all_email_path do |f| %> -
- <%= f.label :subject, t('g.subject').capitalize, class: 'form-element' %> - <%= f.text_field :subject, class: 'form-element', required: true %> -
- - <%= render 'shared/body_field', f: f, field_name: :body_markdown, field_label: t('g.body').capitalize, post: nil %> - -
- - <%= f.submit t('g.send').capitalize, class: 'button is-filled', - onclick: "return confirm('Are you sure you want to send this email to all users?')" %> -<% end %> +<%= render 'posts/markdown_script' %> + +
+

+ Please be careful, as this tool sends a lot of emails. +

+
+ +

<%= t 'admin.tools.email_all' %>

+

<%= t 'admin.email_all_blurb' %>

+ +<%= form_with url: send_all_email_path do |f| %> +
+ <%= f.label :subject, t('g.subject').capitalize, class: 'form-element' %> + <%= f.text_field :subject, class: 'form-element', required: true %> +
+ + <%= render 'shared/body_field', f: f, field_name: :body_markdown, field_label: t('g.body').capitalize, post: nil %> + +
+ + <%= f.submit t('g.send').capitalize, class: 'button is-filled', + onclick: "return confirm('Are you sure you want to send this email to all users?')" %> +<% end %> diff --git a/app/views/comments/_reply_to_thread.html.erb b/app/views/comments/_reply_to_thread.html.erb index db94fd5ca..1c0fb509c 100644 --- a/app/views/comments/_reply_to_thread.html.erb +++ b/app/views/comments/_reply_to_thread.html.erb @@ -50,6 +50,6 @@ post: thread.post_id, character_count: ".js-character-count-#{post.id}" } %> <%= render 'shared/char_count', type: post.id, min: 15, max: 1000 %> - <%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled:true %> + <%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled: true %> <% end %> <% end %> From 9763d0128488552b413b45016bfc7e4ef41efcfa Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 24 Jul 2025 15:03:46 +0300 Subject: [PATCH 11/25] removed matrices from linting jobs --- .github/workflows/ci-cd.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 9a3e6c522..070e266d0 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -10,6 +10,7 @@ on: env: RAILS_ENV: test + RUBY_VERSION: 3.2 permissions: actions: write @@ -22,10 +23,6 @@ jobs: name: ERB checking runs-on: ubuntu-latest - strategy: - matrix: - ruby_version: [3.1, 3.2] - steps: - name: Checkout repo uses: actions/checkout@v3 @@ -36,7 +33,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby_version }} + ruby-version: ${{ env.RUBY_VERSION }} bundler-cache: true - run: bundle exec erb_lint --lint-all @@ -44,10 +41,6 @@ jobs: name: Rubocop checking runs-on: ubuntu-latest - strategy: - matrix: - ruby_version: [3.1, 3.2] - steps: - name: Checkout repo uses: actions/checkout@v3 @@ -58,7 +51,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby_version }} + ruby-version: ${{ env.RUBY_VERSION }} bundler-cache: true - run: bundle exec rubocop From 181037a2a0faa328298138c23af1f0d7bd4804ff Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 11:41:41 +0300 Subject: [PATCH 12/25] minor linting fixes for the users/edit_profile view --- app/views/users/edit_profile.html.erb | 30 ++++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/app/views/users/edit_profile.html.erb b/app/views/users/edit_profile.html.erb index 654a2ef29..1e533af71 100644 --- a/app/views/users/edit_profile.html.erb +++ b/app/views/users/edit_profile.html.erb @@ -22,7 +22,12 @@ <%= form_for current_user, url: update_user_profile_path do |f| %>
- user avatar + user avatar <%= f.label :avatar, class: "form-element" %>
An optional profile picture. Max file size <%= SiteSetting['MaxUploadSize'] %>. @@ -50,14 +55,20 @@

Extra fields -- your web site, GitHub profile, social-media usernames, whatever you want. Only values that begin with "http" are rendered as links.

<%= f.fields_for :user_websites do |w| %> -
-
-
<%= w.text_field :label, class: 'form-element', autocomplete: 'off', placeholder: 'label' %>
+
+
+
<%= w.text_field :label, + class: 'form-element', + autocomplete: 'off', + placeholder: 'label' %>
+
+
+
<%= w.text_field :url, + class: 'form-element', + autocomplete: 'off', + placeholder: 'https://...' %>
+
-
-
<%= w.text_field :url, class: 'form-element', autocomplete: 'off', placeholder: 'https://...' %>
-
-
<% end %>
@@ -67,8 +78,7 @@ Your Discord user tag, username or username#1234. <%= f.text_field :discord, class: 'form-element', autocomplete: 'off', placeholder: 'username#1234' %>
- - + <%= f.submit 'Save', class: 'button is-filled' %> <% end %> From 9a46f066bdfa24b0b67b5b140c6e65662d342bbb Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 11:46:01 +0300 Subject: [PATCH 13/25] minor linting fixes for the users/vote_summary view --- app/views/users/vote_summary.html.erb | 97 ++++++++++++++------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/app/views/users/vote_summary.html.erb b/app/views/users/vote_summary.html.erb index d1cf7dcaa..677122b0e 100644 --- a/app/views/users/vote_summary.html.erb +++ b/app/views/users/vote_summary.html.erb @@ -5,62 +5,63 @@

A daily summary of votes received for posts.

<% @votes.each do |day, vote_list, net_votes| %> -
> - -

<%= day.strftime('%b %e, %Y') %>: -<% if net_votes > 0 %> - +<%= net_votes %> -<% elsif net_votes < 0 %> - <%= net_votes %> -<% else %> - 0 -<% end %>

-
-
- <% vote_list.each do |post, vote_data| %> - <% vote_data = { -1 => [], 1 => [] }.merge(vote_data.group_by { |vd| vd.vote_type }) %> -
-
+
> + +

<%= day.strftime('%b %e, %Y') %>: + <% if net_votes > 0 %> + +<%= net_votes %> + <% elsif net_votes < 0 %> + <%= net_votes %> + <% else %> + 0 + <% end %>

+
+
+ <% vote_list.each do |post, vote_data| %> + <% vote_data = { -1 => [], 1 => [] }.merge(vote_data.group_by { |vd| vd.vote_type }) %> +
+
- <% if vote_data[+1].count == 0 %> - +0 - <% else %> - +<%= vote_data[+1].first.vote_count %> - <% end %> + <% if vote_data[+1].count == 0 %> + +0 + <% else %> + +<%= vote_data[+1].first.vote_count %> + <% end %> -
-
+
+
- <% if vote_data[-1].count == 0 %> - −0 - <% else %> - −<%= vote_data[-1].first.vote_count %> - <% end %> + <% if vote_data[-1].count == 0 %> + −0 + <% else %> + −<%= vote_data[-1].first.vote_count %> + <% end %> -
-
+
+
- <% if post.present? %> -
- <%= link_to generic_share_link(post) do %> - <%= post.post_type.is_top_level ? post.title : post.parent.title %> - <% end %> -
-
- <%= post.post_type.name %> - <%= post.category.name %> -
- <% else %> -
- <%= I18n.t('votes.summary.post_missing') %> -
- <% end %> + <% if post.present? %> +
+ <%= link_to generic_share_link(post) do %> + <%= post.post_type.is_top_level ? post.title : post.parent.title %> + <% end %> +
+
+ <%= post.post_type.name %> + <%= post.category.name %> +
+ <% else %> +
+ <%= I18n.t('votes.summary.post_missing') %> +
+ <% end %>
+
+ <% end %>
- <% end %> -
-
+ <% end %>
From fdd87e9221f6cf1a17d8c57ab473adde064cfdb9 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 12:41:35 +0300 Subject: [PATCH 14/25] fixed search button alignment on the users page --- app/assets/stylesheets/audit_logs.scss | 13 ++++++++++++- app/assets/stylesheets/forms.scss | 10 ++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/audit_logs.scss b/app/assets/stylesheets/audit_logs.scss index 4c0649655..b9e739339 100644 --- a/app/assets/stylesheets/audit_logs.scss +++ b/app/assets/stylesheets/audit_logs.scss @@ -1,10 +1,12 @@ @import 'variables'; .audit-log-filters { - .select2-container { + .form-group-horizontal .actions, .select2-container { height: 37px; margin: 4px 0px; + } + .select2-container { .selection { .select2-selection { border-color: $muted-graphic; @@ -18,4 +20,13 @@ } } } + + .form-group-horizontal { + .actions { + .button { + height: 100%; + margin: 0; + } + } + } } diff --git a/app/assets/stylesheets/forms.scss b/app/assets/stylesheets/forms.scss index a2c87bc87..9274e3644 100644 --- a/app/assets/stylesheets/forms.scss +++ b/app/assets/stylesheets/forms.scss @@ -20,10 +20,10 @@ select.form-element { } & > .form-group { - margin: 0 0 1em 0; + margin: 0.5em 0; @media screen and (min-width: $screen-md) { - margin: 0 1em 0 0; + margin: 0 0.5em; flex: 1; } } @@ -31,12 +31,6 @@ select.form-element { & > .actions { display: flex; align-items: flex-end; - margin-bottom: 4px; // to match bottom margin on .form-element - - button, input[type="submit"] { - margin: unset; - padding: 9.5px 12px; // because for some reason it has to be 9.5px to match .form-elements' height - } } } From 506954554cccd5f1ef309dc7b59a28b95039c39e Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 12:44:24 +0300 Subject: [PATCH 15/25] fixed linting issues with the users/index view --- app/views/users/index.html.erb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 38ddf37ea..90e313181 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,25 +1,30 @@ -<% content_for :title, "Users" %> +<% content_for :title, 'Users' %> + +<% is_default = params[:sort].nil? && params[:search].nil? %>

Users

<%= form_tag users_path, method: :get, class: 'form-inline' do %>
- <%= label_tag :search, "Search", class: "form-element" %> + <%= label_tag :search, 'Search', class: 'form-element' %> <%= text_field_tag :search, params[:search], class: 'form-element' %> <%= hidden_field_tag :sort, params[:sort] || @sort_param %>
- +
<% end %>
<%= link_to 'Reputation', request.params.merge(sort: 'reputation'), - class: "button is-muted is-outlined #{params[:sort] == 'reputation' || (params[:sort].nil? && params[:search].nil?) ? 'is-active' : ''}", - role: 'button', 'aria-label': 'Sort by reputation' %> - <%= link_to 'Age', request.params.merge(sort: 'age'), class: "button is-muted is-outlined #{params[:sort] == 'age' ? 'is-active' : ''}", + class: "button is-muted is-outlined #{'is-active' if params[:sort] == 'reputation' || is_default}", + role: 'button', 'aria-label': 'Sort by reputation' %> + <%= link_to 'Age', request.params.merge(sort: 'age'), + class: "button is-muted is-outlined #{'is-active' if params[:sort] == 'age'}", role: 'button', 'aria-label': 'Sort by age' %>
From e9ccb7b4c55666fb7a81a51e80a3e1717007d02e Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 13:22:38 +0300 Subject: [PATCH 16/25] minor linting fix for the search/_widget partial --- app/views/search/_widget.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/search/_widget.html.erb b/app/views/search/_widget.html.erb index 0c7231a7c..c63eb6eb4 100644 --- a/app/views/search/_widget.html.erb +++ b/app/views/search/_widget.html.erb @@ -1,7 +1,7 @@ <%= form_tag search_path, method: :get, role: 'search' do %>
- <%= label_tag :search, 'Search term', class: "form-element" %> + <%= label_tag :search, 'Search term', class: 'form-element' %> <%= search_field_tag :search, params[:search], class: 'form-element' %>
From 9233b4c27655ea082b53459ddbc3103778ef77b2 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 13:27:47 +0300 Subject: [PATCH 17/25] fixed linting issues with the users/posts view --- app/views/users/posts.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/users/posts.html.erb b/app/views/users/posts.html.erb index 9f9ab4cdb..553f73033 100644 --- a/app/views/users/posts.html.erb +++ b/app/views/users/posts.html.erb @@ -15,14 +15,14 @@
<%= link_to 'Activity', request.params.merge(sort: 'activity'), - class: 'button is-muted is-outlined ' + (active_search?('last_activity') ? 'is-active' : ''), - role: 'button', 'aria-label': 'Sort by activity' %> + class: "button is-muted is-outlined #{'is-active' if active_search?('last_activity')}", + role: 'button', 'aria-label': 'Sort by activity' %> <%= link_to 'Age', request.params.merge(sort: 'age'), - class: 'button is-muted is-outlined ' + (active_search?('created_at') ? 'is-active' : ''), - role: 'button', 'aria-label': 'Sort by age' %> + class: "button is-muted is-outlined #{'is-active' if active_search?('created_at')}", + role: 'button', 'aria-label': 'Sort by age' %> <%= link_to 'Score', request.params.merge(sort: 'score'), - class: 'button is-muted is-outlined ' + (active_search?('score') ? 'is-active' : ''), - role: 'button', 'aria-label': 'Sort by score' %> + class: "button is-muted is-outlined #{'is-active' if active_search?('score')}", + role: 'button', 'aria-label': 'Sort by score' %>
From 535d8dffe062f24dfc02029a45da168b6595ebea Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Thu, 31 Jul 2025 13:51:03 +0300 Subject: [PATCH 18/25] applied a bunch of easy autocorrections --- app/views/admin/index.html.erb | 2 +- app/views/admin/new_site.html.erb | 46 ++--- app/views/admin/setup.html.erb | 186 ++++++++--------- app/views/categories/post_types.html.erb | 8 +- app/views/close_reasons/edit.html.erb | 2 +- app/views/close_reasons/new.html.erb | 4 +- app/views/comments/_reply_to_thread.html.erb | 2 +- app/views/devise/confirmations/new.html.erb | 11 +- app/views/devise/passwords/edit.html.erb | 14 +- app/views/devise/passwords/new.html.erb | 10 +- app/views/devise/registrations/edit.html.erb | 20 +- app/views/devise/registrations/new.html.erb | 22 +- app/views/devise/sessions/new.html.erb | 18 +- .../devise/shared/_error_messages.html.erb | 2 +- app/views/devise/shared/_links.html.erb | 8 +- app/views/devise/unlocks/new.html.erb | 10 +- app/views/errors/restricted_content.html.erb | 6 +- app/views/fake_community/communities.html.erb | 2 +- app/views/flags/handled.html.erb | 2 +- app/views/flags/queue.html.erb | 6 +- app/views/moderator/index.html.erb | 4 +- .../moderator/recently_deleted_posts.html.erb | 2 +- app/views/post_history/post.html.erb | 2 +- app/views/post_types/_form.html.erb | 2 +- app/views/posts/_edit_comment.html.erb | 2 +- app/views/posts/_image_upload.html.erb | 4 +- app/views/posts/_tag_badge.html.erb | 2 +- app/views/posts/document.html.erb | 6 +- app/views/shared/_lock_notice.html.erb | 2 +- app/views/site_settings/edit.html.erb | 8 +- app/views/site_settings/index.html.erb | 2 +- app/views/subscriptions/new.html.erb | 4 +- app/views/suggested_edit/show.html.erb | 190 +++++++++--------- .../summary_mailer/content_summary.html.erb | 2 +- app/views/tags/select_merge.html.erb | 5 +- app/views/tour/more.html.erb | 2 +- app/views/users/_network.html.erb | 2 +- app/views/users/_user.html.erb | 2 +- 38 files changed, 314 insertions(+), 310 deletions(-) diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index 0bb9bf619..cd6cb91c5 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -1,6 +1,6 @@ <% content_for :title, t('admin.dashboard.title') %> -<%= link_to moderator_path, class: "has-font-size-small" do %> +<%= link_to moderator_path, class: 'has-font-size-small' do %> Switch to Moderator Tools <% end %> diff --git a/app/views/admin/new_site.html.erb b/app/views/admin/new_site.html.erb index 89a35599f..5cce29082 100644 --- a/app/views/admin/new_site.html.erb +++ b/app/views/admin/new_site.html.erb @@ -1,24 +1,24 @@ -

Create New Site

- -
-

Attention! You are about to create a new site in this network. You will not be able to undo this later. You'll need access to the server configuration to complete this process.

-
- -

Site Configuration

- -<%= form_for @new_community, url: create_site_path do |f| %> - -
- <%= f.label :name, 'Community name', class: 'form-element' %> - <%= f.text_field :name, class: 'form-element' %> -
- -
- <%= f.label :host, 'Primary community host', class: 'form-element' %> -
This is likely something like X.codidact.com. Without / and https://. You can set up secondary community hosts (redirect) later in the server configuration.
- <%= f.text_field :host, class: 'form-element' %> -
- - <%= f.submit "Create new site", class: 'button is-danger is-filled' %> - +

Create New Site

+ +
+

Attention! You are about to create a new site in this network. You will not be able to undo this later. You'll need access to the server configuration to complete this process.

+
+ +

Site Configuration

+ +<%= form_for @new_community, url: create_site_path do |f| %> + +
+ <%= f.label :name, 'Community name', class: 'form-element' %> + <%= f.text_field :name, class: 'form-element' %> +
+ +
+ <%= f.label :host, 'Primary community host', class: 'form-element' %> +
This is likely something like X.codidact.com. Without / and https://. You can set up secondary community hosts (redirect) later in the server configuration.
+ <%= f.text_field :host, class: 'form-element' %> +
+ + <%= f.submit 'Create new site', class: 'button is-danger is-filled' %> + <% end %> \ No newline at end of file diff --git a/app/views/admin/setup.html.erb b/app/views/admin/setup.html.erb index d897f5f9f..2b4904fee 100644 --- a/app/views/admin/setup.html.erb +++ b/app/views/admin/setup.html.erb @@ -1,94 +1,94 @@ -

Create New Site

- -

Welcome to your new <%= @community.name %> community!

- -

We are almost ready. We just need some more information to complete creation of the site.

- -

Don't worry. You will be able to change all these things in the site settings later.

- -<%= form_tag setup_save_url do %> - -
-
- -

Site Details

- -
- <%= label_tag :primary_color, 'Primary color', class: 'form-element' %> - Select a primary color for this site. Will be used as default for all categories. - <%= select_tag :primary_color, options_for_select(['turquoise', 'green', 'blue', 'darkblue', 'purple', 'gray', 'bluegray', 'yellow', 'orange', 'pink', 'red'], - selected: SiteSetting['SiteCategoryHeaderDefaultColor']), - class: 'form-element' %> -
- -
- <%= label_tag :logo_url, 'Site logo URL', class: 'form-element' %> - Choose a site logo for this site. Will be shown in the site header. - <%= text_field_tag :logo_url, SiteSetting['SiteLogoPath'], class: 'form-element' %> -
- -
- <%= label_tag :ad_slogan, 'Site Ad Slogan', class: 'form-element' %> - A slogan that will be shown in automatic community ads. See /ca for more info. - <%= text_field_tag :ad_slogan, SiteSetting['SiteAdSlogan'], class: 'form-element' %> -
- -
-
-
-
- -

Additional Features

- -
- <%= label_tag :mathjax, 'Enable MathJax', class: 'form-element' %> - MathJax is a library for rendering mathematic formulas. This will incur a small penalty in page loading time. - <%= select_tag :mathjax, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['MathJaxEnabled']), - class: 'form-element' %> -
- -
- <%= label_tag :syntax_highlighting, 'Enable Syntax Highlighting', class: 'form-element' %> - We support highlighting of code blocks using highlight.js. This will incur a small penalty in page loading time. - <%= select_tag :syntax_highlighting, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['SyntaxHighlightingEnabled']), - class: 'form-element' %> -
- -
-
-
-
- -

Integrations

- -
- <%= label_tag :chat_link, 'Community chat link', class: 'form-element' %> - Link to a possible community chat. Can be kept empty if not needed. - <%= text_field_tag :chat_link, SiteSetting['ChatLink'], class: 'form-element' %> -
- -
- <%= label_tag :analytics_url, 'Analytics URL', class: 'form-element' %> - Full URL to a Matomo analytics instance, with leading protocol and trailing slash. - <%= text_field_tag :analytics_url, SiteSetting['AnalyticsURL'], class: 'form-element' %> -
- -
- <%= label_tag :analytics_id, 'Analytics Site ID', class: 'form-element' %> - Site ID for this community in your Matomo analytics instance. - <%= text_field_tag :analytics_id, SiteSetting['AnalyticsSiteId'], class: 'form-element' %> -
- -
- <%= label_tag :content_transfer, 'Has content transfer?', class: 'form-element' %> - Whether this site has transferred content from an other (ex. SE) site. Will allow users to claim their content in the profile. - <%= select_tag :content_transfer, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['AllowContentTransfer']), - class: 'form-element' %> -
- -
-
- - <%= submit_tag 'Save and continue', class: 'button is-filled' %> - +

Create New Site

+ +

Welcome to your new <%= @community.name %> community!

+ +

We are almost ready. We just need some more information to complete creation of the site.

+ +

Don't worry. You will be able to change all these things in the site settings later.

+ +<%= form_tag setup_save_url do %> + +
+
+ +

Site Details

+ +
+ <%= label_tag :primary_color, 'Primary color', class: 'form-element' %> + Select a primary color for this site. Will be used as default for all categories. + <%= select_tag :primary_color, options_for_select(['turquoise', 'green', 'blue', 'darkblue', 'purple', 'gray', 'bluegray', 'yellow', 'orange', 'pink', 'red'], + selected: SiteSetting['SiteCategoryHeaderDefaultColor']), + class: 'form-element' %> +
+ +
+ <%= label_tag :logo_url, 'Site logo URL', class: 'form-element' %> + Choose a site logo for this site. Will be shown in the site header. + <%= text_field_tag :logo_url, SiteSetting['SiteLogoPath'], class: 'form-element' %> +
+ +
+ <%= label_tag :ad_slogan, 'Site Ad Slogan', class: 'form-element' %> + A slogan that will be shown in automatic community ads. See /ca for more info. + <%= text_field_tag :ad_slogan, SiteSetting['SiteAdSlogan'], class: 'form-element' %> +
+ +
+
+
+
+ +

Additional Features

+ +
+ <%= label_tag :mathjax, 'Enable MathJax', class: 'form-element' %> + MathJax is a library for rendering mathematic formulas. This will incur a small penalty in page loading time. + <%= select_tag :mathjax, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['MathJaxEnabled']), + class: 'form-element' %> +
+ +
+ <%= label_tag :syntax_highlighting, 'Enable Syntax Highlighting', class: 'form-element' %> + We support highlighting of code blocks using highlight.js. This will incur a small penalty in page loading time. + <%= select_tag :syntax_highlighting, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['SyntaxHighlightingEnabled']), + class: 'form-element' %> +
+ +
+
+
+
+ +

Integrations

+ +
+ <%= label_tag :chat_link, 'Community chat link', class: 'form-element' %> + Link to a possible community chat. Can be kept empty if not needed. + <%= text_field_tag :chat_link, SiteSetting['ChatLink'], class: 'form-element' %> +
+ +
+ <%= label_tag :analytics_url, 'Analytics URL', class: 'form-element' %> + Full URL to a Matomo analytics instance, with leading protocol and trailing slash. + <%= text_field_tag :analytics_url, SiteSetting['AnalyticsURL'], class: 'form-element' %> +
+ +
+ <%= label_tag :analytics_id, 'Analytics Site ID', class: 'form-element' %> + Site ID for this community in your Matomo analytics instance. + <%= text_field_tag :analytics_id, SiteSetting['AnalyticsSiteId'], class: 'form-element' %> +
+ +
+ <%= label_tag :content_transfer, 'Has content transfer?', class: 'form-element' %> + Whether this site has transferred content from an other (ex. SE) site. Will allow users to claim their content in the profile. + <%= select_tag :content_transfer, options_for_select([['yes', true], ['no', false]], selected: SiteSetting['AllowContentTransfer']), + class: 'form-element' %> +
+ +
+
+ + <%= submit_tag 'Save and continue', class: 'button is-filled' %> + <% end %> \ No newline at end of file diff --git a/app/views/categories/post_types.html.erb b/app/views/categories/post_types.html.erb index 3ab6bd43f..1d5a55415 100644 --- a/app/views/categories/post_types.html.erb +++ b/app/views/categories/post_types.html.erb @@ -1,7 +1,9 @@ <% header_title = @post_types.any? ? 'What kind of post?' : 'No allowed post types' - header_subtitle = @post_types.any? \ - ? 'This category has more than one type of post available. Pick a post type to get started.' - : 'This category does not have any post types available.' + header_subtitle = if @post_types.any? + 'This category has more than one type of post available. Pick a post type to get started.' + else + 'This category does not have any post types available.' + end %>

<%= header_title %>

diff --git a/app/views/close_reasons/edit.html.erb b/app/views/close_reasons/edit.html.erb index f229638fa..7c4900121 100644 --- a/app/views/close_reasons/edit.html.erb +++ b/app/views/close_reasons/edit.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, "Close Reasons" %> +<% content_for :title, 'Close Reasons' %>

Edit close reason

diff --git a/app/views/close_reasons/new.html.erb b/app/views/close_reasons/new.html.erb index 41b56d170..ad01a0ca0 100644 --- a/app/views/close_reasons/new.html.erb +++ b/app/views/close_reasons/new.html.erb @@ -1,6 +1,6 @@ -<% content_for :title, "Close Reasons" %> +<% content_for :title, 'Close Reasons' %> -

Add <%= (params[:global] == "1") ? "global" : "" %> close reason

+

Add <%= params[:global] == '1' ? 'global' : '' %> close reason

<% if @close_reason.errors.any? %>
diff --git a/app/views/comments/_reply_to_thread.html.erb b/app/views/comments/_reply_to_thread.html.erb index c21d1d6d6..5151641c0 100644 --- a/app/views/comments/_reply_to_thread.html.erb +++ b/app/views/comments/_reply_to_thread.html.erb @@ -58,6 +58,6 @@ post: thread.post_id, character_count: ".js-character-count-thread-reply-#{post.id}-#{thread.id}" } %> <%= render 'shared/char_count', type: "thread-reply-#{post.id}-#{thread.id}", min: min_chars, max: max_chars %> - <%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled:true %> + <%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled: true %> <% end %> <% end %> diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index a7282028d..48ae8e329 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,14 +1,15 @@

Resend confirmation instructions

<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email', +value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
- <%= f.submit "Resend confirmation instructions", class: 'button is-filled is-very-large' %> + <%= f.submit 'Resend confirmation instructions', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 2f793bb87..f12ccc2c1 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,23 +1,23 @@

Change your password

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %> <%= f.hidden_field :reset_password_token %>
- <%= f.label :password, "New password", class: "form-element" %> + <%= f.label :password, 'New password', class: 'form-element' %> <% if @minimum_password_length %>
(<%= @minimum_password_length %> characters minimum)
<% end %> - <%= f.password_field :password, class: 'form-element', autofocus: true, autocomplete: "new-password" %> + <%= f.password_field :password, class: 'form-element', autofocus: true, autocomplete: 'new-password' %>
- <%= f.label :password_confirmation, "Confirm new password", class: "form-element" %>
- <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: "new-password" %> + <%= f.label :password_confirmation, 'Confirm new password', class: 'form-element' %>
+ <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: 'new-password' %>
- <%= f.submit "Change my password", class: 'button is-filled is-very-large' %> + <%= f.submit 'Change my password', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 12c284a9f..e63a9ccc4 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,14 +1,14 @@

Forgot your password?

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email" %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email' %>
- <%= f.submit "Send me reset password instructions", class: 'button is-filled is-very-large' %> + <%= f.submit 'Send me reset password instructions', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 87f6b933c..a1d0425e6 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -22,11 +22,11 @@ <% end %> <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email", disabled: sso %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email', disabled: sso %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> @@ -34,29 +34,29 @@ <% end %>
- <%= f.label :current_password, class: "form-element" %> + <%= f.label :current_password, class: 'form-element' %>
We need your current password to confirm your changes.
- <%= f.password_field :current_password, class: 'form-element', autocomplete: "current-password", required: true, + <%= f.password_field :current_password, class: 'form-element', autocomplete: 'current-password', required: true, disabled: sso %>
- <%= f.label :password, "New password", class: "form-element" %> + <%= f.label :password, 'New password', class: 'form-element' %>
Leave blank if you don't want to change it. <% if @minimum_password_length %> (<%= @minimum_password_length %> characters minimum) <% end %>
- <%= f.password_field :password, class: 'form-element', autocomplete: "new-password", disabled: sso %> + <%= f.password_field :password, class: 'form-element', autocomplete: 'new-password', disabled: sso %>
- <%= f.label :password_confirmation, "Confirm new password", class: "form-element" %> - <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: "new-password", disabled: sso %> + <%= f.label :password_confirmation, 'Confirm new password', class: 'form-element' %> + <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: 'new-password', disabled: sso %>
- <%= f.submit "Update", class: 'button is-filled is-very-large', disabled: sso %> + <%= f.submit 'Update', class: 'button is-filled is-very-large', disabled: sso %> <% end %>
<% if current_user.at_least_moderator? %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 8fc1a62a7..f6f2056ed 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -3,7 +3,7 @@ <% if sso_sign_in_enabled? %>
You can also sign in with your Single Sign-On provider. - <%= link_to "SSO Sign in", new_saml_user_session_path(resource_name), class: 'button is-primary is-filled' %> + <%= link_to 'SSO Sign in', new_saml_user_session_path(resource_name), class: 'button is-primary is-filled' %>
<% end %> @@ -13,29 +13,29 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email" %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email' %>
- <%= f.label :username, class: "form-element" %> + <%= f.label :username, class: 'form-element' %> <%= f.text_field :username, class: 'form-element', autocomplete: 'off' %>
- <%= f.label :password, class: "form-element" %> + <%= f.label :password, class: 'form-element' %> <% if @minimum_password_length %>
(<%= @minimum_password_length %> characters minimum)
<% end %> - <%= f.password_field :password, class: 'form-element', autocomplete: "new-password" %> + <%= f.password_field :password, class: 'form-element', autocomplete: 'new-password' %>
- <%= f.label :password_confirmation, class: "form-element" %> - <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: "new-password" %> + <%= f.label :password_confirmation, class: 'form-element' %> + <%= f.password_field :password_confirmation, class: 'form-element', autocomplete: 'new-password' %>
@@ -50,8 +50,8 @@
- <%= f.submit "Sign up", class: "button is-filled is-very-large" %> + <%= f.submit 'Sign up', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index b6a456966..710e19528 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -3,7 +3,7 @@ <% if sso_sign_in_enabled? %>
You can also sign in with your Single Sign-On provider. - <%= link_to "SSO Sign in", new_saml_user_session_path(resource_name), class: 'button is-primary is-filled' %> + <%= link_to 'SSO Sign in', new_saml_user_session_path(resource_name), class: 'button is-primary is-filled' %>
<% end %> @@ -14,24 +14,24 @@ <%= form_for(resource, as: resource_name, url: session_path(resource_name), method: :post) do |f| %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email" %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email' %>
- <%= f.label :password, class: "form-element" %> - <%= f.password_field :password, class: 'form-element', autocomplete: "current-password" %> + <%= f.label :password, class: 'form-element' %> + <%= f.password_field :password, class: 'form-element', autocomplete: 'current-password' %>
<% if devise_mapping.rememberable? %>
- <%= f.label :remember_me, 'Stay signed in on this device', class: "form-element" %> - <%= f.check_box :remember_me, class: "form-radio-element" %> + <%= f.label :remember_me, 'Stay signed in on this device', class: 'form-element' %> + <%= f.check_box :remember_me, class: 'form-radio-element' %>
<% end %>
- <%= f.submit "Sign in", class: 'button is-filled is-very-large' %> + <%= f.submit 'Sign in', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/devise/shared/_error_messages.html.erb b/app/views/devise/shared/_error_messages.html.erb index 330ed738c..9ef86f861 100644 --- a/app/views/devise/shared/_error_messages.html.erb +++ b/app/views/devise/shared/_error_messages.html.erb @@ -1,7 +1,7 @@ <% if resource.errors.any? %>

- <%= I18n.t("errors.messages.not_saved", + <%= I18n.t('errors.messages.not_saved', count: resource.errors.count, resource: resource.class.model_name.human.downcase) %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index 15b79838a..6da8ac57c 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -1,17 +1,17 @@ <%- if controller_name != 'sessions' && devise_sign_in_enabled? %> - <%= link_to "Sign in", new_session_path(resource_name) %>
+ <%= link_to 'Sign in', new_session_path(resource_name) %>
<% end %> <%- if controller_name != 'saml_sessions' && sso_sign_in_enabled? %> - <%= link_to "SSO Sign in", new_saml_user_session_path(resource_name) %>
+ <%= link_to 'SSO Sign in', new_saml_user_session_path(resource_name) %>
<% end %> <%- if devise_mapping.registerable? && controller_name != 'registrations' && devise_sign_in_enabled? %> - <%= link_to "Sign up", new_registration_path(resource_name) %>
+ <%= link_to 'Sign up', new_registration_path(resource_name) %>
<% end %> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' && devise_sign_in_enabled? %> - <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+ <%= link_to 'Forgot your password?', new_password_path(resource_name) %>
<% end %> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' && devise_sign_in_enabled? %> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb index e575d08fd..4bc97a006 100644 --- a/app/views/devise/unlocks/new.html.erb +++ b/app/views/devise/unlocks/new.html.erb @@ -1,14 +1,14 @@

Resend unlock instructions

<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> - <%= render "devise/shared/error_messages", resource: resource %> + <%= render 'devise/shared/error_messages', resource: resource %>
- <%= f.label :email, class: "form-element" %> - <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: "email" %> + <%= f.label :email, class: 'form-element' %> + <%= f.email_field :email, class: 'form-element', autofocus: true, autocomplete: 'email' %>
- <%= f.submit "Resend unlock instructions", class: 'button is-filled is-very-large' %> + <%= f.submit 'Resend unlock instructions', class: 'button is-filled is-very-large' %> <% end %>
-<%= render "devise/shared/links" %> +<%= render 'devise/shared/links' %> diff --git a/app/views/errors/restricted_content.html.erb b/app/views/errors/restricted_content.html.erb index 1b9c5f2ea..964249ce5 100644 --- a/app/views/errors/restricted_content.html.erb +++ b/app/views/errors/restricted_content.html.erb @@ -11,10 +11,10 @@ <%= raw(sanitize(render_markdown(SiteSetting['RestrictedAccessFrontPageText']), scrubber: scrubber)) %> <%- if sso_sign_in_enabled? %> - <%= link_to "SSO Sign in", new_saml_user_session_path, class: 'button is-extremely-large is-filled' %>
+ <%= link_to 'SSO Sign in', new_saml_user_session_path, class: 'button is-extremely-large is-filled' %>
<% end %> <%- if devise_sign_in_enabled? %> - <%= link_to "Sign in", new_user_session_path, class: 'button is-extremely-large is-muted is-outlined' %>
- <%= link_to "Sign up", new_user_registration_path, class: 'button is-extremely-large is-muted is-filled' %>
+ <%= link_to 'Sign in', new_user_session_path, class: 'button is-extremely-large is-muted is-outlined' %>
+ <%= link_to 'Sign up', new_user_registration_path, class: 'button is-extremely-large is-muted is-filled' %>
<% end %> \ No newline at end of file diff --git a/app/views/fake_community/communities.html.erb b/app/views/fake_community/communities.html.erb index 6e4b704f7..4d63a5246 100644 --- a/app/views/fake_community/communities.html.erb +++ b/app/views/fake_community/communities.html.erb @@ -10,7 +10,7 @@
- <%= link_to "//#{c.host}", class: "dashboard-full-center" do %> + <%= link_to "//#{c.host}", class: 'dashboard-full-center' do %> <% unless logo_setting.nil? %> <%= c.name %> <% else %> diff --git a/app/views/flags/handled.html.erb b/app/views/flags/handled.html.erb index 9e0c3d0ed..1defa451d 100644 --- a/app/views/flags/handled.html.erb +++ b/app/views/flags/handled.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, "Handled Moderator Flags" %> +<% content_for :title, 'Handled Moderator Flags' %>

Handled Flags

The following list contains flags that have already been handled. You can't change the outcome of these any more.

diff --git a/app/views/flags/queue.html.erb b/app/views/flags/queue.html.erb index 3cee19591..cd396b1c4 100644 --- a/app/views/flags/queue.html.erb +++ b/app/views/flags/queue.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, "Moderator Flag Queue" %> +<% content_for :title, 'Moderator Flag Queue' %> <%= link_to moderator_path, class: 'has-font-size-small' do %> « Return to moderator tools <% end %> @@ -10,11 +10,11 @@
<%= link_to 'Active', flag_queue_path, - class: "button is-muted is-outlined #{current_page?(flag_queue_path) ? 'is-active' : ''}" %> + class: "button is-muted is-outlined #{'is-active' if current_page?(flag_queue_path)}" %> <%= link_to 'Handled', handled_flags_path, class: 'button is-muted is-outlined' %> <% if admin? %> <%= link_to 'Escalated', escalated_flags_path, - class: "button is-muted is-outlined #{current_page?(escalated_flags_path) ? 'is-active' : ''}" %> + class: "button is-muted is-outlined #{'is-active' if current_page?(escalated_flags_path)}" %> <% end %>
diff --git a/app/views/moderator/index.html.erb b/app/views/moderator/index.html.erb index 4924aed6f..8c17d6b83 100644 --- a/app/views/moderator/index.html.erb +++ b/app/views/moderator/index.html.erb @@ -1,7 +1,7 @@ -<% content_for :title, "Moderator Dashboard" %> +<% content_for :title, 'Moderator Dashboard' %> <% if current_user.admin? %> - <%= link_to admin_path, class: "has-font-size-small" do %> + <%= link_to admin_path, class: 'has-font-size-small' do %> Switch to Admin Tools <% end %> <% end %> diff --git a/app/views/moderator/recently_deleted_posts.html.erb b/app/views/moderator/recently_deleted_posts.html.erb index b6366d0f5..d2495fc8f 100644 --- a/app/views/moderator/recently_deleted_posts.html.erb +++ b/app/views/moderator/recently_deleted_posts.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, "Recently Deleted Posts" %> +<% content_for :title, 'Recently Deleted Posts' %> <% if current_user.at_least_moderator? %> <%= link_to moderator_path, class: 'has-font-size-small' do %> diff --git a/app/views/post_history/post.html.erb b/app/views/post_history/post.html.erb index 3444c67c9..b33c524bb 100644 --- a/app/views/post_history/post.html.erb +++ b/app/views/post_history/post.html.erb @@ -28,7 +28,7 @@
<%= event.comment %> <% end %> - <%= render 'shared/copy_link', classes: ["button", "is-small", "is-muted", "is-outlined"], + <%= render 'shared/copy_link', classes: ['button', 'is-small', 'is-muted', 'is-outlined'], desc: "Copy a permanent link to revision #{@history.size - index}", id: "#{@post.id}-#{@history.size - index}", md: post_history_share_link_md(@post, @history, index), diff --git a/app/views/post_types/_form.html.erb b/app/views/post_types/_form.html.erb index 9d23794c3..19506383a 100644 --- a/app/views/post_types/_form.html.erb +++ b/app/views/post_types/_form.html.erb @@ -31,7 +31,7 @@ Required if this post type has answers. Specify the post type that answers to this post type will be created as. <%= f.select :answer_type_id, options_for_select(PostType.mapping.to_a, selected: @type.answer_type_id), - { include_blank: true }, class: 'form-element' %> + { include_blank: true }, class: 'form-element' %>
diff --git a/app/views/posts/_edit_comment.html.erb b/app/views/posts/_edit_comment.html.erb index 80a952ccd..d4ef6eb02 100644 --- a/app/views/posts/_edit_comment.html.erb +++ b/app/views/posts/_edit_comment.html.erb @@ -21,7 +21,7 @@ nil, class: 'form-element', value: comment, - data: { character_count: ".js-character-count-edit-comment" } %> + data: { character_count: '.js-character-count-edit-comment' } %>
<%= render 'shared/char_count', type: 'edit-comment', cur: cur_length, min: min_length, max: max_length %>
diff --git a/app/views/posts/_image_upload.html.erb b/app/views/posts/_image_upload.html.erb index 810e27b87..726744127 100644 --- a/app/views/posts/_image_upload.html.erb +++ b/app/views/posts/_image_upload.html.erb @@ -8,9 +8,9 @@ <%= form_tag upload_path, multipart: true, class: 'form-inline upload-form js-upload-form' do %> <%= hidden_field_tag :authenticity_token, form_authenticity_token %>
- <%= label_tag :file, 'Insert an image', class: "form-element" %> + <%= label_tag :file, 'Insert an image', class: 'form-element' %>
Max file size <%= SiteSetting['MaxUploadSize'] %>.
- <%= file_field_tag :file, class: "form-element" %> + <%= file_field_tag :file, class: 'form-element' %>
<% end %>
diff --git a/app/views/posts/_tag_badge.html.erb b/app/views/posts/_tag_badge.html.erb index b4ccc78ba..26f4a0dab 100644 --- a/app/views/posts/_tag_badge.html.erb +++ b/app/views/posts/_tag_badge.html.erb @@ -16,4 +16,4 @@ <%= link_to tag.name, tag_url(id: post.category_id, tag_id: tag.id, host: post.community.host), class: "badge is-tag #{required} #{topic} #{mod_only}", - title: tag.excerpt.present? ? tag.excerpt : "(no description yet)" %> + title: tag.excerpt.present? ? tag.excerpt : '(no description yet)' %> diff --git a/app/views/posts/document.html.erb b/app/views/posts/document.html.erb index ba15aa9c8..7d6abf772 100644 --- a/app/views/posts/document.html.erb +++ b/app/views/posts/document.html.erb @@ -1,4 +1,4 @@ -<%= link_to help_center_path, class: "button is-muted" do %> +<%= link_to help_center_path, class: 'button is-muted' do %> « Back to help center <% end %> <% unless @post.nil? %> @@ -8,9 +8,9 @@ history_path = is_hc ? help_post_history_path(@post.doc_slug) : policy_post_history_path(@post.doc_slug) %> <% if (at_least_moderator? && is_hc) || (admin? && is_policy) %> - <%= link_to 'edit', edit_post_path(@post), class: "button is-outlined is-muted" %> + <%= link_to 'edit', edit_post_path(@post), class: 'button is-outlined is-muted' %> <% end %> - <%= link_to 'history', history_path, class: "button is-outlined is-muted" %> + <%= link_to 'history', history_path, class: 'button is-outlined is-muted' %> <% end %> <% if @post.help_category == '$Moderator' %> diff --git a/app/views/shared/_lock_notice.html.erb b/app/views/shared/_lock_notice.html.erb index e73a51741..b7c5c1edc 100644 --- a/app/views/shared/_lock_notice.html.erb +++ b/app/views/shared/_lock_notice.html.erb @@ -7,7 +7,7 @@ %> <% - #defaults + # defaults level ||= defined?(level) && !level.nil? ? level : 'error' %> diff --git a/app/views/site_settings/edit.html.erb b/app/views/site_settings/edit.html.erb index 6b8ec7b78..36d1623df 100644 --- a/app/views/site_settings/edit.html.erb +++ b/app/views/site_settings/edit.html.erb @@ -1,11 +1,11 @@ -<% content_for :title, "Edit Setting" %> +<% content_for :title, 'Edit Setting' %>

Edit Setting: <%= @setting.name %>

Current value: <%= @setting.value %>

<%= form_for @setting, url: { controller: :site_settings, action: :update } do |f| %> <% if @setting.errors.any? %>
-

<%= pluralize(@setting.errors.count, "error") %> prevented this setting from being saved:

+

<%= pluralize(@setting.errors.count, 'error') %> prevented this setting from being saved: