Add SDG content section

This commit is contained in:
Javi Martín
2020-11-11 13:16:37 +01:00
parent 2b6c9914dd
commit a42cb050a7
21 changed files with 166 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
<% provide(:title) do %>
<%= t("sdg_management.header.title") %> - <%= title %>
<% end %>
<h2><%= title %></h2>
<table>
<thead>
<tr>
<th><%= attribute_name(:code) %></th>
<th><%= attribute_name(:title) %></th>
<th><%= attribute_name(:description) %></th>
</tr>
</thead>
<tbody>
<% goals.each do |goal| %>
<tr id="<%= dom_id(goal) %>" class="goal">
<td><%= goal.code %></td>
<td><%= goal.title %></td>
<td><%= goal.description %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -0,0 +1,17 @@
class SDGManagement::Goals::IndexComponent < ApplicationComponent
attr_reader :goals
def initialize(goals)
@goals = goals
end
private
def title
SDG::Goal.model_name.human(count: 2).titleize
end
def attribute_name(attribute)
SDG::Goal.human_attribute_name(attribute)
end
end

View File

@@ -0,0 +1,5 @@
<ul class="sdg-content-menu">
<li class="<%= "is-active" if sdg? %>">
<%= link_to t("sdg_management.menu.sdg_content"), sdg_management_goals_path, class: "goals-link" %>
</li>
</ul>

View File

@@ -0,0 +1,7 @@
class SDGManagement::MenuComponent < ApplicationComponent
private
def sdg?
controller_name == "goals"
end
end