mirror of
https://github.com/documize/community.git
synced 2025-07-24 23:59:47 +02:00
Change space settings management into tab views
This commit is contained in:
parent
738b3d94b6
commit
92f8fe550e
38 changed files with 683 additions and 411 deletions
|
@ -14,10 +14,11 @@ import { empty } from '@ember/object/computed';
|
|||
import { set } from '@ember/object';
|
||||
import { copy } from '@ember/object/internals';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Component from '@ember/component';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import encoding from '../../utils/encoding';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
export default Component.extend(Notifier, {
|
||||
appMeta: service(),
|
||||
isDocumizeProvider: computed('authProvider', function() {
|
||||
return this.get('authProvider') === this.get('constants').AuthProvider.Documize;
|
||||
|
@ -139,6 +140,8 @@ export default Component.extend({
|
|||
break;
|
||||
}
|
||||
|
||||
this.showWait();
|
||||
|
||||
let data = { authProvider: provider, authConfig: JSON.stringify(config) };
|
||||
|
||||
this.get('onSave')(data).then(() => {
|
||||
|
@ -158,6 +161,7 @@ export default Component.extend({
|
|||
}
|
||||
});
|
||||
}
|
||||
this.showDone();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
|
||||
import $ from 'jquery';
|
||||
import { empty, and } from '@ember/object/computed';
|
||||
import Component from '@ember/component';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
import { set } from '@ember/object';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
export default Component.extend(Notifier, {
|
||||
titleEmpty: empty('model.general.title'),
|
||||
messageEmpty: empty('model.general.message'),
|
||||
conversionEndpointEmpty: empty('model.general.conversionEndpoint'),
|
||||
|
@ -47,7 +48,10 @@ export default Component.extend({
|
|||
|
||||
this.model.general.set('allowAnonymousAccess', $("#allowAnonymousAccess").prop('checked'));
|
||||
|
||||
this.showWait();
|
||||
|
||||
this.get('save')().then(() => {
|
||||
this.showDone();
|
||||
set(this, 'titleError', false);
|
||||
set(this, 'messageError', false);
|
||||
set(this, 'conversionEndpointError', false);
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
import $ from 'jquery';
|
||||
import { empty } from '@ember/object/computed';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
export default Component.extend(Notifier, {
|
||||
appMeta: service(),
|
||||
LicenseError: empty('model.license'),
|
||||
changelog: '',
|
||||
|
@ -36,7 +37,9 @@ export default Component.extend({
|
|||
|
||||
actions: {
|
||||
saveLicense() {
|
||||
this.showWait();
|
||||
this.get('saveLicense')().then(() => {
|
||||
this.showDone();
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
|
||||
import $ from 'jquery';
|
||||
import { empty } from '@ember/object/computed';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
export default Component.extend(Notifier, {
|
||||
SMTPHostEmptyError: empty('model.smtp.host'),
|
||||
SMTPPortEmptyError: empty('model.smtp.port'),
|
||||
SMTPSenderEmptyError: empty('model.smtp.sender'),
|
||||
|
@ -47,9 +48,11 @@ export default Component.extend({
|
|||
},
|
||||
);
|
||||
|
||||
this.showWait();
|
||||
this.set('buttonText', 'Please wait...');
|
||||
|
||||
this.get('saveSMTP')().then((result) => {
|
||||
this.showDone();
|
||||
this.set('buttonText', 'Save & Test');
|
||||
this.set('testSMTP', result);
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ export default Component.extend({
|
|||
|
||||
p.set('id', this.get('block.id'));
|
||||
p.set('orgId', this.get('block.orgId'));
|
||||
p.set('documentId', this.get('document.id'));
|
||||
p.set('documentId', 'dummy');
|
||||
p.set('contentType', this.get('block.contentType'));
|
||||
p.set('pageType', this.get('block.pageType'));
|
||||
p.set('title', this.get('block.title'));
|
||||
|
@ -31,7 +31,7 @@ export default Component.extend({
|
|||
|
||||
m.set('pageId', this.get('block.id'));
|
||||
m.set('orgId', this.get('block.orgId'));
|
||||
m.set('documentId', this.get('document.id'));
|
||||
m.set('documentId', 'dummy');
|
||||
m.set('rawBody', this.get('block.rawBody'));
|
||||
m.set('config', this.get('block.config'));
|
||||
m.set('externalSource', this.get('block.externalSource'));
|
||||
|
|
|
@ -175,23 +175,6 @@ export default Component.extend(TooltipMixin, Notifier, {
|
|||
this.set('showDeleteBlockDialog', true);
|
||||
},
|
||||
|
||||
onDeleteBlock() {
|
||||
this.set('showDeleteBlockDialog', false);
|
||||
|
||||
let id = this.get('deleteBlockId');
|
||||
|
||||
let cb = this.get('onDeleteBlock');
|
||||
let promise = cb(id);
|
||||
|
||||
promise.then(() => {
|
||||
this.set('deleteBlockId', '');
|
||||
let refresh = this.get('refresh');
|
||||
refresh();
|
||||
});
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onVote(vote) {
|
||||
this.get('documentService').vote(this.get('document.id'), vote);
|
||||
this.set('voteThanks', true);
|
||||
|
|
69
gui/app/components/folder/settings-blocks.js
Normal file
69
gui/app/components/folder/settings-blocks.js
Normal file
|
@ -0,0 +1,69 @@
|
|||
// 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 { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthMixin, Notifier, {
|
||||
router: service(),
|
||||
spaceSvc: service('folder'),
|
||||
sectionSvc: service('section'),
|
||||
|
||||
showDeleteDialog: false,
|
||||
deleteBlockId: '',
|
||||
|
||||
isSpaceAdmin: computed('permissions', function() {
|
||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (!this.get('isSpaceAdmin')) return;
|
||||
|
||||
this.get('sectionSvc').getSpaceBlocks(this.get('space.id')).then((blocks) => {
|
||||
this.set('blocks', blocks);
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
onShowDeleteDialog(id) {
|
||||
this.set('showDeleteDialog', true);
|
||||
this.set('deleteBlockId', id);
|
||||
},
|
||||
|
||||
onEdit(id) {
|
||||
this.get('router').transitionTo('folder.block', this.get('space.id'), this.get('space.slug'), id);
|
||||
},
|
||||
|
||||
onDeleteBlock() {
|
||||
this.set('showDeleteDialog', false);
|
||||
|
||||
let id = this.get('deleteBlockId');
|
||||
|
||||
this.showWait();
|
||||
|
||||
this.get('sectionSvc').deleteBlock(id).then(() => {
|
||||
this.set('deleteBlockId', '');
|
||||
this.showDone();
|
||||
|
||||
this.get('sectionSvc').getSpaceBlocks(this.get('space.id')).then((blocks) => {
|
||||
this.set('blocks', blocks);
|
||||
});
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
84
gui/app/components/folder/settings-general.js
Normal file
84
gui/app/components/folder/settings-general.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
// 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 { A } from '@ember/array';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { computed } from '@ember/object';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthMixin, Notifier, {
|
||||
router: service(),
|
||||
spaceSvc: service('folder'),
|
||||
localStorage: service('localStorage'),
|
||||
|
||||
isSpaceAdmin: computed('permissions', function() {
|
||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
|
||||
spaceTypeOptions: A([]),
|
||||
spaceType: 0,
|
||||
likes: 'Did this help you?',
|
||||
allowLikes: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
let constants = this.get('constants');
|
||||
let folder = this.get('space');
|
||||
|
||||
let spaceTypeOptions = A([]);
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Private, label: 'Private - viewable only by me'});
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Protected, label: 'Protected - access is restricted to selected users'});
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Public, label: 'Public - can be seen by everyone'});
|
||||
this.set('spaceTypeOptions', spaceTypeOptions);
|
||||
this.set('spaceType', spaceTypeOptions.findBy('id', folder.get('folderType')));
|
||||
|
||||
this.set('likes', folder.get('likes'));
|
||||
this.set('allowLikes', folder.get('allowLikes'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
onSetSpaceType(t) {
|
||||
this.set('spaceType', t);
|
||||
},
|
||||
|
||||
onSetLikes(l) {
|
||||
this.set('allowLikes', l);
|
||||
|
||||
schedule('afterRender', () => {
|
||||
if (l) this.$('#space-likes-prompt').focus();
|
||||
});
|
||||
},
|
||||
|
||||
onSave() {
|
||||
if (!this.get('isSpaceAdmin')) return;
|
||||
|
||||
let space = this.get('space');
|
||||
space.set('folderType', this.get('spaceType.id'));
|
||||
|
||||
let allowLikes = this.get('allowLikes');
|
||||
space.set('likes', allowLikes ? this.get('likes') : '');
|
||||
|
||||
this.showWait();
|
||||
|
||||
this.get('spaceSvc').save(space).then(() => {
|
||||
this.showDone();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
89
gui/app/components/folder/settings-invitations.js
Normal file
89
gui/app/components/folder/settings-invitations.js
Normal file
|
@ -0,0 +1,89 @@
|
|||
// 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 { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthMixin, Notifier, {
|
||||
spaceSvc: service('folder'),
|
||||
|
||||
isSpaceAdmin: computed('permissions', function() {
|
||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
|
||||
inviteEmail: '',
|
||||
inviteMessage: '',
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('inviteMessage').length === 0) {
|
||||
this.set('inviteMessage', this.getDefaultInvitationMessage());
|
||||
}
|
||||
},
|
||||
|
||||
getDefaultInvitationMessage() {
|
||||
return "Hey there, I am sharing the " + this.get('space.name') + " space (in " + this.get("appMeta.title") + ") with you so we can both collaborate on documents.";
|
||||
},
|
||||
|
||||
actions: {
|
||||
onSpaceInvite(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var email = this.get('inviteEmail').trim().replace(/ /g, '');
|
||||
var message = this.get('inviteMessage').trim();
|
||||
|
||||
if (message.length === 0) {
|
||||
this.set('inviteMessage', this.getDefaultInvitationMessage());
|
||||
message = this.getDefaultInvitationMessage();
|
||||
}
|
||||
|
||||
if (email.length === 0) {
|
||||
this.$('#space-invite-email').addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.showWait();
|
||||
|
||||
var result = {
|
||||
Message: message,
|
||||
Recipients: []
|
||||
};
|
||||
|
||||
// Check for multiple email addresses
|
||||
if (email.indexOf(",") > -1) {
|
||||
result.Recipients = email.split(',');
|
||||
}
|
||||
if (email.indexOf(";") > -1 && result.Recipients.length === 0) {
|
||||
result.Recipients = email.split(';');
|
||||
}
|
||||
|
||||
// Handle just one email address
|
||||
if (result.Recipients.length === 0 && email.length > 0) {
|
||||
result.Recipients.push(email);
|
||||
}
|
||||
|
||||
this.set('inviteEmail', '');
|
||||
|
||||
this.get('spaceSvc').share(this.get('space.id'), result).then(() => {
|
||||
this.showDone();
|
||||
this.$('#space-invite-email').removeClass('is-invalid');
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
|
@ -12,11 +12,12 @@
|
|||
import { inject as service } from '@ember/service';
|
||||
import { A } from '@ember/array';
|
||||
import { debounce } from '@ember/runloop';
|
||||
import ModalMixin from '../../mixins/modal';
|
||||
import { computed } from '@ember/object';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import stringUtil from '../../utils/string';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(ModalMixin, {
|
||||
export default Component.extend(Notifier, {
|
||||
groupSvc: service('group'),
|
||||
spaceSvc: service('folder'),
|
||||
userSvc: service('user'),
|
||||
|
@ -27,6 +28,10 @@ export default Component.extend(ModalMixin, {
|
|||
users: null,
|
||||
searchText: '',
|
||||
|
||||
isSpaceAdmin: computed('permissions', function() {
|
||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
||||
|
@ -128,7 +133,11 @@ export default Component.extend(ModalMixin, {
|
|||
},
|
||||
|
||||
actions: {
|
||||
setPermissions() {
|
||||
onSave() {
|
||||
if (!this.get('isSpaceAdmin')) return;
|
||||
|
||||
this.showWait();
|
||||
|
||||
let message = this.getDefaultInvitationMessage();
|
||||
let permissions = this.get('spacePermissions');
|
||||
let folder = this.get('folder');
|
||||
|
@ -164,7 +173,7 @@ export default Component.extend(ModalMixin, {
|
|||
}
|
||||
|
||||
this.get('spaceSvc').savePermissions(folder.get('id'), payload).then(() => {
|
||||
this.modalClose('#space-permission-modal');
|
||||
this.showDone();
|
||||
this.get('onRefresh')();
|
||||
});
|
||||
},
|
37
gui/app/components/folder/settings-templates.js
Normal file
37
gui/app/components/folder/settings-templates.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
// 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 { inject as service } from '@ember/service';
|
||||
import { computed } from '@ember/object';
|
||||
import stringUtil from '../../utils/string';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthMixin, Notifier, {
|
||||
spaceSvc: service('folder'),
|
||||
|
||||
isSpaceAdmin: computed('permissions', function() {
|
||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
|
||||
actions: {
|
||||
onOpenTemplate(id) {
|
||||
if (is.empty(id)) {
|
||||
return;
|
||||
}
|
||||
let template = this.get('templates').findBy('id', id)
|
||||
|
||||
let slug = stringUtil.makeSlug(template.get('title'));
|
||||
this.get('router').transitionTo('document', this.get('space.id'), this.get('space.slug'), id, slug);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -60,10 +60,6 @@ export default Component.extend(AuthMixin, {
|
|||
this.send('onDocumentFilter', 'category', this.get('categoryFilter'));
|
||||
} else {
|
||||
this.send('onDocumentFilter', 'space', this.get('folder.id'));
|
||||
// } else if (this.get('rootDocCount') > 0) {
|
||||
// this.send('onDocumentFilter', 'space', this.get('folder.id'));
|
||||
// } else if (selectedCategory !== '') {
|
||||
// this.send('onDocumentFilter', 'category', selectedCategory);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -23,10 +23,6 @@ export default Component.extend({
|
|||
let page = this.get('page');
|
||||
return `wysiwyg-editor-${page.id}`;
|
||||
}),
|
||||
toolbarId: computed('page', function () {
|
||||
let page = this.get('page');
|
||||
return `wysiwyg-editor-toolbar-${page.id}`;
|
||||
}),
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
|
@ -45,7 +41,6 @@ export default Component.extend({
|
|||
gecko_spellcheck: false,
|
||||
statusbar: false,
|
||||
inline: true,
|
||||
// fixed_toolbar_container: '#' + this.get('toolbarId'),
|
||||
paste_data_images: true,
|
||||
image_advtab: true,
|
||||
image_caption: true,
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
import $ from 'jquery';
|
||||
import { computed } from '@ember/object';
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { A } from '@ember/array';
|
||||
import { inject as service } from '@ember/service';
|
||||
import TooltipMixin from '../../mixins/tooltip';
|
||||
import ModalMixin from '../../mixins/modal';
|
||||
import AuthMixin from '../../mixins/auth';
|
||||
import stringUtil from '../../utils/string';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
||||
|
@ -36,8 +34,7 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||
}),
|
||||
deleteSpaceName: '',
|
||||
inviteEmail: '',
|
||||
inviteMessage: '',
|
||||
|
||||
hasTemplates: computed('templates', function() {
|
||||
return this.get('templates.length') > 0;
|
||||
}),
|
||||
|
@ -49,11 +46,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
|
||||
dropzone: null,
|
||||
|
||||
spaceTypeOptions: A([]),
|
||||
spaceType: 0,
|
||||
likes: '',
|
||||
allowLikes: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.importedDocuments = [];
|
||||
|
@ -68,7 +60,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
let constants = this.get('constants');
|
||||
|
||||
let folder = this.get('space');
|
||||
let targets = _.reject(this.get('spaces'), {id: folder.get('id')});
|
||||
|
@ -80,20 +71,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
this.set('pinState.newName', folder.get('name'));
|
||||
this.renderTooltips();
|
||||
});
|
||||
|
||||
if (this.get('inviteMessage').length === 0) {
|
||||
this.set('inviteMessage', this.getDefaultInvitationMessage());
|
||||
}
|
||||
|
||||
let spaceTypeOptions = A([]);
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Private, label: 'Private - viewable only by me'});
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Protected, label: 'Protected - access is restricted to selected users'});
|
||||
spaceTypeOptions.pushObject({id: constants.FolderType.Public, label: 'Public - can be seen by everyone'});
|
||||
this.set('spaceTypeOptions', spaceTypeOptions);
|
||||
this.set('spaceType', spaceTypeOptions.findBy('id', folder.get('folderType')));
|
||||
|
||||
this.set('likes', folder.get('likes'));
|
||||
this.set('allowLikes', folder.get('allowLikes'));
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
@ -112,10 +89,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
}
|
||||
},
|
||||
|
||||
getDefaultInvitationMessage() {
|
||||
return "Hey there, I am sharing the " + this.get('space.name') + " space (in " + this.get("appMeta.title") + ") with you so we can both collaborate on documents.";
|
||||
},
|
||||
|
||||
setupImport() {
|
||||
// already done init?
|
||||
if (is.not.null(this.get('dropzone'))) {
|
||||
|
@ -194,48 +167,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
return true;
|
||||
},
|
||||
|
||||
onSpaceInvite(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var email = this.get('inviteEmail').trim().replace(/ /g, '');
|
||||
var message = this.get('inviteMessage').trim();
|
||||
|
||||
if (message.length === 0) {
|
||||
message = this.getDefaultInvitationMessage();
|
||||
}
|
||||
|
||||
if (email.length === 0) {
|
||||
$('#space-invite-email').addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var result = {
|
||||
Message: message,
|
||||
Recipients: []
|
||||
};
|
||||
|
||||
// Check for multiple email addresses
|
||||
if (email.indexOf(",") > -1) {
|
||||
result.Recipients = email.split(',');
|
||||
}
|
||||
if (email.indexOf(";") > -1 && result.Recipients.length === 0) {
|
||||
result.Recipients = email.split(';');
|
||||
}
|
||||
|
||||
// Handle just one email address
|
||||
if (result.Recipients.length === 0 && email.length > 0) {
|
||||
result.Recipients.push(email);
|
||||
}
|
||||
|
||||
this.set('inviteEmail', '');
|
||||
|
||||
this.get('spaceService').share(this.get('space.id'), result).then(() => {
|
||||
$('#space-invite-email').removeClass('is-invalid');
|
||||
});
|
||||
|
||||
this.modalClose('#space-invite-modal');
|
||||
},
|
||||
|
||||
onSpaceDelete(e) {
|
||||
e.preventDefault();
|
||||
|
||||
|
@ -359,46 +290,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
|
|||
let cb = this.get('onRefresh');
|
||||
cb();
|
||||
}
|
||||
},
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
onSetSpaceType(t) {
|
||||
this.set('spaceType', t);
|
||||
},
|
||||
|
||||
onSetLikes(l) {
|
||||
this.set('allowLikes', l);
|
||||
schedule('afterRender', () => {
|
||||
if (l) $('#space-likes-prompt').focus();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
onSpaceSettings() {
|
||||
let space = this.get('space');
|
||||
space.set('folderType', this.get('spaceType.id'));
|
||||
|
||||
let allowLikes = this.get('allowLikes');
|
||||
space.set('likes', allowLikes ? this.get('likes') : '');
|
||||
|
||||
this.get('spaceService').save(space).then(() => {
|
||||
});
|
||||
|
||||
this.modalClose("#space-settings-modal");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue