Add tag list component to debate feed

This commit is contained in:
taitus
2021-01-30 11:52:40 +01:00
parent 60f3cc8cf9
commit edbef4fd88
4 changed files with 32 additions and 1 deletions

View File

@@ -2785,7 +2785,8 @@ table {
}
}
p {
p,
.sdg-tag-list {
padding: 0 $line-height / 4;
}
}

View File

@@ -22,6 +22,10 @@
}
}
.sdg-tag-list {
margin-top: $line-height / 2;
}
.feed-debates,
.feed-proposals {
@include grid-col;

View File

@@ -1,3 +1,4 @@
<div class="debate">
<strong><%= link_to debate.title, url_for(debate) %></strong>
<%= render SDG::TagListComponent.new(debate, limit: 5) %>
</div>

View File

@@ -0,0 +1,25 @@
require "rails_helper"
describe Widget::Feeds::DebateComponent, type: :component do
let(:debate) { create(:debate, sdg_goals: [SDG::Goal[1]]) }
let(:component) { Widget::Feeds::DebateComponent.new(debate) }
before do
Setting["feature.sdg"] = true
Setting["sdg.process.debates"] = true
end
it "renders a title with link" do
render_inline component
expect(page).to have_link debate.title, href: "/debates/#{debate.to_param}"
end
it "renders a tag list" do
render_inline component
expect(page).to have_link "1. No Poverty",
title: "See all Debates related to goal 1",
href: "/debates?advanced_search#{CGI.escape("[goal]")}=1"
end
end