Add related SDG and targets tags to polls

This commit is contained in:
Javi Martín
2021-01-23 01:08:16 +01:00
committed by taitus
parent bb1315def1
commit 19bab5a9dc
4 changed files with 29 additions and 1 deletions

View File

@@ -1832,7 +1832,7 @@
padding: 0 $line-height / 2 0 0; padding: 0 $line-height / 2 0 0;
} }
img { .image-container img {
height: 100%; height: 100%;
max-width: none; max-width: none;
position: absolute; position: absolute;

View File

@@ -52,6 +52,7 @@
<li><span><%= g.name %></span></li> <li><span><%= g.name %></span></li>
<% end %> <% end %>
</ul> </ul>
<%= render SDG::TagListComponent.new(poll, limit: 5, linkable: false) %>
</div> </div>
<div class="small-12 medium-3 column table" data-equalizer-watch> <div class="small-12 medium-3 column table" data-equalizer-watch>
<div class="table-cell align-middle"> <div class="table-cell align-middle">

View File

@@ -18,6 +18,7 @@
<% end %> <% end %>
</ul> </ul>
<% end %> <% end %>
<%= render SDG::TagListComponent.new(@poll, linkable: false) %>
</div> </div>
<aside class="small-12 medium-3 column margin-top"> <aside class="small-12 medium-3 column margin-top">

View File

@@ -129,6 +129,19 @@ describe "Polls" do
expect(page).to have_link("Poll with results", href: results_poll_path(poll.slug)) expect(page).to have_link("Poll with results", href: results_poll_path(poll.slug))
end end
scenario "Shows SDG tags when feature is enabled", :js do
Setting["feature.sdg"] = true
Setting["sdg.process.polls"] = true
create(:poll, sdg_goals: [SDG::Goal[1]],
sdg_targets: [SDG::Target["1.1"]])
visit polls_path
expect(page).to have_selector "img[alt='1. No Poverty']"
expect(page).to have_content "target 1.1"
end
end end
context "Show" do context "Show" do
@@ -401,6 +414,19 @@ describe "Polls" do
expect(page).to have_link("Yes") expect(page).to have_link("Yes")
end end
end end
scenario "Shows SDG tags when feature is enabled", :js do
Setting["feature.sdg"] = true
Setting["sdg.process.polls"] = true
poll = create(:poll, sdg_goals: [SDG::Goal[1]],
sdg_targets: [SDG::Target["1.1"]])
visit poll_path(poll)
expect(page).to have_selector "img[alt='1. No Poverty']"
expect(page).to have_content "target 1.1"
end
end end
context "Booth & Website", :with_frozen_time do context "Booth & Website", :with_frozen_time do