Files
nairobi/app/components/sdg/goals/show_component.rb
Javi Martín 159edba015 Specify the SDG title uses two lines
This way translators will find a hint indicating they must use two lines
and not three or more, since the title is optimized for being displayed
in two lines.
2021-01-04 12:45:03 +01:00

27 lines
567 B
Ruby

class SDG::Goals::ShowComponent < ApplicationComponent
attr_reader :goal
delegate :back_link_to, to: :helpers
def initialize(goal)
@goal = goal
end
def feeds
SDG::Widget::Feed.for_goal(goal)
end
private
def processes_feed
feeds.find { |feed| feed.kind == "processes" }
end
def heading
safe_join([tag.span(goal.code, class: "goal-code"), tag.span(split_title, class: "goal-title")], " ")
end
def split_title
safe_join(goal.title_in_two_lines.split("\n").map { |text| tag.span(text) }, " ")
end
end