1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

Only show space dropdown when label has 2+ spaces

This commit is contained in:
HarveyKandola 2019-06-03 17:00:32 +01:00
parent acd3dd63b5
commit 99a5418dba
2 changed files with 14 additions and 11 deletions

View file

@ -44,11 +44,14 @@ export default Route.extend(AuthenticatedRouteMixin, {
d.set('selected', false);
});
let labelId = this.modelFor('folder').folder.get('labelId');
return hash({
folder: this.modelFor('folder').folder,
permissions: this.modelFor('folder').permissions,
label: _.find(this.modelFor('folder').labels, {id: this.modelFor('folder').folder.get('labelId')}),
label: _.find(this.modelFor('folder').labels, {id: labelId}),
labels: this.modelFor('folder').labels,
labelSpaces: _.filter(folders, function(s) { return s.get('labelId') === labelId; }),
folders: folders,
documents: documents,
documentsDraft: _.filter(documents, function(d) { return d.get('lifecycle') === constants.Lifecycle.Draft; }),

View file

@ -45,19 +45,19 @@
<div class="space-label">Unclassified</div>
{{else}}
<div class="space-label" style={{{model.label.bgColor}}}>{{model.label.name}}</div>
<i class="space-label-dropdown dicon {{constants.Icon.ArrowSmallDown}}">
{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false placement="bottom-middle"}}
<ul class="menu">
{{#each model.folders as |space|}}
{{#if (eq space.labelId model.label.id)}}
{{#if (gt model.labelSpaces.length 1)}}
<i class="space-label-dropdown dicon {{constants.Icon.ArrowSmallDown}}">
{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false placement="bottom-middle"}}
<ul class="menu">
{{#each model.labelSpaces as |space|}}
{{#if (not-eq space.id model.folder.id)}}
{{#link-to "folder.index" space.id space.slug class="item"}}{{space.name}}{{/link-to}}
{{/if}}
{{/if}}
{{/each}}
</ul>
{{/attach-popover}}
</i>
{{/each}}
</ul>
{{/attach-popover}}
</i>
{{/if}}
{{/if}}
{{layout/logo-heading