Add SDG content section
This commit is contained in:
25
app/components/sdg_management/goals/index_component.html.erb
Normal file
25
app/components/sdg_management/goals/index_component.html.erb
Normal 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>
|
||||
17
app/components/sdg_management/goals/index_component.rb
Normal file
17
app/components/sdg_management/goals/index_component.rb
Normal 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
|
||||
5
app/components/sdg_management/menu_component.html.erb
Normal file
5
app/components/sdg_management/menu_component.html.erb
Normal 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>
|
||||
7
app/components/sdg_management/menu_component.rb
Normal file
7
app/components/sdg_management/menu_component.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class SDGManagement::MenuComponent < ApplicationComponent
|
||||
private
|
||||
|
||||
def sdg?
|
||||
controller_name == "goals"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user