Skip to content

Commit

Permalink
AV-689: fix previous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bzar committed Dec 4, 2023
1 parent b8e0b96 commit 9ae0dc8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions drupal/modules/avoindata-theme/js/cycle_guide_menu_items.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ class MenuUtils {

if (this.menu) {
const menuItems = this.menu.getElementsByClassName(this.navItemLinkSelector);
let nextOrdinal = 1;
for (let item of menuItems) {
const subnavElement = this.isSubnavElement(item);
const path = item.getAttribute('href');
const itemName = item.getElementsByClassName(this.navItemLinkContentSelector);
const next = null;
const prev = null;
const ordinal = null;
const ordinal = subnavElement ? null : nextOrdinal++;

if (itemName.length > 0) {
paths.push(new MenuItem(path, itemName[0].innerText, subnavElement, next, prev, ordinal));
Expand All @@ -93,9 +94,9 @@ class MenuUtils {

// Set the next and prev pointers so that they're always pointing at the next or previous main items in the list.
for (let i = 0; i < paths.length; i++) {
// Skip ordinals for two last items
if (showOrdinals && i > 0 && i < paths.length - 2) {
paths[i].ordinal = i;
// Remove ordinals for two last items
if (!showOrdinals || i >= paths.length - 2) {
paths[i].ordinal = null;
}
if (i === 0) {
paths[i].next = this.getNextMainElementIndex(i, paths);
Expand Down
5 changes: 4 additions & 1 deletion opendata-assets/src/less/drupal/menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
top: 0;
position: sticky;
max-height: 100vh;
max-width: 350px;
border: @navbar-border;
z-index: 255;

@media (min-width: @screen-md-min) {
max-width: 350px;
}

.avoindata-guide-menu-toggle {
align-self: end;
margin: 10px;
Expand Down

0 comments on commit 9ae0dc8

Please sign in to comment.