summaryrefslogtreecommitdiffstats
path: root/client/components/settings/settingBody.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/settings/settingBody.js')
-rw-r--r--client/components/settings/settingBody.js76
1 files changed, 71 insertions, 5 deletions
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 7230d893..8279a092 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -6,6 +6,7 @@ BlazeComponent.extendComponent({
this.emailSetting = new ReactiveVar(false);
this.accountSetting = new ReactiveVar(false);
this.announcementSetting = new ReactiveVar(false);
+ this.layoutSetting = new ReactiveVar(false);
Meteor.subscribe('setting');
Meteor.subscribe('mailServer');
@@ -58,6 +59,12 @@ BlazeComponent.extendComponent({
toggleTLS() {
$('#mail-server-tls').toggleClass('is-checked');
},
+ toggleHideLogo() {
+ $('#hide-logo').toggleClass('is-checked');
+ },
+ toggleDisplayAuthenticationMethod() {
+ $('#display-authentication-method').toggleClass('is-checked');
+ },
switchMenu(event) {
const target = $(event.target);
if (!target.hasClass('active')) {
@@ -68,6 +75,7 @@ BlazeComponent.extendComponent({
this.emailSetting.set('email-setting' === targetID);
this.accountSetting.set('account-setting' === targetID);
this.announcementSetting.set('announcement-setting' === targetID);
+ this.layoutSetting.set('layout-setting' === targetID);
}
},
@@ -82,7 +90,7 @@ BlazeComponent.extendComponent({
},
inviteThroughEmail() {
- const emails = $('#email-to-invite').val().trim().split('\n').join(',').split(',');
+ const emails = $('#email-to-invite').val().toLowerCase().trim().split('\n').join(',').split(',');
const boardsToInvite = [];
$('.js-toggle-board-choose .materialCheckBox.is-checked').each(function () {
boardsToInvite.push($(this).data('id'));
@@ -129,19 +137,48 @@ BlazeComponent.extendComponent({
},
+ saveLayout() {
+ this.setLoading(true);
+ $('li').removeClass('has-error');
+
+ const productName = $('#product-name').val().trim();
+ const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true');
+ const displayAuthenticationMethod = ($('input[name=displayAuthenticationMethod]:checked').val() === 'true');
+ const defaultAuthenticationMethod = $('#defaultAuthenticationMethod').val();
+ const customHTMLafterBodyStart = $('#customHTMLafterBodyStart').val().trim();
+ const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd').val().trim();
+
+ try {
+ Settings.update(Settings.findOne()._id, {
+ $set: {
+ productName,
+ hideLogo: hideLogoChange,
+ customHTMLafterBodyStart,
+ customHTMLbeforeBodyEnd,
+ displayAuthenticationMethod,
+ defaultAuthenticationMethod,
+ },
+ });
+ } catch (e) {
+ return;
+ } finally {
+ this.setLoading(false);
+ }
+
+ DocHead.setTitle(productName);
+
+ },
+
sendSMTPTestEmail() {
Meteor.call('sendSMTPTestEmail', (err, ret) => {
- if (!err && ret) { /* eslint-disable no-console */
+ if (!err && ret) {
const message = `${TAPi18n.__(ret.message)}: ${ret.email}`;
- console.log(message);
alert(message);
} else {
const reason = err.reason || '';
const message = `${TAPi18n.__(err.error)}\n${reason}`;
- console.log(message, err);
alert(message);
}
- /* eslint-enable no-console */
});
},
@@ -154,6 +191,9 @@ BlazeComponent.extendComponent({
'click button.js-email-invite': this.inviteThroughEmail,
'click button.js-save': this.saveMailServerInfo,
'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
+ 'click a.js-toggle-hide-logo': this.toggleHideLogo,
+ 'click button.js-save-layout': this.saveLayout,
+ 'click a.js-toggle-display-authentication-method': this.toggleDisplayAuthenticationMethod,
}];
},
}).register('setting');
@@ -226,3 +266,29 @@ BlazeComponent.extendComponent({
}];
},
}).register('announcementSettings');
+
+
+Template.selectAuthenticationMethod.onCreated(function() {
+ this.authenticationMethods = new ReactiveVar([]);
+
+ Meteor.call('getAuthenticationsEnabled', (_, result) => {
+ if (result) {
+ // TODO : add a management of different languages
+ // (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
+ this.authenticationMethods.set([
+ {value: 'password'},
+ // Gets only the authentication methods availables
+ ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
+ ]);
+ }
+ });
+});
+
+Template.selectAuthenticationMethod.helpers({
+ authentications() {
+ return Template.instance().authenticationMethods.get();
+ },
+ isSelected(match) {
+ return Template.instance().data.authenticationMethod === match;
+ },
+});