Skip to content

Commit 53d5adf

Browse files
committed
[TAC025] Validate HTML for initiatives public views
1 parent c612463 commit 53d5adf

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

decidim-initiatives/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="row small-up-1 smallmedium-up-2 mediumlarge-up-3 large-up-4 card-grid">
66
<% highlighted_initiatives.each do |initiative| %>
77
<div class="column">
8-
<article class="card card--initiative card--mini">
8+
<div class="card card--initiative card--mini">
99
<%= link_to decidim_initiatives.initiative_path(initiative), class: "card__link" do %>
1010
<span class="show-for-sr"><%= translated_attribute initiative.title %></span>
1111
<% end %>
@@ -14,7 +14,7 @@
1414
<span class="card__title"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
1515
<% end %>
1616
</div>
17-
</article>
17+
</div>
1818
</div>
1919
<% end %>
2020
</div>

decidim-initiatives/app/helpers/decidim/initiatives/initiatives_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module InitiativesHelper
77
def initiatives_filter_form_for(filter)
88
content_tag :div, class: "filters" do
99
form_for filter,
10+
namespace: filter_form_namespace,
1011
builder: Decidim::Initiatives::InitiativesFilterFormBuilder,
1112
url: url_for,
1213
as: :filter,
@@ -17,6 +18,15 @@ def initiatives_filter_form_for(filter)
1718
end
1819
end
1920
end
21+
22+
private
23+
24+
# Creates a unique namespace for a filter form to prevent dupliacte IDs in
25+
# the DOM when multiple filter forms are rendered with the same fields (e.g.
26+
# for desktop and mobile).
27+
def filter_form_namespace
28+
"filters_#{SecureRandom.uuid}"
29+
end
2030
end
2131
end
2232
end

decidim-initiatives/app/views/layouts/decidim/initiative_creation.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<%= render "layouts/decidim/application" do %>
22
<% if wizard_steps.first == step %>
33
<div class="wrapper">
4-
<%= yield %>
5-
</div>
4+
<%= yield %>
65
</div>
76
<% else %>
87
<div class="wrapper">

0 commit comments

Comments
 (0)