mirror of
https://github.com/documize/community.git
synced 2025-08-05 13:35:25 +02:00
Sync two editions and deal with the diff
This commit is contained in:
parent
372b3f3692
commit
9a3259b60e
12 changed files with 128 additions and 160 deletions
|
@ -9,16 +9,59 @@
|
|||
//
|
||||
// https://documize.com
|
||||
|
||||
import $ from 'jquery';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { notEmpty } from '@ember/object/computed';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Modals from '../../mixins/modal';
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
export default Controller.extend(AuthMixin, Modals, {
|
||||
appMeta: service(),
|
||||
folderService: service('folder'),
|
||||
|
||||
spaceName: '',
|
||||
copyTemplate: true,
|
||||
copyPermission: true,
|
||||
copyDocument: false,
|
||||
hasClone: notEmpty('clonedSpace.id'),
|
||||
clonedSpace: null,
|
||||
|
||||
actions: {
|
||||
onAddSpace(m) {
|
||||
this.get('folderService').add(m).then((sp) => {
|
||||
onShowModal() {
|
||||
this.modalOpen('#add-space-modal', {'show': true}, '#new-space-name');
|
||||
},
|
||||
|
||||
onCloneSpaceSelect(sp) {
|
||||
this.set('clonedSpace', sp)
|
||||
},
|
||||
|
||||
onAddSpace(e) {
|
||||
e.preventDefault();
|
||||
|
||||
let spaceName = this.get('spaceName');
|
||||
let clonedId = this.get('clonedSpace.id');
|
||||
|
||||
if (is.empty(spaceName)) {
|
||||
$("#new-space-name").addClass("is-invalid").focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
let payload = {
|
||||
name: spaceName,
|
||||
cloneId: clonedId,
|
||||
copyTemplate: this.get('copyTemplate'),
|
||||
copyPermission: this.get('copyPermission'),
|
||||
copyDocument: this.get('copyDocument'),
|
||||
}
|
||||
|
||||
this.set('spaceName', '');
|
||||
this.set('clonedSpace', null);
|
||||
$("#new-space-name").removeClass("is-invalid");
|
||||
|
||||
this.modalClose('#add-space-modal');
|
||||
|
||||
this.get('folderService').add(payload).then((sp) => {
|
||||
this.get('folderService').setCurrentFolder(sp);
|
||||
this.transitionToRoute('folder', sp.get('id'), sp.get('slug'));
|
||||
});
|
||||
|
|
|
@ -10,9 +10,43 @@
|
|||
<div id="sidebar" class="sidebar">
|
||||
<h1>{{appMeta.title}}</h1>
|
||||
<p>{{appMeta.message}}</p>
|
||||
{{toolbar/for-spaces spaces=model onAddSpace=(action 'onAddSpace')}}
|
||||
{{#if session.isEditor}}
|
||||
<button type="button" class="btn btn-success font-weight-bold my-3" {{action 'onShowModal'}}>+ SPACE</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/layout/middle-zone-sidebar}}
|
||||
|
||||
<div class="modal" tabindex="-1" role="dialog" id="add-space-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">Add Space</div>
|
||||
<div class="modal-body">
|
||||
<form onsubmit={{action 'onAddSpace'}}>
|
||||
<div class="form-group">
|
||||
<label for="new-space-name">Space Name</label>
|
||||
{{input type='text' id="new-space-name" class="form-control mousetrap" placeholder="Space name" value=spaceName}}
|
||||
<small id="emailHelp" class="form-text text-muted">Characters and numbers only</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="clone-space-dropdown">Clone Space</label>
|
||||
{{ui-select id="clone-space-dropdown" content=model prompt="select space" action=(action 'onCloneSpaceSelect') optionValuePath="id" optionLabelPath="name" selection=clonedSpace}}
|
||||
<small id="emailHelp" class="form-text text-muted">Copy templates, permissions, documents from existing space</small>
|
||||
<div class="margin-top-10" />
|
||||
{{#if hasClone}}
|
||||
{{#ui/ui-checkbox selected=copyTemplate}}Copy templates{{/ui/ui-checkbox}}
|
||||
{{#ui/ui-checkbox selected=copyPermission}}Copy permissions{{/ui/ui-checkbox}}
|
||||
{{#ui/ui-checkbox selected=copyDocument}}Copy documents{{/ui/ui-checkbox}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-success" onclick={{action 'onAddSpace'}}>Add</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/layout/middle-zone}}
|
||||
|
||||
{{#layout/bottom-bar}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue