Add cards to SDG homepage
This commit is contained in:
@@ -2748,7 +2748,8 @@ table {
|
|||||||
|
|
||||||
.home-page,
|
.home-page,
|
||||||
.custom-page,
|
.custom-page,
|
||||||
.sdg-goal-show {
|
.sdg-goal-show,
|
||||||
|
.sdg-goals-index {
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sdg-phase {
|
||||||
|
@include grid-row;
|
||||||
|
@include grid-column-gutter;
|
||||||
|
|
||||||
|
.cards-container {
|
||||||
|
@include grid-row-nest;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
<div class="sdg-goals-index">
|
<div class="sdg-goals-index">
|
||||||
<%= link_list(*goal_links, class: "sdg-goal-list") %>
|
<%= link_list(*goal_links, class: "sdg-goal-list") %>
|
||||||
|
|
||||||
|
<% phases.each do |phase| %>
|
||||||
|
<section class="sdg-phase" id="sdg_phase_<%= phase.kind %>">
|
||||||
|
<header>
|
||||||
|
<h2 class="title"><%= phase.title %></h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<%= render "shared/cards", cards: phase.cards %>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
class SDG::Goals::IndexComponent < ApplicationComponent
|
class SDG::Goals::IndexComponent < ApplicationComponent
|
||||||
attr_reader :goals
|
attr_reader :goals, :phases
|
||||||
delegate :link_list, to: :helpers
|
delegate :link_list, to: :helpers
|
||||||
|
|
||||||
def initialize(goals)
|
def initialize(goals, phases)
|
||||||
@goals = goals
|
@goals = goals
|
||||||
|
@phases = phases
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class SDG::GoalsController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@goals = @goals.order(:code)
|
@goals = @goals.order(:code)
|
||||||
|
@phases = SDG::Phase.accessible_by(current_ability).order(:kind)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<%= render SDG::Goals::IndexComponent.new(@goals) %>
|
<%= render SDG::Goals::IndexComponent.new(@goals, @phases) %>
|
||||||
|
|||||||
@@ -32,6 +32,17 @@ describe "SDG Goals", :js do
|
|||||||
|
|
||||||
expect(page).to have_current_path sdg_goal_path(7)
|
expect(page).to have_current_path sdg_goal_path(7)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "has cards for phases" do
|
||||||
|
create(:widget_card, cardable: SDG::Phase["planning"], title: "Planning card")
|
||||||
|
|
||||||
|
visit sdg_goals_path
|
||||||
|
|
||||||
|
within "#sdg_phase_planning" do
|
||||||
|
expect(page).to have_css "header", exact_text: "Planning"
|
||||||
|
expect(page).to have_content "PLANNING CARD"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Show" do
|
describe "Show" do
|
||||||
|
|||||||
Reference in New Issue
Block a user