Use HTML beautifier to indent ERB files

We had inconsistent indentation in many places. Now we're fixing them
and adding a linter to our CI so we don't accidentally introduce
inconsistent indentations again.
This commit is contained in:
Javi Martín
2025-02-20 18:41:46 +01:00
parent b4b33926cf
commit b51aa31e6a
66 changed files with 574 additions and 558 deletions

View File

@@ -21,6 +21,8 @@ jobs:
run: npx stylelint app/assets/stylesheets
- name: Markdownlint
run: bundle exec mdl *.md docs/
- name: HTML Beautifier
run: find app/ -name "*.html.erb" -exec bundle exec htmlbeautifier --lint-only --keep-blank-lines 1 {} +
name: ${{ matrix.name }}
steps:
- name: Checkout code

View File

@@ -95,6 +95,7 @@ group :development do
gem "capistrano3-puma", "~> 5.2.0"
gem "erb_lint", "~> 0.9.0", require: false
gem "faraday-retry", "~> 2.2.1", require: false
gem "htmlbeautifier", "~> 1.4.3", require: false
gem "mdl", "~> 0.13.0", require: false
gem "pronto", "~> 0.11.2", require: false
gem "pronto-erb_lint", "~> 0.1.6", require: false

View File

@@ -272,6 +272,7 @@ GEM
hashery (2.1.2)
hashie (5.0.0)
highline (2.0.3)
htmlbeautifier (1.4.3)
htmlentities (4.3.4)
httparty (0.22.0)
csv
@@ -755,6 +756,7 @@ DEPENDENCIES
graphiql-rails (~> 1.8.0)
graphql (~> 2.3.18)
groupdate (~> 6.5.1)
htmlbeautifier (~> 1.4.3)
i18n-tasks (~> 0.9.37)
image_processing (~> 1.13.0)
invisible_captcha (~> 2.3.0)

View File

@@ -8,7 +8,8 @@
<div class="small-12 medium-3 column highlight padding">
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
<br><%= officer.name %>
<br>
<%= officer.name %>
<%= f.hidden_field :officer_id, value: officer.id %>
</div>

View File

@@ -30,7 +30,9 @@
<table class="investment-projects-summary">
<thead>
<tr><th colspan="2"><%= t("admin.stats.budget_balloting.votes_per_heading") %></th></tr>
<tr>
<th colspan="2"><%= t("admin.stats.budget_balloting.votes_per_heading") %></th>
</tr>
</thead>
<tbody>
@@ -49,7 +51,9 @@
<table class="investment-projects-summary user-count-by-heading">
<thead>
<tr><th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th></tr>
<tr>
<th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th>
</tr>
</thead>
<tbody>

View File

@@ -1,5 +1,6 @@
<div class="small-12 medium-4 column">
<%= tag.p(**options) do %>
<%= text %> <br><span class="number"><%= amount %></span>
<%= text %> <br>
<span class="number"><%= amount %></span>
<% end %>
</div>

View File

@@ -24,7 +24,9 @@
</div>
<div class="small-12 column">
<div class="progress-bar-placeholder"><div class="loading-bar"></div></div>
<div class="progress-bar-placeholder">
<div class="loading-bar"></div>
</div>
</div>
<hr>

View File

@@ -13,7 +13,8 @@
<h1>
<%= link_to namespace_path do %>
<%= setting["org_name"] %>
<br><small><%= namespaced_header_title %></small>
<br>
<small><%= namespaced_header_title %></small>
<% end %>
</h1>

View File

@@ -47,9 +47,7 @@
</p>
<% option.videos.each do |video| %>
<%= link_to video.title,
video.url,
rel: "nofollow" %><br>
<%= link_to video.title, video.url, rel: "nofollow" %><br>
<% end %>
</div>
<% end %>

View File

@@ -56,7 +56,9 @@
<div class="small-12 medium-3 column">
<p class="featured">
<%= t "admin.stats.show.summary.proposal_votes" %> <br>
<span class="number"><%= number_with_delimiter(@proposal_votes) %> <br></span>
<span class="number">
<%= number_with_delimiter(@proposal_votes) %> <br>
</span>
</p>
<p>
<%= t "admin.stats.show.summary.debate_votes" %> <br>

View File

@@ -3,7 +3,9 @@
<% valid_filters.each do |filter| %>
<% if current_filter == filter %>
<li class="is-active"><h2><%= t("#{i18n_namespace}.filters.#{filter}") %></h2></li>
<li class="is-active">
<h2><%= t("#{i18n_namespace}.filters.#{filter}") %></h2>
</li>
<% else %>
<li><%= link_to t("#{i18n_namespace}.filters.#{filter}"),
current_path_with_query_params(filter: filter, page: 1) %></li>

View File

@@ -15,15 +15,15 @@ describe Admin::Stats::SDG::GoalComponent do
render_inline component
expect(page).to have_text "Proposals 3"
expect(page).to have_text "Polls 2"
expect(page).to have_text "Debates 1"
expect(page).to have_text "Proposals 3", normalize_ws: true
expect(page).to have_text "Polls 2", normalize_ws: true
expect(page).to have_text "Debates 1", normalize_ws: true
expect("Current budget").to appear_before("Past year budget")
expect(page).to have_text "Investment projects sent 2"
expect(page).to have_text "Winner investment projects 0"
expect(page).to have_text "Approved amount $0"
expect(page).to have_text "Investment projects sent 1"
expect(page).to have_text "Winner investment projects 1"
expect(page).to have_text "Approved amount $1,000"
expect(page).to have_text "Investment projects sent 2", normalize_ws: true
expect(page).to have_text "Winner investment projects 0", normalize_ws: true
expect(page).to have_text "Approved amount $0", normalize_ws: true
expect(page).to have_text "Investment projects sent 1", normalize_ws: true
expect(page).to have_text "Winner investment projects 1", normalize_ws: true
expect(page).to have_text "Approved amount $1,000", normalize_ws: true
end
end