Skip to content

Commit

Permalink
Add processes to goal view
Browse files Browse the repository at this point in the history
  • Loading branch information
javierm committed Dec 21, 2020
1 parent 43797a1 commit 20a15fb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
15 changes: 15 additions & 0 deletions app/assets/stylesheets/sdg/goals/show.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,19 @@
}
}
}

.feed-processes {

.feed-content {
@include breakpoint(medium) {
@include grid-row-nest;
display: flex;

> * {
@include grid-column-gutter;
width: 50%;
}
}
}
}
}
6 changes: 6 additions & 0 deletions app/components/sdg/goals/show_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
</article>

<%= render Widgets::Feeds::ParticipationComponent.new(feeds) %>
<% if processes_feed %>
<div class="feeds-list">
<%= render Widgets::Feeds::ProcessesComponent.new(processes_feed) %>
</div>
<% end %>
</div>
4 changes: 4 additions & 0 deletions app/components/sdg/goals/show_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def feeds
SDG::Widget::Feed.for_goal(goal)
end

def processes_feed
feeds.find { |feed| feed.kind == "processes" }
end

private

def title
Expand Down
4 changes: 2 additions & 2 deletions app/components/widgets/feeds/processes_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section class="card">
<section class="card feed-processes">
<header>
<h2 class="title"><%= t("welcome.feed.most_active.#{feed.kind}") %></h2>
</header>
Expand All @@ -19,5 +19,5 @@
<% end %>
</div>

<%= link_to t("welcome.feed.see_all_processes"), legislation_processes_path, class: "float-right see-all" %>
<%= link_to t("welcome.feed.see_all_processes"), legislation_processes_path, class: "see-all" %>
</section>
7 changes: 7 additions & 0 deletions spec/system/sdg/goals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
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]])

visit sdg_goal_path(15)

Expand All @@ -54,6 +56,11 @@
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
end
end

0 comments on commit 20a15fb

Please sign in to comment.