mirror of
https://github.com/documize/community.git
synced 2025-07-30 10:39:44 +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,7 +9,6 @@
|
|||
//
|
||||
// https://documize.com
|
||||
|
||||
// import $ from 'jquery';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
|
|
|
@ -23,8 +23,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
session: service(),
|
||||
appMeta: service(),
|
||||
pinned: service(),
|
||||
showTools: true, // show document related tools? favourite, delete, make template...
|
||||
showDocumentLink: false, // show link to document in breadcrumbs
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
|
@ -1,71 +0,0 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import $ from 'jquery';
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { notEmpty } from '@ember/object/computed';
|
||||
import NotifierMixin from '../../mixins/notifier';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(NotifierMixin, AuthMixin, {
|
||||
spaceName: '',
|
||||
copyTemplate: true,
|
||||
copyPermission: true,
|
||||
copyDocument: false,
|
||||
hasClone: notEmpty('clonedSpace.id'),
|
||||
clonedSpace: null,
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
$('#add-space-modal').on('show.bs.modal', function(event) { // eslint-disable-line no-unused-vars
|
||||
schedule('afterRender', () => {
|
||||
$("#new-space-name").focus();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
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");
|
||||
$('#add-space-modal').modal('hide');
|
||||
$('#add-space-modal').modal('dispose');
|
||||
|
||||
let cb = this.get('onAddSpace');
|
||||
cb(payload);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -70,7 +70,6 @@ export default Controller.extend(Tooltips, Notifier, {
|
|||
},
|
||||
|
||||
onSavePage(page, meta) {
|
||||
|
||||
let document = this.get('document');
|
||||
let documentId = document.get('id');
|
||||
let constants = this.get('constants');
|
||||
|
@ -232,6 +231,15 @@ export default Controller.extend(Tooltips, Notifier, {
|
|||
|
||||
refresh() {
|
||||
return new EmberPromise((resolve) => {
|
||||
this.get('documentService').fetchDocumentData(this.get('document.id')).then((data) => {
|
||||
this.set('document', data.document);
|
||||
this.set('folders', data.folders);
|
||||
this.set('folder', data.folder);
|
||||
this.set('permissions', data.permissions);
|
||||
this.set('roles', data.roles);
|
||||
this.set('links', data.links);
|
||||
this.set('versions', data.versions);
|
||||
|
||||
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((data) => {
|
||||
this.set('pages', data);
|
||||
|
||||
|
@ -242,6 +250,7 @@ export default Controller.extend(Tooltips, Notifier, {
|
|||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -23,14 +23,6 @@ export default Controller.extend(NotifierMixin, {
|
|||
filteredDocs: null,
|
||||
|
||||
actions: {
|
||||
onAddSpace(payload) {
|
||||
let self = this;
|
||||
this.get('folderService').add(payload).then(function (newFolder) {
|
||||
self.get('folderService').setCurrentFolder(newFolder);
|
||||
self.transitionToRoute('folder', newFolder.get('id'), newFolder.get('slug'));
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteSpace(id) {
|
||||
this.get('folderService').delete(id).then(() => { /* jshint ignore:line */
|
||||
this.get('localStorage').clearSessionItem('folder');
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div class="text-right">
|
||||
{{#if showTools}}
|
||||
{{#if session.authenticated}}
|
||||
{{#if permissions.documentAdd}}
|
||||
<div id="document-template-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save as template">
|
||||
|
@ -31,7 +30,6 @@
|
|||
<i class="material-icons" data-toggle="modal" data-target="#document-delete-modal" data-backdrop="static">delete</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div id="document-template-modal" class="modal" tabindex="-1" role="dialog">
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
{{#if session.isEditor}}
|
||||
<button type="button" class="btn btn-success font-weight-bold my-3" data-toggle="modal" data-target="#add-space-modal" data-backdrop="static">+ SPACE</button>
|
||||
<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=spaces 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>
|
||||
{{/if}}
|
|
@ -20,7 +20,7 @@
|
|||
"author": "Documize Inc.",
|
||||
"license": "AGPL",
|
||||
"devDependencies": {
|
||||
"@ember/optional-features": "^0.6.0",
|
||||
"@ember/optional-features": "^0.6.1",
|
||||
"broccoli-asset-rev": "^2.4.5",
|
||||
"ember-ajax": "^3.0.0",
|
||||
"ember-cli": "^3.1.4",
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@ember/optional-features@^0.6.0":
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-0.6.0.tgz#61f13c739cb1791c0323b258e37c8beb216e1ff2"
|
||||
"@ember/optional-features@^0.6.1":
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-0.6.1.tgz#c5163c11bdd11ed8d69d4e273b114b95af16e5a9"
|
||||
dependencies:
|
||||
chalk "^2.3.0"
|
||||
co "^4.6.0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue