Skip to content

Commit 79951c4

Browse files
Merge pull request #49 from documize/smtp-config-gui
smtp setting gui
2 parents 4445f41 + 4e082b4 commit 79951c4

File tree

26 files changed

+937
-611
lines changed

26 files changed

+937
-611
lines changed

app/app/components/general-settings.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ const {
1818
} = Ember;
1919

2020
export default Ember.Component.extend({
21-
titleEmpty: computed.empty('model.title'),
22-
messageEmpty: computed.empty('model.message'),
21+
titleEmpty: computed.empty('model.general.title'),
22+
messageEmpty: computed.empty('model.general.message'),
2323
hasTitleInputError: computed.and('titleEmpty', 'titleError'),
2424
hasMessageInputError: computed.and('messageEmpty', 'messageError'),
2525

2626
actions: {
2727
save() {
28-
if (isEmpty(this.get('model.title'))) {
28+
if (isEmpty(this.get('model.general.title'))) {
2929
set(this, 'titleError', true);
3030
return $("#siteTitle").focus();
3131
}
3232

33-
if (isEmpty(this.get('model.message'))) {
33+
if (isEmpty(this.get('model.general.message'))) {
3434
set(this, 'messageError', true);
3535
return $("#siteMessage").focus();
3636
}
3737

38-
this.model.set('allowAnonymousAccess', Ember.$("#allowAnonymousAccess").prop('checked'));
38+
this.model.general.set('allowAnonymousAccess', Ember.$("#allowAnonymousAccess").prop('checked'));
3939
this.get('save')().then(() => {
4040
set(this, 'titleError', false);
4141
set(this, 'messageError', false);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
2+
//
3+
// This software (Documize Community Edition) is licensed under
4+
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
5+
//
6+
// You can operate outside the AGPL restrictions by purchasing
7+
// Documize Enterprise Edition and obtaining a commercial license
8+
// by contacting <[email protected]>.
9+
//
10+
// https://documize.com
11+
12+
import Ember from 'ember';
13+
14+
const {
15+
computed
16+
} = Ember;
17+
18+
export default Ember.Component.extend({
19+
SMTPHostEmptyError: computed.empty('model.global.host'),
20+
SMTPPortEmptyError: computed.empty('model.global.port'),
21+
SMTPSenderEmptyError: computed.empty('model.global.sender'),
22+
SMTPUserIdEmptyError: computed.empty('model.global.userid'),
23+
SMTPPasswordEmptyError: computed.empty('model.global.password'),
24+
25+
actions: {
26+
save() {
27+
if (this.get('SMTPHostEmptyError')) {
28+
$("#smtp-host").focus();
29+
return;
30+
}
31+
if (this.get('SMTPPortEmptyError')) {
32+
$("#smtp-port").focus();
33+
return;
34+
}
35+
if (this.get('SMTPSenderEmptyError')) {
36+
$("#smtp-sender").focus();
37+
return;
38+
}
39+
if (this.get('SMTPUserIdEmptyError')) {
40+
$("#smtp-userid").focus();
41+
return;
42+
}
43+
if (this.get('SMTPPasswordEmptyError')) {
44+
$("#smtp-password").focus();
45+
return;
46+
}
47+
48+
this.get('save')().then(() => {
49+
});
50+
}
51+
}
52+
});

app/app/models/user.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default Model.extend({
2222
active: attr('boolean', { defaultValue: false }),
2323
editor: attr('boolean', { defaultValue: false }),
2424
admin: attr('boolean', { defaultValue: false }),
25+
global: attr('boolean', { defaultValue: false }),
2526
accounts: attr(),
2627
created: attr(),
2728
revised: attr(),

app/app/pods/customize/general/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default Ember.Controller.extend(NotifierMixin, {
1717

1818
actions: {
1919
save() {
20-
return this.get('orgService').save(this.model).then(() => {
20+
return this.get('orgService').save(this.model.general).then(() => {
2121
this.showNotification('Saved');
2222
});
2323
}

app/app/pods/customize/general/route.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
22
//
3-
// This software (Documize Community Edition) is licensed under
3+
// This software (Documize Community Edition) is licensed under
44
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
55
//
66
// You can operate outside the AGPL restrictions by purchasing
77
// Documize Enterprise Edition and obtaining a commercial license
8-
// by contacting <[email protected]>.
8+
// by contacting <[email protected]>.
99
//
1010
// https://documize.com
1111

1212
import Ember from 'ember';
13+
import RSVP from 'rsvp';
1314
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
1415

1516
export default Ember.Route.extend(AuthenticatedRouteMixin, {
@@ -25,10 +26,13 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
2526

2627
model() {
2728
let orgId = this.get("appMeta.orgId");
28-
return this.get('orgService').getOrg(orgId);
29+
30+
return RSVP.hash({
31+
general: this.get('orgService').getOrg(orgId)
32+
});
2933
},
3034

3135
activate() {
3236
document.title = "Settings | Documize";
3337
}
34-
});
38+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="input-form form-borderless">
2-
{{general-settings model=model save=(action 'save')}}
2+
{{general-settings model=model save=(action 'save')}}
33
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
2+
//
3+
// This software (Documize Community Edition) is licensed under
4+
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
5+
//
6+
// You can operate outside the AGPL restrictions by purchasing
7+
// Documize Enterprise Edition and obtaining a commercial license
8+
// by contacting <[email protected]>.
9+
//
10+
// https://documize.com
11+
12+
import Ember from 'ember';
13+
import NotifierMixin from "../../../mixins/notifier";
14+
15+
export default Ember.Controller.extend(NotifierMixin, {
16+
global: Ember.inject.service(),
17+
18+
actions: {
19+
save() {
20+
if(this.get('session.isGlobalAdmin')) {
21+
return this.get('global').saveConfig(this.model.global).then(() => {
22+
this.showNotification('Saved');
23+
});
24+
}
25+
}
26+
}
27+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
2+
//
3+
// This software (Documize Community Edition) is licensed under
4+
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
5+
//
6+
// You can operate outside the AGPL restrictions by purchasing
7+
// Documize Enterprise Edition and obtaining a commercial license
8+
// by contacting <[email protected]>.
9+
//
10+
// https://documize.com
11+
12+
import Ember from 'ember';
13+
import RSVP from 'rsvp';
14+
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
15+
16+
export default Ember.Route.extend(AuthenticatedRouteMixin, {
17+
appMeta: Ember.inject.service(),
18+
session: Ember.inject.service(),
19+
global: Ember.inject.service(),
20+
21+
beforeModel() {
22+
if (!this.get("session.isGlobalAdmin")) {
23+
this.transitionTo('auth.login');
24+
}
25+
},
26+
27+
model() {
28+
return RSVP.hash({
29+
global: this.get('global').getConfig()
30+
});
31+
},
32+
33+
activate() {
34+
document.title = "Settings | Documize";
35+
}
36+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="input-form form-borderless">
2+
{{global-settings model=model save=(action 'save')}}
3+
</div>

app/app/pods/customize/template.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
{{#link-to 'customize.general' activeClass='selected' class="option" tagName="li"}}General{{/link-to}}
99
{{#link-to 'customize.folders' activeClass='selected' class="option" tagName="li"}}Spaces{{/link-to}}
1010
{{#link-to 'customize.users' activeClass='selected' class="option" tagName="li"}}Users{{/link-to}}
11+
{{#if session.isGlobalAdmin}}
12+
{{#link-to 'customize.global' activeClass='selected' class="option" tagName="li"}}Global{{/link-to}}
13+
{{/if}}
1114
</ul>
1215
</div>
1316
{{/layout/zone-sidebar}}

0 commit comments

Comments
 (0)