diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index daef4a5ae..85b7ca3db 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2770,7 +2770,7 @@ table { overflow: visible; a { - img { + .figure-card img { transition-duration: 0.3s; transition-property: transform; } @@ -2780,12 +2780,13 @@ table { box-shadow: 0 0 12px 0 rgba(0, 0, 0, 0.2); text-decoration: none; - img { + .figure-card img { transform: scale(1.1); } } - p { + p, + .sdg-tag-list { padding: 0 $line-height / 4; } } diff --git a/app/assets/stylesheets/widgets/feeds/participation.scss b/app/assets/stylesheets/widgets/feeds/participation.scss index 350eb9a6f..0778effc2 100644 --- a/app/assets/stylesheets/widgets/feeds/participation.scss +++ b/app/assets/stylesheets/widgets/feeds/participation.scss @@ -22,6 +22,10 @@ } } + .sdg-tag-list { + margin-top: $line-height / 2; + } + .feed-debates, .feed-proposals { @include grid-col; diff --git a/app/components/widget/feeds/debate_component.html.erb b/app/components/widget/feeds/debate_component.html.erb index ba93fa7c1..460d88d54 100644 --- a/app/components/widget/feeds/debate_component.html.erb +++ b/app/components/widget/feeds/debate_component.html.erb @@ -1,3 +1,4 @@
<%= process.summary %>
+ <%= render SDG::TagListComponent.new(process, linkable: false) %><%= t("welcome.feed.see_process") %>
<% end %> diff --git a/app/components/widget/feeds/proposal_component.html.erb b/app/components/widget/feeds/proposal_component.html.erb index b94696d51..8f683776a 100644 --- a/app/components/widget/feeds/proposal_component.html.erb +++ b/app/components/widget/feeds/proposal_component.html.erb @@ -3,6 +3,7 @@ <%= "medium-6 large-9" if proposal.image.present? %>"> <%= link_to proposal.title, url_for(proposal) %><%= proposal.summary %>
+ <%= render SDG::TagListComponent.new(proposal, limit: 5) %> <% if proposal.image.present? %> diff --git a/spec/components/widget/feeds/debate_component_spec.rb b/spec/components/widget/feeds/debate_component_spec.rb new file mode 100644 index 000000000..c0adb0785 --- /dev/null +++ b/spec/components/widget/feeds/debate_component_spec.rb @@ -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 diff --git a/spec/components/widget/feeds/process_component_spec.rb b/spec/components/widget/feeds/process_component_spec.rb new file mode 100644 index 000000000..e8de5e490 --- /dev/null +++ b/spec/components/widget/feeds/process_component_spec.rb @@ -0,0 +1,23 @@ +require "rails_helper" + +describe Widget::Feeds::ProcessComponent, type: :component do + let(:process) { create(:legislation_process, sdg_goals: [SDG::Goal[1]]) } + let(:component) { Widget::Feeds::ProcessComponent.new(process) } + + before do + Setting["feature.sdg"] = true + Setting["sdg.process.legislation"] = true + end + + it "renders a card with link" do + render_inline component + + expect(page).to have_link href: "/legislation/processes/#{process.to_param}" + end + + it "renders a plain tag list" do + render_inline component + + expect(page).to have_css("img[alt='1. No Poverty']") + end +end diff --git a/spec/components/widget/feeds/proposal_component_spec.rb b/spec/components/widget/feeds/proposal_component_spec.rb new file mode 100644 index 000000000..027efbf3e --- /dev/null +++ b/spec/components/widget/feeds/proposal_component_spec.rb @@ -0,0 +1,25 @@ +require "rails_helper" + +describe Widget::Feeds::ProposalComponent, type: :component do + let(:proposal) { create(:proposal, sdg_goals: [SDG::Goal[1]]) } + let(:component) { Widget::Feeds::ProposalComponent.new(proposal) } + + before do + Setting["feature.sdg"] = true + Setting["sdg.process.proposals"] = true + end + + it "renders a title with link" do + render_inline component + + expect(page).to have_link proposal.title, href: "/proposals/#{proposal.to_param}" + end + + it "renders a tag list" do + render_inline component + + expect(page).to have_link "1. No Poverty", + title: "See all Citizen proposals related to goal 1", + href: "/proposals?advanced_search#{CGI.escape("[goal]")}=1" + end +end