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
|
||||
- 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
|
||||
|
||||
1
Gemfile
1
Gemfile
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title, t("budgets.executions.page_title", budget: @budget.name) %>
|
||||
<% content_for :meta_description do %><%= @budget.description_for_phase("finished") %><% end %>
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: budget_executions_url(@budget),
|
||||
social_title: @budget.name,
|
||||
social_description: @budget.description_for_phase("finished") %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: budget_investments_path(investment),
|
||||
social_title: investment.title,
|
||||
social_description: investment.description,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
|
||||
<% content_for :meta_description do %><%= @budget.description_for_phase("finished") %><% end %>
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: budget_results_url(@budget),
|
||||
social_title: @budget.name,
|
||||
social_description: @budget.description_for_phase("finished") %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% provide :title, t("stats.budgets.page_title", budget: @budget.name) %>
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: budget_stats_url(@budget),
|
||||
social_title: @budget.name,
|
||||
social_description: @budget.description_for_phase("finished") %>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html <%= common_html_attributes %>>
|
||||
<head>
|
||||
<head>
|
||||
<title><%= t("mailers.title") %></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0,maximum-scale=10.0" />
|
||||
</head>
|
||||
<body style="background: #fff; font-family:font-family: 'Open Sans','Helvetica Neue',arial,sans-serif !important; margin: 0 10px; padding: 0; text-align: left;">
|
||||
</head>
|
||||
<body style="background: #fff; font-family:font-family: 'Open Sans','Helvetica Neue',arial,sans-serif !important; margin: 0 10px; padding: 0; text-align: left;">
|
||||
|
||||
<%= render "layouts/mailer_header" %>
|
||||
|
||||
@@ -18,5 +18,5 @@
|
||||
</table>
|
||||
|
||||
<%= render "layouts/mailer_footer" %>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title, @proposal.title %>
|
||||
<% content_for :meta_description do %><%= @proposal.summary %><% end %>
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: legislation_process_proposal_url(process_id: @process),
|
||||
social_title: @proposal.title,
|
||||
social_description: @proposal.summary %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% provide :title, t("devise_views.organizations.registrations.new.title") %>
|
||||
<h2><%= t("devise_views.organizations.registrations.new.title") %></h2>
|
||||
|
||||
<%= form_for(resource, as: :user, url: organization_registration_path) do |f| %>
|
||||
<%= form_for(resource, as: :user, url: organization_registration_path) do |f| %>
|
||||
<%= render "shared/errors", resource: resource %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% provide :title, @proposal.title %>
|
||||
<% provide :social_media_meta_tags do %>
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
<%= render "shared/social_media_meta_tags",
|
||||
social_url: proposal_url(@proposal),
|
||||
social_title: @proposal.title,
|
||||
social_description: @proposal.summary %>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user