IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Quellcode durchsuchen

Make collection content crumbs functional.

master
Stanislaw Adaszewski vor 4 Jahren
Ursprung
Commit
38d75278a7
2 geänderte Dateien mit 13 neuen und 5 gelöschten Zeilen
  1. +5
    -1
      frontend/src/js/component/wb-collection-content.js
  2. +8
    -4
      frontend/src/js/widget/wb-breadcrumbs.js

+ 5
- 1
frontend/src/js/component/wb-collection-content.js Datei anzeigen

@@ -164,7 +164,11 @@ class WBCollectionContent extends Component {
return (
<div>
<WBBreadcrumbs items={ ('.' + collectionPath).split('/') } />
<WBBreadcrumbs items={ ('.' + collectionPath).split('/').map((name, index) => ({ name, index })) }
getItemUrl={ it => this.getUrl({
collectionPath: ('.' + collectionPath).split('/').slice(0, it.index + 1).join('/').substr(1),
page: 0
}) } />
{ (mode === 'manifestDownload') ?
(


+ 8
- 4
frontend/src/js/widget/wb-breadcrumbs.js Datei anzeigen

@@ -1,7 +1,7 @@
import { h, Component } from 'preact';
class WBBreadcrumbs extends Component {
render({ items, onItemClicked }) {
render({ items, onItemClicked, getItemUrl }) {
return (
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@@ -10,8 +10,11 @@ class WBBreadcrumbs extends Component {
(idx == items.length - 1 ? ' active' : '') }>
{
(idx < items.length - 1) ? (
<a href="#" onclick={ e => { e.preventDefault();
onItemClicked(item); } }>{ typeof(item) === 'string' ? item : item['name'] }</a>
<a href={ getItemUrl ? getItemUrl(item) : '#' }
onclick={ onItemClicked ? ( e => { e.preventDefault();
onItemClicked(item); } ) : null }>
{ typeof(item) === 'string' ? item : item['name'] }
</a>
) : (
typeof(item) === 'string' ? item : item['name']
)
@@ -25,7 +28,8 @@ class WBBreadcrumbs extends Component {
}
WBBreadcrumbs.defaultProps = {
'onItemClicked': () => {}
onItemClicked: null,
getItemUrl: null
}
export default WBBreadcrumbs;

Laden…
Abbrechen
Speichern