Add processes to goal view
Note the link to see all processes does not filter by goal because the legislation section does not have any search filters.
This commit is contained in:
@@ -22,4 +22,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.feed-processes {
|
||||
|
||||
.feed-content {
|
||||
@include breakpoint(medium) {
|
||||
@include grid-row-nest;
|
||||
display: flex;
|
||||
|
||||
> * {
|
||||
@include grid-column-gutter;
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,10 @@
|
||||
</article>
|
||||
|
||||
<%= render Widgets::Feeds::ParticipationComponent.new(feeds) %>
|
||||
|
||||
<% if processes_feed %>
|
||||
<div class="feeds-list">
|
||||
<%= render Widgets::Feeds::FeedComponent.new(processes_feed) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -9,4 +9,10 @@ class SDG::Goals::ShowComponent < ApplicationComponent
|
||||
def feeds
|
||||
SDG::Widget::Feed.for_goal(goal)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def processes_feed
|
||||
feeds.find { |feed| feed.kind == "processes" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ class Widgets::Feeds::FeedComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def filters
|
||||
if feed.respond_to?(:goal)
|
||||
if feed.respond_to?(:goal) && kind != "processes"
|
||||
{ advanced_search: { goal: feed.goal.code }}
|
||||
else
|
||||
{}
|
||||
|
||||
@@ -52,6 +52,14 @@ describe Widgets::Feeds::FeedComponent, type: :component do
|
||||
|
||||
expect(component.see_all_path).to eq "/legislation/processes"
|
||||
end
|
||||
|
||||
it "points to the legislation processes path for goal processes feeds" do
|
||||
component = Widgets::Feeds::FeedComponent.new(SDG::Widget::Feed.new(feed, SDG::Goal[6]))
|
||||
|
||||
render_inline component
|
||||
|
||||
expect(component.see_all_path).to eq "/legislation/processes"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,6 +40,8 @@ describe "SDG Goals", :js do
|
||||
create(:debate, title: "Hunting ground", sdg_goals: [goal])
|
||||
create(:proposal, title: "Animal farm", sdg_goals: [goal])
|
||||
create(:proposal, title: "Sea farm", sdg_goals: [SDG::Goal[14]])
|
||||
create(:legislation_process, title: "Bullfighting regulations", sdg_goals: [goal])
|
||||
create(:legislation_process, title: "Tax regulations", sdg_goals: [SDG::Goal[10]])
|
||||
end
|
||||
|
||||
scenario "shows the SDG and its related content" do
|
||||
@@ -56,6 +58,11 @@ describe "SDG Goals", :js do
|
||||
expect(page).to have_content "Hunting ground"
|
||||
expect(page).not_to have_content "Solar panels"
|
||||
end
|
||||
|
||||
within ".feed-processes" do
|
||||
expect(page).to have_content "BULLFIGHTING REGULATIONS"
|
||||
expect(page).not_to have_content "TAX REGULATIONS"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "has links to debates and proposals filtered by goal" do
|
||||
|
||||
Reference in New Issue
Block a user