mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
parent
4445f41801
commit
4e082b4159
26 changed files with 937 additions and 611 deletions
|
@ -18,24 +18,24 @@ const {
|
|||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
titleEmpty: computed.empty('model.title'),
|
||||
messageEmpty: computed.empty('model.message'),
|
||||
titleEmpty: computed.empty('model.general.title'),
|
||||
messageEmpty: computed.empty('model.general.message'),
|
||||
hasTitleInputError: computed.and('titleEmpty', 'titleError'),
|
||||
hasMessageInputError: computed.and('messageEmpty', 'messageError'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
if (isEmpty(this.get('model.title'))) {
|
||||
if (isEmpty(this.get('model.general.title'))) {
|
||||
set(this, 'titleError', true);
|
||||
return $("#siteTitle").focus();
|
||||
}
|
||||
|
||||
if (isEmpty(this.get('model.message'))) {
|
||||
if (isEmpty(this.get('model.general.message'))) {
|
||||
set(this, 'messageError', true);
|
||||
return $("#siteMessage").focus();
|
||||
}
|
||||
|
||||
this.model.set('allowAnonymousAccess', Ember.$("#allowAnonymousAccess").prop('checked'));
|
||||
this.model.general.set('allowAnonymousAccess', Ember.$("#allowAnonymousAccess").prop('checked'));
|
||||
this.get('save')().then(() => {
|
||||
set(this, 'titleError', false);
|
||||
set(this, 'messageError', false);
|
||||
|
|
52
app/app/components/global-settings.js
Normal file
52
app/app/components/global-settings.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
// 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 Ember from 'ember';
|
||||
|
||||
const {
|
||||
computed
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
SMTPHostEmptyError: computed.empty('model.global.host'),
|
||||
SMTPPortEmptyError: computed.empty('model.global.port'),
|
||||
SMTPSenderEmptyError: computed.empty('model.global.sender'),
|
||||
SMTPUserIdEmptyError: computed.empty('model.global.userid'),
|
||||
SMTPPasswordEmptyError: computed.empty('model.global.password'),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
if (this.get('SMTPHostEmptyError')) {
|
||||
$("#smtp-host").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPPortEmptyError')) {
|
||||
$("#smtp-port").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPSenderEmptyError')) {
|
||||
$("#smtp-sender").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPUserIdEmptyError')) {
|
||||
$("#smtp-userid").focus();
|
||||
return;
|
||||
}
|
||||
if (this.get('SMTPPasswordEmptyError')) {
|
||||
$("#smtp-password").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
this.get('save')().then(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -22,6 +22,7 @@ export default Model.extend({
|
|||
active: attr('boolean', { defaultValue: false }),
|
||||
editor: attr('boolean', { defaultValue: false }),
|
||||
admin: attr('boolean', { defaultValue: false }),
|
||||
global: attr('boolean', { defaultValue: false }),
|
||||
accounts: attr(),
|
||||
created: attr(),
|
||||
revised: attr(),
|
||||
|
|
|
@ -17,7 +17,7 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
|
||||
actions: {
|
||||
save() {
|
||||
return this.get('orgService').save(this.model).then(() => {
|
||||
return this.get('orgService').save(this.model.general).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// 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>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import Ember from 'ember';
|
||||
import RSVP from 'rsvp';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
|
@ -25,10 +26,13 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
|
||||
model() {
|
||||
let orgId = this.get("appMeta.orgId");
|
||||
return this.get('orgService').getOrg(orgId);
|
||||
|
||||
return RSVP.hash({
|
||||
general: this.get('orgService').getOrg(orgId)
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Settings | Documize";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div class="input-form form-borderless">
|
||||
{{general-settings model=model save=(action 'save')}}
|
||||
{{general-settings model=model save=(action 'save')}}
|
||||
</div>
|
||||
|
|
27
app/app/pods/customize/global/controller.js
Normal file
27
app/app/pods/customize/global/controller.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
// 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 Ember from 'ember';
|
||||
import NotifierMixin from "../../../mixins/notifier";
|
||||
|
||||
export default Ember.Controller.extend(NotifierMixin, {
|
||||
global: Ember.inject.service(),
|
||||
|
||||
actions: {
|
||||
save() {
|
||||
if(this.get('session.isGlobalAdmin')) {
|
||||
return this.get('global').saveConfig(this.model.global).then(() => {
|
||||
this.showNotification('Saved');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
36
app/app/pods/customize/global/route.js
Normal file
36
app/app/pods/customize/global/route.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
// 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 Ember from 'ember';
|
||||
import RSVP from 'rsvp';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
appMeta: Ember.inject.service(),
|
||||
session: Ember.inject.service(),
|
||||
global: Ember.inject.service(),
|
||||
|
||||
beforeModel() {
|
||||
if (!this.get("session.isGlobalAdmin")) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
return RSVP.hash({
|
||||
global: this.get('global').getConfig()
|
||||
});
|
||||
},
|
||||
|
||||
activate() {
|
||||
document.title = "Settings | Documize";
|
||||
}
|
||||
});
|
3
app/app/pods/customize/global/template.hbs
Normal file
3
app/app/pods/customize/global/template.hbs
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="input-form form-borderless">
|
||||
{{global-settings model=model save=(action 'save')}}
|
||||
</div>
|
|
@ -8,6 +8,9 @@
|
|||
{{#link-to 'customize.general' activeClass='selected' class="option" tagName="li"}}General{{/link-to}}
|
||||
{{#link-to 'customize.folders' activeClass='selected' class="option" tagName="li"}}Spaces{{/link-to}}
|
||||
{{#link-to 'customize.users' activeClass='selected' class="option" tagName="li"}}Users{{/link-to}}
|
||||
{{#if session.isGlobalAdmin}}
|
||||
{{#link-to 'customize.global' activeClass='selected' class="option" tagName="li"}}Global{{/link-to}}
|
||||
{{/if}}
|
||||
</ul>
|
||||
</div>
|
||||
{{/layout/zone-sidebar}}
|
||||
|
|
|
@ -50,6 +50,9 @@ export default Router.map(function () {
|
|||
});
|
||||
this.route('folders', {
|
||||
path: 'folders'
|
||||
});
|
||||
this.route('global', {
|
||||
path: 'global'
|
||||
});
|
||||
});
|
||||
|
||||
|
|
44
app/app/services/global.js
Normal file
44
app/app/services/global.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
// 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 Ember from 'ember';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Service.extend({
|
||||
sessionService: service('session'),
|
||||
ajax: service(),
|
||||
appMeta: service(),
|
||||
store: service(),
|
||||
|
||||
// Returns global configuration.
|
||||
getConfig() {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// Saves global configuration.
|
||||
saveConfig(config) {
|
||||
if(this.get('sessionService.isGlobalAdmin')) {
|
||||
return this.get('ajax').request(`global`, {
|
||||
method: 'PUT',
|
||||
data: JSON.stringify(config)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -35,6 +35,10 @@ export default SimpleAuthSession.extend({
|
|||
let data = this.get('user');
|
||||
return data.get('editor');
|
||||
}),
|
||||
isGlobalAdmin: computed('user', function () {
|
||||
let data = this.get('user');
|
||||
return data.get('global');
|
||||
}),
|
||||
|
||||
init: function () {
|
||||
this.set('isMac', is.mac());
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
<div class="input-control">
|
||||
<label>Title</label>
|
||||
<div class="tip">Describe the title of this Documize instance</div>
|
||||
{{focus-input id="siteTitle" type="text" value=model.title class=(if hasTitleInputError 'error')}}
|
||||
{{focus-input id="siteTitle" type="text" value=model.general.title class=(if hasTitleInputError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Message</label>
|
||||
<div class="tip">Describe the purpose of this Documize instance</div>
|
||||
{{textarea id="siteMessage" rows="3" value=model.message class=(if hasMessageInputError 'error')}}
|
||||
{{textarea id="siteMessage" rows="3" value=model.general.message class=(if hasMessageInputError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>Anonymous Access</label>
|
||||
<div class="tip">Content within "Everyone" will be made available to anonymous users</div>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="allowAnonymousAccess" checked= {{model.allowAnonymousAccess}} />
|
||||
<input type="checkbox" id="allowAnonymousAccess" checked= {{model.general.allowAnonymousAccess}} />
|
||||
<label for="allowAnonymousAccess">Allow anyone to access this Documize instance</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
34
app/app/templates/components/global-settings.hbs
Normal file
34
app/app/templates/components/global-settings.hbs
Normal file
|
@ -0,0 +1,34 @@
|
|||
<form>
|
||||
<div class="input-control">
|
||||
<label>Global Settings</label>
|
||||
<div class="tip">Settings applicable for all tenants</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Host</label>
|
||||
<div class="tip">e.g. my.host.com</div>
|
||||
{{focus-input id="smtp-host" type="text" value=model.global.host class=(if SMTPHostEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Host</label>
|
||||
<div class="tip">e.g. 587</div>
|
||||
{{input id="smtp-port" type="text" value=model.global.port class=(if SMTPPortEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Sender</label>
|
||||
<div class="tip">e.g. noreply@documize.com</div>
|
||||
{{input id="smtp-sender" type="text" value=model.global.sender class=(if SMTPSenderEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP User ID</label>
|
||||
<div class="tip">Your credentials</div>
|
||||
{{input id="smtp-userid" type="text" value=model.global.userid class=(if SMTPUserIdEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="input-control">
|
||||
<label>SMTP Password</label>
|
||||
<div class="tip">Your credentials</div>
|
||||
{{input id="smtp-password" type="text" value=model.global.password class=(if SMTPPasswordEmptyError 'error')}}
|
||||
</div>
|
||||
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue