Skip to content

Commit

Permalink
Merge pull request #4 from gnuj/improve-sidebar
Browse files Browse the repository at this point in the history
Improve sidebar and metadata appearance
  • Loading branch information
chrizzor authored Apr 19, 2024
2 parents f1f4fee + 46ac335 commit ede5781
Show file tree
Hide file tree
Showing 9 changed files with 391 additions and 87 deletions.
27 changes: 27 additions & 0 deletions Resources/Private/JavaScript/dfgviewerScripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,33 @@ $(document).ready(function () {
$(this).parent().toggleClass('open');
});

// section toggle inside the sidebar on larger screens
$('.control-bar .control-bar-container h3').on('click', function () {
$(this).parent().toggleClass('section-hidden');
});

// toggle for full metadata display in sidebar
if ($('.control-bar .metadata-basic dl.tx-dlf-metadata-titledata').length > 1) {
metadataToggleLabelMore = ($('html[lang^="de"]')[0]) ? 'mehr Metadaten anzeigen' : 'more Metadata';
metadataToggleLabelLess = ($('html[lang^="de"]')[0]) ? 'weniger Metadaten anzeigen' : 'less Metadata';
$('.control-bar .metadata-basic').append('<div class="metadata-toggle">' + metadataToggleLabelMore + '</div>');
if (Cookies.get('tx-dlf-allmetadata') === 'true') {
$('.control-bar .metadata-basic').addClass('all-metadata').find('.metadata-toggle').text(metadataToggleLabelLess);
$('.control-bar .metadata-basic').find('dl.tx-dlf-metadata-titledata:nth-child(n+3)').show();
}
$('.metadata-toggle').on('click', function () {
if (!$('.control-bar .metadata-basic').hasClass('all-metadata')) {
Cookies.set('tx-dlf-allmetadata', 'true', { sameSite: 'lax' });
$(this).text(metadataToggleLabelLess);
} else {
Cookies.remove('tx-dlf-allmetadata');
$(this).text(metadataToggleLabelMore);
}
$('.control-bar .metadata-basic').toggleClass('all-metadata').find('dl.tx-dlf-metadata-titledata:nth-child(n+3)').slideToggle();

});
}

// active toggle for submenus
$('.document-functions li.submenu > a').on(mobileEvent, function (event) {
$('li.submenu.open a').not(this).parent().removeClass('open');
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/de.locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
<source><![CDATA[Table of Content]]></source>
<target><![CDATA[Inhaltsverzeichnis]]></target>
</trans-unit>
<trans-unit id="digitisation">
<source>Digitisation</source>
<target>Digitalisierung</target>
</trans-unit>
<trans-unit id="uri.book" approved="yes">
<source><![CDATA[Persistent Identifiers (Book)]]></source>
<target><![CDATA[Persistente Identifier (Werk)]]></target>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
<trans-unit id="toc">
<source>Table of Content</source>
</trans-unit>
<trans-unit id="digitisation">
<source>Digitisation</source>
</trans-unit>
<trans-unit id="browser-hint.outdated_browser">
<source>Outdated Browser</source>
</trans-unit>
Expand Down
Loading

0 comments on commit ede5781

Please sign in to comment.