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..93a4a25d6 --- /dev/null +++ b/.erb_lint.yml @@ -0,0 +1,43 @@ +# 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/**/*' + # 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: + ErbSafety: + enabled: true + better_html_config: .better-html.yml + Rubocop: + enabled: true + 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: + 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 diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index b52fedc41..070e266d0 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -10,16 +10,37 @@ on: env: RAILS_ENV: test + RUBY_VERSION: 3.2 + +permissions: + actions: write + contents: read + issues: read + pull-requests: read jobs: + erb_lint: + name: ERB checking + runs-on: ubuntu-latest + + 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: ${{ env.RUBY_VERSION }} + bundler-cache: true + - run: bundle exec erb_lint --lint-all + rubocop: name: Rubocop checking runs-on: ubuntu-latest - strategy: - matrix: - ruby_version: [3.1, 3.2] - steps: - name: Checkout repo uses: actions/checkout@v3 @@ -30,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 @@ -51,6 +72,10 @@ jobs: tests: name: Ruby on Rails tests runs-on: ubuntu-latest + needs: + - erb_lint + - rubocop + - typescript strategy: matrix: @@ -118,6 +143,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 f1156a5da..379fbd117 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/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/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 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/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index e658ad977..266ccdee7 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -19,7 +19,7 @@ $(() => { }); -