mirror of
https://github.com/documize/community.git
synced 2025-07-28 09:39:42 +02:00
open/edit doc templates
This commit is contained in:
parent
5d3ddaa2d9
commit
1ed6427532
2 changed files with 50 additions and 0 deletions
|
@ -16,6 +16,7 @@ import { inject as service } from '@ember/service';
|
||||||
import TooltipMixin from '../../mixins/tooltip';
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
import ModalMixin from '../../mixins/modal';
|
import ModalMixin from '../../mixins/modal';
|
||||||
import AuthMixin from '../../mixins/auth';
|
import AuthMixin from '../../mixins/auth';
|
||||||
|
import stringUtil from '../../utils/string';
|
||||||
|
|
||||||
export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
||||||
spaceService: service('folder'),
|
spaceService: service('folder'),
|
||||||
|
@ -332,6 +333,21 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
||||||
this.modalClose("#import-doc-modal");
|
this.modalClose("#import-doc-modal");
|
||||||
this.attrs.onRefresh();
|
this.attrs.onRefresh();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onOpenTemplate(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
let id = this.get('selectedTemplate');
|
||||||
|
if (is.empty(id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let template = this.get('templates').findBy('id', id)
|
||||||
|
|
||||||
|
this.modalClose("#space-template-modal");
|
||||||
|
|
||||||
|
let slug = stringUtil.makeSlug(template.get('title'));
|
||||||
|
this.get('router').transitionTo('document', this.get('space.id'), this.get('space.slug'), id, slug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,6 +41,40 @@
|
||||||
<div class="button-icon-gap" />
|
<div class="button-icon-gap" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if permissions.documentTemplate}}
|
||||||
|
<div id="space-template-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Manage templates">
|
||||||
|
<i class="material-icons" data-toggle="modal" data-target="#space-template-modal" data-backdrop="static">content_copy</i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
<div id="space-template-modal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">Manage Templates</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="widget-list-picker">
|
||||||
|
<ul class="options">
|
||||||
|
{{#each templates as |item|}}
|
||||||
|
<li class="option {{if item.selected 'selected'}}" {{action 'onSelectTemplate' item}}>
|
||||||
|
<div class="text text-truncate">
|
||||||
|
{{item.title}}<br/>{{item.description}}
|
||||||
|
</div>
|
||||||
|
{{#if item.selected}}
|
||||||
|
<i class="material-icons">check</i>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-success" onclick={{action 'onOpenTemplate'}}>Open</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if permissions.spaceOwner}}
|
{{#if permissions.spaceOwner}}
|
||||||
<div id="space-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete space">
|
<div id="space-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete space">
|
||||||
<i class="material-icons" data-toggle="modal" data-target="#space-delete-modal" data-backdrop="static">delete</i>
|
<i class="material-icons" data-toggle="modal" data-target="#space-delete-modal" data-backdrop="static">delete</i>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue