From fc5482a30a9756eea25f312a09b6056152c9c317 Mon Sep 17 00:00:00 2001 From: hellekin Date: Fri, 22 Jan 2021 18:17:38 +0100 Subject: Fix category styles Make category style independent of database ID to prevent bad surprises between development and production. Instead we use the rank. --- app/assets/stylesheets/taxonomies.scss | 24 ++++++++++++------------ app/helpers/taxonomies/filter_helper.rb | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/taxonomies.scss b/app/assets/stylesheets/taxonomies.scss index 903418e..1f3d6ea 100644 --- a/app/assets/stylesheets/taxonomies.scss +++ b/app/assets/stylesheets/taxonomies.scss @@ -76,16 +76,16 @@ button[data-action="taxonomy#toggle"] { } } - #category-30 { background-color: #BCBCBC; } /* #BCBCBC */ - #category-31 { background-color: #95a5a6; } /* #FF9200 */ - #category-32 { background-color: #848482; } /* #FFEB00 */ - #category-33 { background-color: #948279; } /* #7CFB80 */ - #category-34 { background-color: #59706a; } /* #16A085 */ - #category-35 { background-color: #16a085; } /* #97C000 */ - #category-36 { background-color: #27ae60; } /* #C6B117 */ - #category-37 { background-color: #2980b9; } /* #7E8AE0 */ - #category-38 { background-color: #34495e; } /* #677362 */ - #category-39 { background-color: #bd3525; } - #category-40 { background-color: #d35400; } /* #948279 */ - #category-42 { background-color: #eead0e; } /* #EEAD0E */ + #category-1 { background-color: #BCBCBC; } /* #BCBCBC */ + #category-2 { background-color: #95a5a6; } /* #FF9200 */ + #category-3 { background-color: #848482; } /* #FFEB00 */ + #category-4 { background-color: #948279; } /* #7CFB80 */ + #category-5 { background-color: #59706a; } /* #16A085 */ + #category-6 { background-color: #16a085; } /* #97C000 */ + #category-7 { background-color: #27ae60; } /* #C6B117 */ + #category-8 { background-color: #2980b9; } /* #7E8AE0 */ + #category-9 { background-color: #34495e; } /* #677362 */ + #category-10 { background-color: #bd3525; } + #category-11 { background-color: #d35400; } /* #948279 */ + #category-12 { background-color: #eead0e; } /* #EEAD0E */ } diff --git a/app/helpers/taxonomies/filter_helper.rb b/app/helpers/taxonomies/filter_helper.rb index 92a501f..486fe56 100644 --- a/app/helpers/taxonomies/filter_helper.rb +++ b/app/helpers/taxonomies/filter_helper.rb @@ -11,10 +11,10 @@ module Taxonomies::FilterHelper @taxonomy.categories.each do |cat| list = [] cat.sections.each do |sec| - list << tag.li(h("#{sec.rank}. #{sec.name}"), id: "section-#{sec.id}", data: { action: "click->taxonomy#section", target: 'taxonomy.section', 'taxonomy-section-id': sec.id }) + list << tag.li(h("#{sec.rank}. #{sec.name}"), id: "section-#{sec.rank}", data: { action: "click->taxonomy#section", target: 'taxonomy.section', 'taxonomy-section-id': sec.id }) end html << tag.li(h("#{cat.rank}. #{cat.name}") << tag.ol(list.join.html_safe), - id: "category-#{cat.id}", + id: "category-#{cat.rank}", data: { action: "click->taxonomy#category", target: 'taxonomy.category', 'taxonomy-category-id': cat.id }) end raw(tag.nav(tag.ol(html.join.html_safe), id: "taxonomy-#{@taxonomy.uuid}")) -- cgit v1.2.3