Skip to content

Commit

Permalink
AR-201 Container element is empty caused by a span as child to a ul e…
Browse files Browse the repository at this point in the history
…lement
  • Loading branch information
randalldfloyd committed Jan 5, 2024
1 parent 1e35151 commit dde840d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/assets/javascripts/context_navigation.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ class ExpandButton {
constructor(data) {
var collapseIcon = `<img alt='collapse' src='<%= image_path('blacklight/collapse.svg') %>'>`;
var expandIcon = `<img alt='expand' src='<%= image_path('blacklight/expand.svg') %>'>`;

// Find Siblings count
var siblingCount = `&nbsp;<span class='al-count'>999</span>&nbsp;`;

this.collapseText = collapseIcon + `Hide`+ siblingCount + data.collapse;
this.expandText = expandIcon + `Show` + siblingCount + data.expand;


this.$el = $(`<button class="btn btn-link btn-sm">${this.expandText}</button>`);
this.handleClick = this.handleClick.bind(this);
this.$el.click(this.handleClick);
}

}

/**
Expand Down Expand Up @@ -187,11 +187,12 @@ class ContextNavigation {
const $span = $('<span></span>');
$span.addClass('divider');
$span.attr('text-position', 'left');
$span.attr('role', 'listitem');
$ul.append($span);

const button = new ExpandButton(this.data);
$span.append(button.$el);

return $ul;
}

Expand Down Expand Up @@ -268,15 +269,15 @@ class ContextNavigation {

prevParentList.append(renderedBeforeDocs);


} else {
renderedBeforeDocs = beforeDocs.map(newDoc => newDoc.render()).join('');
}

// Silly but works for now
this.ul.append(prevParentList || renderedBeforeDocs);


let itemDoc = newDocs.slice(newDocIndex, newDocIndex + 1);
let renderedItemDoc = itemDoc.map(doc => doc.render()).join('');

Expand Down Expand Up @@ -370,7 +371,7 @@ class ContextNavigation {
var srOnly = $('h2[data-sr-enable-me]');
toEnable.removeClass('disabled');
toEnable.text(srOnly.data('hasContents'));
srOnly.text(srOnly.data('hasContents'));
srOnly.text(srOnly.data('hasContents'));
}

showSiblingCount(){
Expand Down Expand Up @@ -409,5 +410,5 @@ Blacklight.onLoad(function () {
);
contextNavigation.getData();
});

});

0 comments on commit dde840d

Please sign in to comment.