Merge pull request #5892 from consuldemocracy/html_indentation

Add a linter to check indentation in ERB+HTML files
This commit is contained in:
Javi Martín
2025-03-07 17:17:30 +01:00
committed by GitHub
97 changed files with 897 additions and 983 deletions

View File

@@ -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 -e {} +
name: ${{ matrix.name }} name: ${{ matrix.name }}
steps: steps:
- name: Checkout code - name: Checkout code

View File

@@ -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

View File

@@ -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)

View File

@@ -812,7 +812,6 @@
.proposal h3 { .proposal h3 {
font-size: rem-calc(20); font-size: rem-calc(20);
margin-top: 0;
} }
} }

View File

@@ -88,15 +88,6 @@
} }
} }
.supports-container {
border-top: 1px solid $border;
@include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
}
}
.participation-not-allowed { .participation-not-allowed {
background: $warning-bg; background: $warning-bg;
color: $color-warning; color: $color-warning;
@@ -394,41 +385,53 @@
@include breakpoint(medium) { @include breakpoint(medium) {
min-height: $line-height * 15; min-height: $line-height * 15;
.with-image > .row {
display: flex;
}
} }
} }
.budget-investments-list .budget-investment, .debates-list,
.proposals-list .proposal, .proposals-list,
.legislation-proposals .proposal { .budget-investments-list,
.legislation-proposals {
@include breakpoint(medium) {
.panel { .panel {
column-gap: calc(rem-calc(map-get($grid-column-gutter, medium)) * 3 / 4);
display: flex;
flex-wrap: wrap;
> * {
flex-grow: 1;
}
&.with-image { &.with-image {
padding: 0 calc($line-height / 2) 0 0; padding-bottom: 0;
} padding-top: 0;
}
.column:first-child { .panel-image {
overflow: hidden; margin-#{$global-left}: rem-calc(-12);
} text-align: center;
.column:nth-child(2) { ~ * {
float: left;
}
.column:last-child:not(:first-child) {
padding-top: calc($line-height / 2); padding-top: calc($line-height / 2);
} }
}
img { img {
height: 100%; height: 100%;
max-width: 12rem; }
}
.debate-content,
.budget-investment-content,
.proposal-content {
flex-basis: calc((35rem - 100%) * 999);
flex-grow: 1000;
max-width: 50rem;
+ * {
flex-basis: 22.5%;
flex-shrink: 0;
text-align: center;
}
} }
} }
} }
@@ -592,27 +595,19 @@
.legislation-proposals { .legislation-proposals {
.votes { .votes {
border-top: 1px solid $border;
margin-top: $line-height; margin-top: $line-height;
padding: calc($line-height / 2) 0; padding: calc($line-height / 2) 0;
position: relative; position: relative;
@include breakpoint(medium) { @include breakpoint(medium) {
border-left: 1px solid $border;
border-top: 0;
margin-top: 0; margin-top: 0;
text-align: center; text-align: center;
} }
.total-votes { .total-votes {
float: right; display: block;
font-weight: bold; font-weight: bold;
line-height: $line-height * 2; line-height: $line-height * 2;
@include breakpoint(medium) {
display: block;
float: none;
}
} }
} }
} }
@@ -624,12 +619,6 @@
} }
} }
.proposal-show .votes,
.debate-show .votes {
border: 0;
padding: calc($line-height / 2) 0;
}
.proposal, .proposal,
.budget-investment { .budget-investment {

View File

@@ -1,9 +1,5 @@
.in-favor-against { .in-favor-against {
@include flex-with-gap($line-height * 0.25);
@include breakpoint(medium) {
@include flex-with-gap($line-height * 0.75); @include flex-with-gap($line-height * 0.75);
}
&, &,
.in-favor, .in-favor,
@@ -77,16 +73,8 @@
} }
.percentage { .percentage {
display: inline-block;
font-size: $small-font-size;
line-height: $line-height * 2;
padding-right: calc($line-height / 2);
vertical-align: top;
@include breakpoint(medium) {
display: block; display: block;
font-size: $small-font-size;
line-height: $line-height; line-height: $line-height;
padding-right: 0;
}
} }
} }

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -9,7 +9,7 @@
</h2> </h2>
<p class="confirmed"> <p class="confirmed">
<%= t("budgets.ballots.show.voted_info") %> <%= t("budgets.ballots.show.voted_info") %>
<p> </p>
<p><%= t("budgets.ballots.show.voted_info_2") %></p> <p><%= t("budgets.ballots.show.voted_info_2") %></p>
</div> </div>
</header> </header>

View File

@@ -1,9 +1,4 @@
<% if budget.image.present? %> <div <%= tag.attributes(html_attributes) %>>
<div class="budget-header with-background-image"
style="<%= attached_background_css polymorphic_path(budget.image.variant(:large)) %>">
<% else %>
<div class="budget-header">
<% end %>
<div class="row"> <div class="row">
<div class="small-12 column text-center"> <div class="small-12 column text-center">
<span class="budget-title"><%= t("budgets.index.title") %></span> <span class="budget-title"><%= t("budgets.index.title") %></span>

View File

@@ -5,4 +5,17 @@ class Budgets::BudgetComponent < ApplicationComponent
def initialize(budget) def initialize(budget)
@budget = budget @budget = budget
end end
private
def html_attributes
if budget.image.present?
{
class: "budget-header with-background-image",
style: attached_background_css(polymorphic_path(budget.image.variant(:large)))
}
else
{ class: "budget-header" }
end
end
end end

View File

@@ -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>

View File

@@ -9,7 +9,7 @@
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</header> </header>
<p><%= t("cookies_management.description") %><p> <p><%= t("cookies_management.description") %></p>
<% if more_info_link.present? %> <% if more_info_link.present? %>
<p><%= link_to t("cookies_consent.more_info_link"), more_info_link, target: "_blank" %></p> <p><%= link_to t("cookies_consent.more_info_link"), more_info_link, target: "_blank" %></p>
<% end %> <% end %>

View File

@@ -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 %>

View File

@@ -17,8 +17,8 @@
<% else %> <% else %>
<dl> <dl>
<% targets.sort.each do |target| %> <% targets.sort.each do |target| %>
<dt><%= target.code %><dt> <dt><%= target.code %></dt>
<dd><%= target.long_title %><dd> <dd><%= target.long_title %></dd>
<% end %> <% end %>
</dl> </dl>
<% end %> <% end %>

View File

@@ -18,13 +18,13 @@ module LegislationHelper
} }
end end
def banner_color? def banner_color?(process)
@process.background_color.present? && @process.font_color.present? process.background_color.present? && process.font_color.present?
end end
def css_for_process_header def css_for_process_header(process)
if banner_color? if banner_color?(process)
"background: #{@process.background_color};color: #{@process.font_color};" "background: #{process.background_color};color: #{process.font_color};"
end end
end end
end end

View File

@@ -64,22 +64,6 @@ module ProposalsHelper
proposals_current_view == "default" ? "minimal" : "default" proposals_current_view == "default" ? "minimal" : "default"
end end
def css_for_proposal_info_row(proposal)
if proposal.image.present?
if params[:selected].present?
"small-12 medium-9 column"
else
"small-12 medium-6 large-7 column"
end
else
if params[:selected].present?
"small-12 column"
else
"small-12 medium-9 column"
end
end
end
def show_proposal_votes? def show_proposal_votes?
params[:selected].blank? params[:selected].blank?
end end

View File

@@ -44,6 +44,7 @@
<br> <br>
<%= sanitize(activity.actionable.description) %> <%= sanitize(activity.actionable.description) %>
<% end %> <% end %>
</td>
<td class="align-top"> <td class="align-top">
<%= activity.user.name %> (<%= activity.user.email %>) <%= activity.user.name %> (<%= activity.user.email %>)
</td> </td>

View File

@@ -22,6 +22,7 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
</tbody>
</table> </table>
<% else %> <% else %>
<div class="callout alert margin"> <div class="callout alert margin">

View File

@@ -37,7 +37,7 @@
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
<table> </table>
<% else %> <% else %>
<div class="callout primary"> <div class="callout primary">
<%= t("admin.documents.index.no_documents") %> <%= t("admin.documents.index.no_documents") %>

View File

@@ -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>

View File

@@ -2,19 +2,12 @@
<div class="panel <%= ("with-image" if feature?(:allow_images) && investment.image.present?) %>"> <div class="panel <%= ("with-image" if feature?(:allow_images) && investment.image.present?) %>">
<% if feature?(:allow_images) && investment.image.present? %> <% if feature?(:allow_images) && investment.image.present? %>
<div class="row"> <div class="panel-image">
<div class="small-12 medium-3 large-2 column text-center">
<%= image_tag investment.image.variant(:thumb), alt: investment.image.title.unicode_normalize %> <%= image_tag investment.image.variant(:thumb), alt: investment.image.title.unicode_normalize %>
</div> </div>
<div class="small-12 medium-6 large-7 column">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %> <% end %>
<div class="budget-investment-content">
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), "index", investment, investment.author] do %> <% cache [locale_and_user_status(investment), "index", investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3> <h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
@@ -27,18 +20,14 @@
<%= render "shared/tags", taggable: investment, limit: 5 %> <%= render "shared/tags", taggable: investment, limit: 5 %>
<% end %> <% end %>
</div> </div>
</div>
<% unless investment.unfeasible? %> <% unless investment.unfeasible? %>
<% if investment.should_show_votes? %> <% if investment.should_show_votes? %>
<div id="<%= dom_id(investment) %>_votes" <div id="<%= dom_id(investment) %>_votes">
class="small-12 medium-3 column text-center">
<%= render Budgets::Investments::VotesComponent.new(investment) %> <%= render Budgets::Investments::VotesComponent.new(investment) %>
</div> </div>
<% elsif investment.should_show_vote_count? %> <% elsif investment.should_show_vote_count? %>
<div id="<%= dom_id(investment) %>_votes" <div id="<%= dom_id(investment) %>_votes">
class="small-12 medium-3 column text-center">
<div class="supports"> <div class="supports">
<span class="total-supports no-button"> <span class="total-supports no-button">
<%= t("budgets.investments.investment.supports", <%= t("budgets.investments.investment.supports",
@@ -47,16 +36,14 @@
</div> </div>
</div> </div>
<% elsif investment.should_show_ballots? && !management_controller? %> <% elsif investment.should_show_ballots? && !management_controller? %>
<div id="<%= dom_id(investment) %>_ballot" <div id="<%= dom_id(investment) %>_ballot">
class="small-12 medium-3 column text-center">
<%= render "/budgets/investments/ballot", <%= render "/budgets/investments/ballot",
investment: investment, investment: investment,
investment_ids: investment_ids, investment_ids: investment_ids,
ballot: ballot %> ballot: ballot %>
</div> </div>
<% elsif investment.should_show_price? %> <% elsif investment.should_show_price? %>
<div id="<%= dom_id(investment) %>_price" <div id="<%= dom_id(investment) %>_price" class="supports">
class="supports small-12 medium-3 column text-center">
<div class="supports"> <div class="supports">
<span class="total-supports no-button"> <span class="total-supports no-button">
<%= investment.formatted_price %> <%= investment.formatted_price %>
@@ -67,4 +54,3 @@
<% end %> <% end %>
</div> </div>
</div> </div>
</div>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(investment) %>" class="budget-investment minimal clear"> <div id="<%= dom_id(investment) %>" class="budget-investment minimal clear">
<div class="panel"> <div class="panel">
<div class="row">
<div class="small-12 column">
<div class="budget-investment-content"> <div class="budget-investment-content">
<% cache [locale_and_user_status(investment), "index_minimal", investment, investment.author] do %> <% cache [locale_and_user_status(investment), "index_minimal", investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3> <h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
@@ -9,5 +7,3 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>

View File

@@ -1,9 +1,6 @@
<% cache [locale_and_user_status, debate, current_user&.voted_as_when_voted_for(debate)] do %> <% cache [locale_and_user_status, debate, current_user&.voted_as_when_voted_for(debate)] do %>
<div id="<%= dom_id(debate) %>" class="debate clear" data-type="debate"> <div id="<%= dom_id(debate) %>" class="debate clear" data-type="debate">
<div class="panel"> <div class="panel">
<div class="row">
<div class="small-12 medium-9 column">
<div class="debate-content"> <div class="debate-content">
<h3><%= link_to debate.title, debate %></h3> <h3><%= link_to debate.title, debate %></h3>
<p class="debate-info"> <p class="debate-info">
@@ -46,13 +43,10 @@
</div> </div>
<%= render "shared/tags", taggable: debate, limit: 5 %> <%= render "shared/tags", taggable: debate, limit: 5 %>
</div> </div>
</div>
<div id="<%= dom_id(debate) %>_votes" class="small-12 medium-3 column"> <div id="<%= dom_id(debate) %>_votes">
<%= render Debates::VotesComponent.new(debate) %> <%= render Debates::VotesComponent.new(debate) %>
</div> </div>
</div>
</div> </div>
</div> </div>
<% end %> <% end %>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(debate) %>" class="debate minimal clear" data-type="debate"> <div id="<%= dom_id(debate) %>" class="debate minimal clear" data-type="debate">
<div class="panel"> <div class="panel">
<div class="row">
<div class="small-12 column">
<div class="debate-content"> <div class="debate-content">
<% cache [locale_and_user_status, <% cache [locale_and_user_status,
"index_minimal", debate, current_user&.voted_as_when_voted_for(debate)] do %> "index_minimal", debate, current_user&.voted_as_when_voted_for(debate)] do %>
@@ -10,5 +8,3 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>

View File

@@ -69,7 +69,6 @@
<p><%= t("debates.index.section_footer.help_text_1") %></p> <p><%= t("debates.index.section_footer.help_text_1") %></p>
<p><%= sanitize(t("debates.index.section_footer.help_text_2", <p><%= sanitize(t("debates.index.section_footer.help_text_2",
org: link_to(setting["org_name"], new_user_registration_path))) %></p> org: link_to(setting["org_name"], new_user_registration_path))) %></p>
</p>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@@ -2,9 +2,9 @@
<%= form_for(resource, as: resource_name, url: [resource_name, :password_expired], html: { method: :put }) do |f| %> <%= form_for(resource, as: resource_name, url: [resource_name, :password_expired], html: { method: :put }) do |f| %>
<%= f.password_field :current_password %></p> <%= f.password_field :current_password %>
<%= f.password_field :password, label: t("devise.password_expired.new_password") %></p> <%= f.password_field :password, label: t("devise.password_expired.new_password") %>
<%= f.password_field :password_confirmation %></p> <%= f.password_field :password_confirmation %>
<p><%= f.submit t("devise.password_expired.change_password") %></p> <p><%= f.submit t("devise.password_expired.change_password") %></p>
<% end %> <% end %>

View File

@@ -3,20 +3,6 @@
<%= link_to t("devise_views.shared.links.login"), new_session_path(resource_name) %><br> <%= link_to t("devise_views.shared.links.login"), new_session_path(resource_name) %><br>
<% end -%> <% end -%>
<%#- if devise_mapping.registerable? &&
controller_name != "registrations" ||
controller_path != "users/registrations" %>
<%#= link_to t("devise_views.shared.links.signup"), new_user_registration_path %><!-- <br> -->
<%# end -%>
<%#- if devise_mapping.registerable? && controller_name == "registrations" && controller_path != "organizations/registrations" %>
<%#= link_to t("devise_views.shared.links.organization_signup"), new_organization_registration_path %>
<%# end -%>
<%#- if devise_mapping.recoverable? && controller_name != "passwords" && controller_name != "registrations" %>
<%#= link_to t("devise_views.shared.links.new_password"), new_password_path(resource_name) %><!-- <br> -->
<%# end -%>
<%- if devise_mapping.confirmable? && controller_name != "confirmations" %> <%- if devise_mapping.confirmable? && controller_name != "confirmations" %>
<%= link_to t("devise_views.shared.links.new_confirmation"), new_confirmation_path(resource_name) %><br> <%= link_to t("devise_views.shared.links.new_confirmation"), new_confirmation_path(resource_name) %><br>
<% end -%> <% end -%>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html <%= common_html_attributes %>> <html <%= common_html_attributes %> id="mailer_layout">
<head> <head>
<title><%= t("mailers.title") %></title> <title><%= t("mailers.title") %></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">

View File

@@ -2,4 +2,4 @@
<span id="annotation-link" data-sub-annotation-ids="8"> <span id="annotation-link" data-sub-annotation-ids="8">
<%= render "annotation_link", annotation: annotation %> <%= render "annotation_link", annotation: annotation %>
<span> </span>

View File

@@ -58,14 +58,14 @@
<div><span class="panel-title"><%= t("legislation.draft_versions.show.text_body") %></span></div> <div><span class="panel-title"><%= t("legislation.draft_versions.show.text_body") %></span></div>
</div> </div>
<div id="sticky-panel" class="draft-text"> <div id="sticky-panel" class="draft-text">
<% if @draft_version.final_version? %> <section <%= tag.attributes(
<section> class: "legislation-annotatable",
<% else %> data: {
<section class="legislation-annotatable" "legislation-draft-version-id": @draft_version.id,
data-legislation-draft-version-id="<%= @draft_version.id %>" "legislation-annotatable-base-url": legislation_process_draft_version_path(@process, @draft_version),
data-legislation-annotatable-base-url="<%= legislation_process_draft_version_path(@process, @draft_version) %>" "legislation-open-phase": @process.allegations_phase.open?
data-legislation-open-phase="<%= @process.allegations_phase.open? %>"> }
<% end %> ) unless @draft_version.final_version? %>>
<%= AdminLegislationSanitizer.new.sanitize(@draft_version.body_html) %> <%= AdminLegislationSanitizer.new.sanitize(@draft_version.body_html) %>
</section> </section>
</div> </div>

View File

@@ -1,8 +1,8 @@
<div class="legislation-hero jumbo" style="<%= css_for_process_header %>"> <div class="legislation-hero jumbo" style="<%= css_for_process_header(@process) %>">
<div class="row"> <div class="row">
<div class="small-12 medium-9 column"> <div class="small-12 medium-9 column">
<% if banner_color? %> <% if banner_color?(@process) %>
<%= link_to t("shared.back"), <%= link_to t("shared.back"),
legislation_processes_path, legislation_processes_path,
class: "icon-angle-left", class: "icon-angle-left",

View File

@@ -12,10 +12,7 @@
<%= markdown @process.additional_info if @process.additional_info %> <%= markdown @process.additional_info if @process.additional_info %>
</div> </div>
<button type="button" class="button" data-toggle="additional_info" <button type="button" class="button" data-toggle="additional_info" style="<%= css_for_process_header(process) %>">
<% if banner_color? %>
style="background:<%= process.font_color %>; color:<%= process.background_color %>;"
<% end %>>
<%= t("legislation.processes.header.additional_info") %> <%= t("legislation.processes.header.additional_info") %>
</button> </button>
<% end %> <% end %>

View File

@@ -2,19 +2,17 @@
class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>" class="proposal clear <%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
data-type="proposal"> data-type="proposal">
<div class="panel <%= ("with-image" if proposal.image.present?) %>"> <div class="panel <%= ("with-image" if proposal.image.present?) %>">
<% if proposal.total_votes > Proposal.votes_needed_for_success %>
<div class="icon-successful"></div> <div class="icon-successful"></div>
<% end %>
<% if proposal.image.present? %> <% if proposal.image.present? %>
<div class="row"> <div class="panel-image">
<div class="small-12 medium-3 large-2 column text-center">
<%= image_tag proposal.image.variant(:thumb), <%= image_tag proposal.image.variant(:thumb),
alt: proposal.image.title.unicode_normalize %> alt: proposal.image.title.unicode_normalize %>
</div> </div>
<div class="small-12 medium-6 large-7 column margin-top">
<% else %>
<div class="row">
<div class="small-12 medium-9 column">
<% end %> <% end %>
<div class="proposal-content"> <div class="proposal-content">
<% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %> <% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %>
<h3><%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %></h3> <h3><%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %></h3>
@@ -69,11 +67,9 @@
<%= render "shared/tags", taggable: proposal, limit: 5 %> <%= render "shared/tags", taggable: proposal, limit: 5 %>
<% end %> <% end %>
</div> </div>
</div>
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column"> <div id="<%= dom_id(proposal) %>_votes">
<%= render Legislation::Proposals::VotesComponent.new(proposal) %> <%= render Legislation::Proposals::VotesComponent.new(proposal) %>
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@@ -13,14 +13,14 @@
<%= link_to legislation_process_question_path(@process, @question.next_question_id), class: "quiz-next-link" do %> <%= link_to legislation_process_question_path(@process, @question.next_question_id), class: "quiz-next-link" do %>
<div class="quiz-next"> <div class="quiz-next">
<%= t("legislation.questions.show.next_question") %> <%= t("legislation.questions.show.next_question") %>
<span class="icon-angle-right" aria-hidden="true"> <span class="icon-angle-right" aria-hidden="true"></span>
</div> </div>
<% end %> <% end %>
<% elsif @question.first_question_id %> <% elsif @question.first_question_id %>
<%= link_to legislation_process_question_path(@process, @question.first_question_id), class: "quiz-next-link" do %> <%= link_to legislation_process_question_path(@process, @question.first_question_id), class: "quiz-next-link" do %>
<div class="quiz-next"> <div class="quiz-next">
<%= t("legislation.questions.show.first_question") %> <%= t("legislation.questions.show.first_question") %>
<span class="icon-angle-right" aria-hidden="true"> <span class="icon-angle-right" aria-hidden="true"></span>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -1,22 +1,18 @@
<div id="<%= dom_id(proposal) %>" <div id="<%= dom_id(proposal) %>"
class="proposal clear class="proposal clear <%= ("successful" if proposal.successful?) %>"
<%= ("successful" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
data-type="proposal"> data-type="proposal">
<div class="panel <%= "with-image" if proposal.image.present? %>"> <div class="panel <%= "with-image" if proposal.image.present? %>">
<% if proposal.successful? %>
<div class="icon-successful"></div> <div class="icon-successful"></div>
<% end %>
<% if proposal.image.present? %> <% if proposal.image.present? %>
<div class="row"> <div class="panel-image">
<div class="small-12 medium-3 large-2 column text-center">
<%= image_tag proposal.image.variant(:thumb), <%= image_tag proposal.image.variant(:thumb),
alt: proposal.image.title.unicode_normalize %> alt: proposal.image.title.unicode_normalize %>
</div> </div>
<div class="<%= css_for_proposal_info_row(proposal) %>">
<% else %>
<div class="row">
<div class="<%= css_for_proposal_info_row(proposal) %>">
<% end %> <% end %>
<div class="proposal-content"> <div class="proposal-content">
<% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %> <% cache [locale_and_user_status(proposal), "index", proposal, proposal.author] do %>
<h3><%= link_to proposal.title, namespaced_proposal_path(proposal) %></h3> <h3><%= link_to proposal.title, namespaced_proposal_path(proposal) %></h3>
@@ -67,19 +63,17 @@
<%= render "shared/tags", taggable: proposal, limit: 5 %> <%= render "shared/tags", taggable: proposal, limit: 5 %>
<% end %> <% end %>
</div> </div>
</div>
<% if show_proposal_votes? %> <% if show_proposal_votes? %>
<div id="<%= dom_id(proposal) %>_votes" <div id="<%= dom_id(proposal) %>_votes" class="supports-container">
class="small-12 medium-3 column supports-container">
<% if proposal.successful? %> <% if proposal.successful? %>
<div class="padding"> <div class="padding">
<div class="supports text-center"> <div class="supports">
<%= render "proposals/supports", proposal: proposal %> <%= render "proposals/supports", proposal: proposal %>
</div> </div>
</div> </div>
<% elsif proposal.archived? %> <% elsif proposal.archived? %>
<div class="padding text-center"> <div class="padding">
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong> <strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
<p><%= t("proposals.proposal.archived") %></p> <p><%= t("proposals.proposal.archived") %></p>
</div> </div>
@@ -88,7 +82,5 @@
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
</div>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,5 @@
<div id="<%= dom_id(proposal) %>" class="proposal minimal clear" data-type="proposal"> <div id="<%= dom_id(proposal) %>" class="proposal minimal clear" data-type="proposal">
<div class="panel"> <div class="panel">
<div class="row">
<div class="small-12 column">
<div class="proposal-content"> <div class="proposal-content">
<% cache [locale_and_user_status(proposal), <% cache [locale_and_user_status(proposal),
"index_minimal", proposal, proposal.author] do %> "index_minimal", proposal, proposal.author] do %>
@@ -10,5 +8,3 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>

View File

@@ -8,12 +8,7 @@
<%= render "shared/canonical", href: proposals_url %> <%= render "shared/canonical", href: proposals_url %>
<% end %> <% end %>
<% if [ <% if [@search_terms, @advanced_search_terms, params[:retired].present?, params[:selected].present?].any? %>
@search_terms,
@advanced_search_terms,
params[:retired].present?,
params[:selected].present?
].any? %>
<%= render Shared::SearchResultsSummaryComponent.new( <%= render Shared::SearchResultsSummaryComponent.new(
results: @proposals, results: @proposals,
search_terms: @search_terms, search_terms: @search_terms,

View File

@@ -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>

View File

@@ -17,11 +17,6 @@
<hr> <hr>
<%= render "/budgets/investments/investment_detail", investment: @investment, preview: true %> <%= render "/budgets/investments/investment_detail", investment: @investment, preview: true %>
</hr>
<% if @investment.external_url.present? %>
<p><%= sanitize_and_auto_link @investment.external_url %></p>
<% end %>
<hr> <hr>

View File

@@ -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

View File

@@ -9,23 +9,23 @@ describe LegislationHelper do
describe "banner colors presence" do describe "banner colors presence" do
it "background and font color exist" do it "background and font color exist" do
@process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff") process = build(:legislation_process, background_color: "#944949", font_color: "#ffffff")
expect(banner_color?).to be true expect(banner_color?(process)).to be true
end end
it "background color exist and font color not exist" do it "background color exist and font color not exist" do
@process = build(:legislation_process, background_color: "#944949", font_color: "") process = build(:legislation_process, background_color: "#944949", font_color: "")
expect(banner_color?).to be false expect(banner_color?(process)).to be false
end end
it "background color not exist and font color exist" do it "background color not exist and font color exist" do
@process = build(:legislation_process, background_color: "", font_color: "#944949") process = build(:legislation_process, background_color: "", font_color: "#944949")
expect(banner_color?).to be false expect(banner_color?(process)).to be false
end end
it "background and font color not exist" do it "background and font color not exist" do
@process = build(:legislation_process, background_color: "", font_color: "") process = build(:legislation_process, background_color: "", font_color: "")
expect(banner_color?).to be false expect(banner_color?(process)).to be false
end end
end end
end end