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:
2
.github/workflows/linters.yml
vendored
2
.github/workflows/linters.yml
vendored
@@ -21,6 +21,8 @@ jobs:
|
|||||||
run: npx stylelint app/assets/stylesheets
|
run: npx stylelint app/assets/stylesheets
|
||||||
- name: Markdownlint
|
- name: Markdownlint
|
||||||
run: bundle exec mdl *.md docs/
|
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 }}
|
name: ${{ matrix.name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
1
Gemfile
1
Gemfile
@@ -95,6 +95,7 @@ group :development do
|
|||||||
gem "capistrano3-puma", "~> 5.2.0"
|
gem "capistrano3-puma", "~> 5.2.0"
|
||||||
gem "erb_lint", "~> 0.9.0", require: false
|
gem "erb_lint", "~> 0.9.0", require: false
|
||||||
gem "faraday-retry", "~> 2.2.1", 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 "mdl", "~> 0.13.0", require: false
|
||||||
gem "pronto", "~> 0.11.2", require: false
|
gem "pronto", "~> 0.11.2", require: false
|
||||||
gem "pronto-erb_lint", "~> 0.1.6", require: false
|
gem "pronto-erb_lint", "~> 0.1.6", require: false
|
||||||
|
|||||||
@@ -272,6 +272,7 @@ GEM
|
|||||||
hashery (2.1.2)
|
hashery (2.1.2)
|
||||||
hashie (5.0.0)
|
hashie (5.0.0)
|
||||||
highline (2.0.3)
|
highline (2.0.3)
|
||||||
|
htmlbeautifier (1.4.3)
|
||||||
htmlentities (4.3.4)
|
htmlentities (4.3.4)
|
||||||
httparty (0.22.0)
|
httparty (0.22.0)
|
||||||
csv
|
csv
|
||||||
@@ -755,6 +756,7 @@ DEPENDENCIES
|
|||||||
graphiql-rails (~> 1.8.0)
|
graphiql-rails (~> 1.8.0)
|
||||||
graphql (~> 2.3.18)
|
graphql (~> 2.3.18)
|
||||||
groupdate (~> 6.5.1)
|
groupdate (~> 6.5.1)
|
||||||
|
htmlbeautifier (~> 1.4.3)
|
||||||
i18n-tasks (~> 0.9.37)
|
i18n-tasks (~> 0.9.37)
|
||||||
image_processing (~> 1.13.0)
|
image_processing (~> 1.13.0)
|
||||||
invisible_captcha (~> 2.3.0)
|
invisible_captcha (~> 2.3.0)
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
<div class="small-12 medium-3 column highlight padding">
|
<div class="small-12 medium-3 column highlight padding">
|
||||||
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
|
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
|
||||||
<br><%= officer.name %>
|
<br>
|
||||||
|
<%= officer.name %>
|
||||||
<%= f.hidden_field :officer_id, value: officer.id %>
|
<%= f.hidden_field :officer_id, value: officer.id %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,9 @@
|
|||||||
|
|
||||||
<table class="investment-projects-summary">
|
<table class="investment-projects-summary">
|
||||||
<thead>
|
<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>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -49,7 +51,9 @@
|
|||||||
|
|
||||||
<table class="investment-projects-summary user-count-by-heading">
|
<table class="investment-projects-summary user-count-by-heading">
|
||||||
<thead>
|
<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>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="small-12 medium-4 column">
|
<div class="small-12 medium-4 column">
|
||||||
<%= tag.p(**options) do %>
|
<%= tag.p(**options) do %>
|
||||||
<%= text %> <br><span class="number"><%= amount %></span>
|
<%= text %> <br>
|
||||||
|
<span class="number"><%= amount %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 column">
|
<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>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
<h1>
|
<h1>
|
||||||
<%= link_to namespace_path do %>
|
<%= link_to namespace_path do %>
|
||||||
<%= setting["org_name"] %>
|
<%= setting["org_name"] %>
|
||||||
<br><small><%= namespaced_header_title %></small>
|
<br>
|
||||||
|
<small><%= namespaced_header_title %></small>
|
||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<% option.videos.each do |video| %>
|
<% option.videos.each do |video| %>
|
||||||
<%= link_to video.title,
|
<%= link_to video.title, video.url, rel: "nofollow" %><br>
|
||||||
video.url,
|
|
||||||
rel: "nofollow" %><br>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -56,7 +56,9 @@
|
|||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<p class="featured">
|
<p class="featured">
|
||||||
<%= t "admin.stats.show.summary.proposal_votes" %> <br>
|
<%= 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>
|
||||||
<p>
|
<p>
|
||||||
<%= t "admin.stats.show.summary.debate_votes" %> <br>
|
<%= t "admin.stats.show.summary.debate_votes" %> <br>
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
<% valid_filters.each do |filter| %>
|
<% valid_filters.each do |filter| %>
|
||||||
<% if current_filter == 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 %>
|
<% else %>
|
||||||
<li><%= link_to t("#{i18n_namespace}.filters.#{filter}"),
|
<li><%= link_to t("#{i18n_namespace}.filters.#{filter}"),
|
||||||
current_path_with_query_params(filter: filter, page: 1) %></li>
|
current_path_with_query_params(filter: filter, page: 1) %></li>
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ describe Admin::Stats::SDG::GoalComponent do
|
|||||||
|
|
||||||
render_inline component
|
render_inline component
|
||||||
|
|
||||||
expect(page).to have_text "Proposals 3"
|
expect(page).to have_text "Proposals 3", normalize_ws: true
|
||||||
expect(page).to have_text "Polls 2"
|
expect(page).to have_text "Polls 2", normalize_ws: true
|
||||||
expect(page).to have_text "Debates 1"
|
expect(page).to have_text "Debates 1", normalize_ws: true
|
||||||
expect("Current budget").to appear_before("Past year budget")
|
expect("Current budget").to appear_before("Past year budget")
|
||||||
expect(page).to have_text "Investment projects sent 2"
|
expect(page).to have_text "Investment projects sent 2", normalize_ws: true
|
||||||
expect(page).to have_text "Winner investment projects 0"
|
expect(page).to have_text "Winner investment projects 0", normalize_ws: true
|
||||||
expect(page).to have_text "Approved amount $0"
|
expect(page).to have_text "Approved amount $0", normalize_ws: true
|
||||||
expect(page).to have_text "Investment projects sent 1"
|
expect(page).to have_text "Investment projects sent 1", normalize_ws: true
|
||||||
expect(page).to have_text "Winner investment projects 1"
|
expect(page).to have_text "Winner investment projects 1", normalize_ws: true
|
||||||
expect(page).to have_text "Approved amount $1,000"
|
expect(page).to have_text "Approved amount $1,000", normalize_ws: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user