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.js143
1 files changed, 90 insertions, 53 deletions
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 8279a092..4ec0c759 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -25,7 +25,9 @@ BlazeComponent.extendComponent({
checkField(selector) {
const value = $(selector).val();
if (!value || value.trim() === '') {
- $(selector).parents('li.smtp-form').addClass('has-error');
+ $(selector)
+ .parents('li.smtp-form')
+ .addClass('has-error');
throw Error('blank field');
} else {
return value;
@@ -37,18 +39,23 @@ BlazeComponent.extendComponent({
},
boards() {
- return Boards.find({
- archived: false,
- 'members.userId': Meteor.userId(),
- 'members.isAdmin': true,
- }, {
- sort: ['title'],
- });
+ return Boards.find(
+ {
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ 'members.isAdmin': true,
+ },
+ {
+ sort: ['title'],
+ },
+ );
},
toggleRegistration() {
this.setLoading(true);
const registrationClosed = this.currentSetting().disableRegistration;
- Settings.update(Settings.findOne()._id, {$set: {disableRegistration: !registrationClosed}});
+ Settings.update(Settings.findOne()._id, {
+ $set: { disableRegistration: !registrationClosed },
+ });
this.setLoading(false);
if (registrationClosed) {
$('.invite-people').slideUp();
@@ -90,13 +97,19 @@ BlazeComponent.extendComponent({
},
inviteThroughEmail() {
- const emails = $('#email-to-invite').val().toLowerCase().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 () {
+ $('.js-toggle-board-choose .materialCheckBox.is-checked').each(function() {
boardsToInvite.push($(this).data('id'));
});
const validEmails = [];
- emails.forEach((email) => {
+ emails.forEach(email => {
if (email && SimpleSchema.RegEx.Email.test(email.trim())) {
validEmails.push(email.trim());
}
@@ -119,14 +132,22 @@ BlazeComponent.extendComponent({
try {
const host = this.checkField('#mail-server-host');
const port = this.checkField('#mail-server-port');
- const username = $('#mail-server-username').val().trim();
- const password = $('#mail-server-password').val().trim();
+ const username = $('#mail-server-username')
+ .val()
+ .trim();
+ const password = $('#mail-server-password')
+ .val()
+ .trim();
const from = this.checkField('#mail-server-from');
const tls = $('#mail-server-tls.is-checked').length > 0;
Settings.update(Settings.findOne()._id, {
$set: {
- 'mailServer.host': host, 'mailServer.port': port, 'mailServer.username': username,
- 'mailServer.password': password, 'mailServer.enableTLS': tls, 'mailServer.from': from,
+ 'mailServer.host': host,
+ 'mailServer.port': port,
+ 'mailServer.username': username,
+ 'mailServer.password': password,
+ 'mailServer.enableTLS': tls,
+ 'mailServer.from': from,
},
});
} catch (e) {
@@ -134,19 +155,25 @@ BlazeComponent.extendComponent({
} finally {
this.setLoading(false);
}
-
},
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 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();
+ const customHTMLafterBodyStart = $('#customHTMLafterBodyStart')
+ .val()
+ .trim();
+ const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd')
+ .val()
+ .trim();
try {
Settings.update(Settings.findOne()._id, {
@@ -166,7 +193,6 @@ BlazeComponent.extendComponent({
}
DocHead.setTitle(productName);
-
},
sendSMTPTestEmail() {
@@ -183,31 +209,35 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click a.js-toggle-registration': this.toggleRegistration,
- 'click a.js-toggle-tls': this.toggleTLS,
- 'click a.js-setting-menu': this.switchMenu,
- 'click a.js-toggle-board-choose': this.checkBoard,
- '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,
- }];
+ return [
+ {
+ 'click a.js-toggle-registration': this.toggleRegistration,
+ 'click a.js-toggle-tls': this.toggleTLS,
+ 'click a.js-setting-menu': this.switchMenu,
+ 'click a.js-toggle-board-choose': this.checkBoard,
+ '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');
BlazeComponent.extendComponent({
-
saveAccountsChange() {
- const allowEmailChange = ($('input[name=allowEmailChange]:checked').val() === 'true');
- const allowUserNameChange = ($('input[name=allowUserNameChange]:checked').val() === 'true');
+ const allowEmailChange =
+ $('input[name=allowEmailChange]:checked').val() === 'true';
+ const allowUserNameChange =
+ $('input[name=allowUserNameChange]:checked').val() === 'true';
AccountSettings.update('accounts-allowEmailChange', {
- $set: {'booleanValue': allowEmailChange},
+ $set: { booleanValue: allowEmailChange },
});
AccountSettings.update('accounts-allowUserNameChange', {
- $set: {'booleanValue': allowUserNameChange},
+ $set: { booleanValue: allowUserNameChange },
});
},
@@ -219,9 +249,11 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click button.js-accounts-save': this.saveAccountsChange,
- }];
+ return [
+ {
+ 'click button.js-accounts-save': this.saveAccountsChange,
+ },
+ ];
},
}).register('accountSettings');
@@ -239,9 +271,11 @@ BlazeComponent.extendComponent({
},
saveMessage() {
- const message = $('#admin-announcement').val().trim();
+ const message = $('#admin-announcement')
+ .val()
+ .trim();
Announcements.update(Announcements.findOne()._id, {
- $set: {'body': message},
+ $set: { body: message },
});
},
@@ -249,7 +283,7 @@ BlazeComponent.extendComponent({
this.setLoading(true);
const isActive = this.currentSetting().enabled;
Announcements.update(Announcements.findOne()._id, {
- $set: {'enabled': !isActive},
+ $set: { enabled: !isActive },
});
this.setLoading(false);
if (isActive) {
@@ -260,14 +294,15 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click a.js-toggle-activemessage': this.toggleActive,
- 'click button.js-announcement-save': this.saveMessage,
- }];
+ return [
+ {
+ 'click a.js-toggle-activemessage': this.toggleActive,
+ 'click button.js-announcement-save': this.saveMessage,
+ },
+ ];
},
}).register('announcementSettings');
-
Template.selectAuthenticationMethod.onCreated(function() {
this.authenticationMethods = new ReactiveVar([]);
@@ -276,9 +311,11 @@ Template.selectAuthenticationMethod.onCreated(function() {
// TODO : add a management of different languages
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
this.authenticationMethods.set([
- {value: 'password'},
+ { value: 'password' },
// Gets only the authentication methods availables
- ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
+ ...Object.entries(result)
+ .filter(e => e[1])
+ .map(e => ({ value: e[0] })),
]);
}
});