Fix icon not showing up on category page

pull/1/head
rebuilt 3 years ago
parent 0a5e970ec0
commit 10bf7177e4

@ -26,12 +26,12 @@ class CategoryPresenter
end end
def icon_class def icon_class
icon_suffix = classes[name.to_sym] icon_suffix = classes[id.to_sym]
"fas fa-#{icon_suffix}" "fas fa-#{icon_suffix}"
end end
def icon_color_class def icon_color_class
color_suffix = colors[name.to_sym] color_suffix = colors[id.to_sym]
"color-#{color_suffix}" "color-#{color_suffix}"
end end
@ -52,18 +52,18 @@ class CategoryPresenter
private private
def colors def colors
{ 'Teachers & Leadership': 'blue', { '1': 'blue',
'School Culture': 'red', '2': 'red',
'Resources': 'black', '3': 'black',
'Perceptions of Learning': 'lime', '4': 'lime',
'Community & Wellbeing': 'teal' } '5': 'teal' }
end end
def classes def classes
{ 'Teachers & Leadership': 'apple-alt', { '1': 'apple-alt',
'School Culture': 'school', '2': 'school',
'Resources': 'users-cog', '3': 'users-cog',
'Perceptions of Learning': 'graduation-cap', '4': 'graduation-cap',
'Community & Wellbeing': 'heart' } '5': 'heart' }
end end
end end

@ -11,27 +11,27 @@ describe CategoryPresenter do
end end
let(:teachers_and_leadership_presenter) do let(:teachers_and_leadership_presenter) do
category = create(:category, name: 'Teachers & Leadership') category = create(:category, name: 'Teachers & Leadership', category_id: '1')
return CategoryPresenter.new(category:) return CategoryPresenter.new(category:)
end end
let(:school_culture_presenter) do let(:school_culture_presenter) do
category = create(:category, name: 'School Culture') category = create(:category, name: 'School Culture', category_id: '2')
return CategoryPresenter.new(category:) return CategoryPresenter.new(category:)
end end
let(:resources_presenter) do let(:resources_presenter) do
category = create(:category, name: 'Resources') category = create(:category, name: 'Resources', category_id: '3')
return CategoryPresenter.new(category:) return CategoryPresenter.new(category:)
end end
let(:academic_learning_presenter) do let(:academic_learning_presenter) do
category = create(:category, name: 'Perceptions of Learning') category = create(:category, name: 'Perceptions of Learning', category_id: '4')
return CategoryPresenter.new(category:) return CategoryPresenter.new(category:)
end end
let(:community_and_wellbeing_presenter) do let(:community_and_wellbeing_presenter) do
category = create(:category, name: 'Community & Wellbeing') category = create(:category, name: 'Community & Wellbeing', category_id: '5')
return CategoryPresenter.new(category:) return CategoryPresenter.new(category:)
end end

Loading…
Cancel
Save