diff --git a/app/components/breadcrumb/index.hbs b/app/components/breadcrumb/index.hbs index f57949e7e4b69e2119d6fd6789f9051c7cf3d9c3..a12ba820ede3d70d8c6ff6b6ea9988e129419110 100644 --- a/app/components/breadcrumb/index.hbs +++ b/app/components/breadcrumb/index.hbs @@ -2,19 +2,10 @@ <ol class="breadcrumb"> {{#each this.nodes as |node|}} <li class="breadcrumb-item"> - {{#if (is_equal @hint "left")}} - {{#if (is_equal node.nodeType "document") }} - <Document::LinkToLeft @node={{node}} /> - {{else}} - <Folder::LinkToLeft - @node={{node}} - @extranode={{@extranode}} /> - {{/if}} - {{else}} - <Folder::LinkToRight - @node={{@extranode}} - @extranode={{node}} /> - {{/if}} + <DualLinkTo + @node={{node}} + @extranode={{@extranode}} + @hint={{@hint}} /> </li> {{/each}} </ol> diff --git a/app/components/commander/index.hbs b/app/components/commander/index.hbs index 1683188eb0e9755f5f6edb6fd8e05192c34ce459..abde0d307e163456c1fc971c281c9d46495c983a 100644 --- a/app/components/commander/index.hbs +++ b/app/components/commander/index.hbs @@ -44,21 +44,10 @@ @model={{node}} @selectedNodes={{this.selected_nodes}} @onCheckboxChange={{this.onCheckboxChange}} > - {{#if (is_equal @hint "left")}} - {{#if (is_equal node.nodeType "folder")}} - <Folder::LinkToLeft - @node={{node}} - @extranode={{@extranode}} /> - {{else}} - <Document::LinkToLeft - @node={{node}} - @extranode={{@extranode}} /> - {{/if}} - {{else}} - <Folder::LinkToRight - @node={{@extranode}} - @extranode={{node}} /> - {{/if}} + <DualLinkTo + @node={{node}} + @extranode={{@extranode}} + @hint={{@hint}} /> </NodeType> {{/let}} {{/each}} diff --git a/app/components/dual_link_to.hbs b/app/components/dual_link_to.hbs new file mode 100644 index 0000000000000000000000000000000000000000..6e93ba53a878b3fa79963a4a079dda4f64dfcc7e --- /dev/null +++ b/app/components/dual_link_to.hbs @@ -0,0 +1,6 @@ +<LinkTo + @route={{this.route}} + @model={{this.model.id}} + @query={{this.query}}> + {{this.title}} +</LinkTo> diff --git a/app/components/dual_link_to.js b/app/components/dual_link_to.js new file mode 100644 index 0000000000000000000000000000000000000000..c4a1d251399643fe1281d38a9f6dd86964245b63 --- /dev/null +++ b/app/components/dual_link_to.js @@ -0,0 +1,61 @@ +import Component from '@glimmer/component'; + + +export default class DualLinkToComponent extends Component { + + get route() { + let node, + hint; + + hint = this.args.hint; + node = this.args.node; + if (hint == 'left') { + if (node && node.get('nodeType') === 'document') { + return 'authenticated.document'; + } + + if (node && node.get('nodeType') === 'folder') { + return 'authenticated.nodes'; + } + } + + return 'authenticated.nodes'; + } + + get model() { + if (this.args.hint == 'left') { + return this.args.node; + } + + return this.args.extranode; + } + + get title() { + return this.args.node.get('title'); + } + + get query() { + let node, + extranode, + hint; + + node = this.args.node; + extranode = this.args.extranode; + hint = this.args.hint; + + if ((hint === 'left') && extranode) { + return { + 'extranode_id': extranode.get('id') + }; + } + + if (hint === 'right' && node) { + return { + 'extranode_id': node.get('id') + } + } + + return {}; + } // end of query + +} // end of DualLinkToComponent diff --git a/app/templates/authenticated/viewer.hbs b/app/templates/authenticated/viewer.hbs index ce1018ed44e8e3366bcc3ae1ee619c2b500cfa47..51889d3b0434f3c8ce5ee4f45b4716c126f19bd4 100644 --- a/app/templates/authenticated/viewer.hbs +++ b/app/templates/authenticated/viewer.hbs @@ -9,7 +9,7 @@ {{#if this.dualpanel_mode}} <Commander @node={{this.extranode}} - @extranode={{this.mainnode}} + @extradoc={{@model}} @onPanelToggle={{this.onPanelToggle}} @dualPanelMode={{this.dualpanel_mode}} @hint="right" />