Extract method to display a goal code and title
This is a pattern we're going to use in many places.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<% targets.group_by(&:goal).map do |goal, targets| %>
|
||||
<tr class="goal-header">
|
||||
<th id="<%= header_id(goal) %>" colspan="2" scope="colgroup">
|
||||
<%= goal.code %>. <%= goal.title %>
|
||||
<%= goal.code_and_title %>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -16,4 +16,8 @@ class SDG::Goal < ApplicationRecord
|
||||
def self.[](code)
|
||||
find_by!(code: code)
|
||||
end
|
||||
|
||||
def code_and_title
|
||||
"#{code}. #{title}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user