mirror of
https://github.com/documize/community.git
synced 2025-07-30 02:29:43 +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
|
// https://documize.com
|
||||||
|
|
||||||
// import $ from 'jquery';
|
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
|
@ -23,8 +23,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
||||||
session: service(),
|
session: service(),
|
||||||
appMeta: service(),
|
appMeta: service(),
|
||||||
pinned: service(),
|
pinned: service(),
|
||||||
showTools: true, // show document related tools? favourite, delete, make template...
|
|
||||||
showDocumentLink: false, // show link to document in breadcrumbs
|
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
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) {
|
onSavePage(page, meta) {
|
||||||
|
|
||||||
let document = this.get('document');
|
let document = this.get('document');
|
||||||
let documentId = document.get('id');
|
let documentId = document.get('id');
|
||||||
let constants = this.get('constants');
|
let constants = this.get('constants');
|
||||||
|
@ -232,16 +231,26 @@ export default Controller.extend(Tooltips, Notifier, {
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
return new EmberPromise((resolve) => {
|
return new EmberPromise((resolve) => {
|
||||||
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((data) => {
|
this.get('documentService').fetchDocumentData(this.get('document.id')).then((data) => {
|
||||||
this.set('pages', 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('sectionService').getSpaceBlocks(this.get('folder.id')).then((data) => {
|
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((data) => {
|
||||||
this.set('blocks', data);
|
this.set('pages', data);
|
||||||
});
|
|
||||||
|
|
||||||
resolve();
|
this.get('sectionService').getSpaceBlocks(this.get('folder.id')).then((data) => {
|
||||||
|
this.set('blocks', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,14 +23,6 @@ export default Controller.extend(NotifierMixin, {
|
||||||
filteredDocs: null,
|
filteredDocs: null,
|
||||||
|
|
||||||
actions: {
|
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) {
|
onDeleteSpace(id) {
|
||||||
this.get('folderService').delete(id).then(() => { /* jshint ignore:line */
|
this.get('folderService').delete(id).then(() => { /* jshint ignore:line */
|
||||||
this.get('localStorage').clearSessionItem('folder');
|
this.get('localStorage').clearSessionItem('folder');
|
||||||
|
|
|
@ -9,16 +9,59 @@
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
import $ from 'jquery';
|
||||||
import { inject as service } from '@ember/service';
|
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';
|
import Controller from '@ember/controller';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend(AuthMixin, Modals, {
|
||||||
appMeta: service(),
|
appMeta: service(),
|
||||||
folderService: service('folder'),
|
folderService: service('folder'),
|
||||||
|
|
||||||
|
spaceName: '',
|
||||||
|
copyTemplate: true,
|
||||||
|
copyPermission: true,
|
||||||
|
copyDocument: false,
|
||||||
|
hasClone: notEmpty('clonedSpace.id'),
|
||||||
|
clonedSpace: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onAddSpace(m) {
|
onShowModal() {
|
||||||
this.get('folderService').add(m).then((sp) => {
|
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.get('folderService').setCurrentFolder(sp);
|
||||||
this.transitionToRoute('folder', sp.get('id'), sp.get('slug'));
|
this.transitionToRoute('folder', sp.get('id'), sp.get('slug'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,9 +10,43 @@
|
||||||
<div id="sidebar" class="sidebar">
|
<div id="sidebar" class="sidebar">
|
||||||
<h1>{{appMeta.title}}</h1>
|
<h1>{{appMeta.title}}</h1>
|
||||||
<p>{{appMeta.message}}</p>
|
<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>
|
</div>
|
||||||
{{/layout/middle-zone-sidebar}}
|
{{/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/middle-zone}}
|
||||||
|
|
||||||
{{#layout/bottom-bar}}
|
{{#layout/bottom-bar}}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{yield}}
|
{{yield}}
|
|
@ -1,36 +1,34 @@
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
{{#if showTools}}
|
{{#if session.authenticated}}
|
||||||
{{#if session.authenticated}}
|
{{#if permissions.documentAdd}}
|
||||||
{{#if permissions.documentAdd}}
|
<div id="document-template-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save as template">
|
||||||
<div id="document-template-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save as template">
|
<i class="material-icons" data-toggle="modal" data-target="#document-template-modal" data-backdrop="static">content_copy</i>
|
||||||
<i class="material-icons" data-toggle="modal" data-target="#document-template-modal" data-backdrop="static">content_copy</i>
|
</div>
|
||||||
</div>
|
<div class="button-icon-gap" />
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div id="document-print-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Print" {{action 'onPrintDocument'}}>
|
<div id="document-print-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Print" {{action 'onPrintDocument'}}>
|
||||||
<i class="material-icons">print</i>
|
<i class="material-icons">print</i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
|
||||||
|
{{#if pinState.isPinned}}
|
||||||
|
<div id="document-pin-button" class="button-icon-gold align-middle" data-toggle="tooltip" data-placement="top" title="Remove favorite" {{action 'onUnpin'}}>
|
||||||
|
<i class="material-icons">star</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-icon-gap" />
|
<div class="button-icon-gap" />
|
||||||
|
{{else if session.authenticated}}
|
||||||
|
<div id="document-pin-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save favorite" {{action 'onPin'}}>
|
||||||
|
<i class="material-icons">star</i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if pinState.isPinned}}
|
{{#if permissions.documentDelete}}
|
||||||
<div id="document-pin-button" class="button-icon-gold align-middle" data-toggle="tooltip" data-placement="top" title="Remove favorite" {{action 'onUnpin'}}>
|
<div id="document-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete document">
|
||||||
<i class="material-icons">star</i>
|
<i class="material-icons" data-toggle="modal" data-target="#document-delete-modal" data-backdrop="static">delete</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{else if session.authenticated}}
|
|
||||||
<div id="document-pin-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save favorite" {{action 'onPin'}}>
|
|
||||||
<i class="material-icons">star</i>
|
|
||||||
</div>
|
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if permissions.documentDelete}}
|
|
||||||
<div id="document-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete document">
|
|
||||||
<i class="material-icons" data-toggle="modal" data-target="#document-delete-modal" data-backdrop="static">delete</i>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -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.",
|
"author": "Documize Inc.",
|
||||||
"license": "AGPL",
|
"license": "AGPL",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ember/optional-features": "^0.6.0",
|
"@ember/optional-features": "^0.6.1",
|
||||||
"broccoli-asset-rev": "^2.4.5",
|
"broccoli-asset-rev": "^2.4.5",
|
||||||
"ember-ajax": "^3.0.0",
|
"ember-ajax": "^3.0.0",
|
||||||
"ember-cli": "^3.1.4",
|
"ember-cli": "^3.1.4",
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@ember/optional-features@^0.6.0":
|
"@ember/optional-features@^0.6.1":
|
||||||
version "0.6.0"
|
version "0.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-0.6.0.tgz#61f13c739cb1791c0323b258e37c8beb216e1ff2"
|
resolved "https://registry.yarnpkg.com/@ember/optional-features/-/optional-features-0.6.1.tgz#c5163c11bdd11ed8d69d4e273b114b95af16e5a9"
|
||||||
dependencies:
|
dependencies:
|
||||||
chalk "^2.3.0"
|
chalk "^2.3.0"
|
||||||
co "^4.6.0"
|
co "^4.6.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue