1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 16:19:46 +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); d.set('selected', false);
}); });
let labelId = this.modelFor('folder').folder.get('labelId');
return hash({ return hash({
folder: this.modelFor('folder').folder, folder: this.modelFor('folder').folder,
permissions: this.modelFor('folder').permissions, 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, labels: this.modelFor('folder').labels,
labelSpaces: _.filter(folders, function(s) { return s.get('labelId') === labelId; }),
folders: folders, folders: folders,
documents: documents, documents: documents,
documentsDraft: _.filter(documents, function(d) { return d.get('lifecycle') === constants.Lifecycle.Draft; }), documentsDraft: _.filter(documents, function(d) { return d.get('lifecycle') === constants.Lifecycle.Draft; }),

View file

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