From c24a11db85252975db059a4616527f7db60c93a2 Mon Sep 17 00:00:00 2001 From: Guy Willis Date: Wed, 1 May 2024 11:20:27 +0100 Subject: [PATCH 1/2] Added selected state for ToC item --- js/helpers.js | 10 ++++++++++ less/toc.less | 8 ++++---- templates/partials/tocContentObjects.hbs | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/js/helpers.js b/js/helpers.js index ab7da50..2b6ba12 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -20,6 +20,16 @@ define([ } }, + toc__isSelected: function(id, options) { + var model = Adapt.findById(id); + + if (model.get('_isVisible') && Adapt.location._currentId == id) { + return options.fn(this); + } else { + return options.inverse(this); + } + }, + toc__getTitle: function(id, options) { var model = Adapt.findById(id); var t = model.get('displayTitle'); diff --git a/less/toc.less b/less/toc.less index 674eb3b..5fbf972 100644 --- a/less/toc.less +++ b/less/toc.less @@ -170,16 +170,16 @@ } } -.toc__item-btn.is-disabled { +.toc__item-btn.is-selected { .toc__indicator { - border-color: @disabled-inverted; + border-color: @drawer-progress-border; } .toc__indicator-inner { - background-color: @disabled; + background-color: @drawer-item-selected; } .toc__indicator-bar { - background-color: @disabled-inverted; + background-color: @drawer-progress; } } diff --git a/templates/partials/tocContentObjects.hbs b/templates/partials/tocContentObjects.hbs index a5ca2e0..6e5647e 100644 --- a/templates/partials/tocContentObjects.hbs +++ b/templates/partials/tocContentObjects.hbs @@ -6,7 +6,7 @@ {{#each this}}
-