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/helpers/taxonomies/filter_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/helpers/taxonomies/filter_helper.rb') 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