You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
809 B
47 lines
809 B
class CategoryPresenter
|
|
attr_reader :category
|
|
|
|
def initialize(category:, academic_year:, school:)
|
|
@category = category
|
|
@academic_year = academic_year
|
|
@school = school
|
|
end
|
|
|
|
def name
|
|
@category.name
|
|
end
|
|
|
|
def description
|
|
@category.description
|
|
end
|
|
|
|
def icon
|
|
case name
|
|
when 'Teachers & Leadership'
|
|
'apple-alt'
|
|
when 'School Culture'
|
|
'school'
|
|
when 'Resources'
|
|
'users-cog'
|
|
when 'Academic Learning'
|
|
'graduation-cap'
|
|
else 'Community & Wellbeing'
|
|
'heart'
|
|
end
|
|
end
|
|
|
|
def subcategories
|
|
@category.subcategories.map do |subcategory|
|
|
SubcategoryPresenter.new(
|
|
subcategory: subcategory,
|
|
academic_year: @academic_year,
|
|
school: @school
|
|
)
|
|
end
|
|
end
|
|
|
|
def to_model
|
|
@category
|
|
end
|
|
end
|