1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

revert real usage of templateUrl

This commit is contained in:
Sylvain 2020-09-21 15:11:39 +02:00
parent 9b6e5408f9
commit 31d1071f87
4 changed files with 232 additions and 236 deletions

View File

@ -58,8 +58,8 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
prefix: settings.invoice_prefix, prefix: settings.invoice_prefix,
nextId: 40, nextId: 40,
date: moment().format('DDMMYYYY'), date: moment().format('DDMMYYYY'),
template: require('../../../../templates/editPrefix.html') templateUrl: 'editPrefix.html'
} };
// Invoices parameters // Invoices parameters
$scope.invoice = { $scope.invoice = {
@ -67,22 +67,22 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
reference: { reference: {
model: '', model: '',
help: null, help: null,
template: require('../../../../templates/editReference.html') templateUrl: 'editReference.html'
}, },
code: { code: {
model: '', model: '',
active: true, active: true,
template: require('../../../../templates/editCode.html') templateUrl: 'editCode.html'
}, },
number: { number: {
model: '', model: '',
help: null, help: null,
template: require('../../../../templates/editNumber.html') templateUrl: 'editNumber.html'
}, },
VAT: { VAT: {
rate: 19.6, rate: 19.6,
active: false, active: false,
template: require('../../../../templates/editVAT.html') templateUrl: 'editVAT.html'
}, },
text: { text: {
content: '' content: ''
@ -96,87 +96,87 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
$scope.settings = { $scope.settings = {
journalCode: { journalCode: {
name: 'accounting_journal_code', name: 'accounting_journal_code',
value: settings['accounting_journal_code'] value: settings.accounting_journal_code
}, },
cardClientCode: { cardClientCode: {
name: 'accounting_card_client_code', name: 'accounting_card_client_code',
value: settings['accounting_card_client_code'] value: settings.accounting_card_client_code
}, },
cardClientLabel: { cardClientLabel: {
name: 'accounting_card_client_label', name: 'accounting_card_client_label',
value: settings['accounting_card_client_label'] value: settings.accounting_card_client_label
}, },
walletClientCode: { walletClientCode: {
name: 'accounting_wallet_client_code', name: 'accounting_wallet_client_code',
value: settings['accounting_wallet_client_code'] value: settings.accounting_wallet_client_code
}, },
walletClientLabel: { walletClientLabel: {
name: 'accounting_wallet_client_label', name: 'accounting_wallet_client_label',
value: settings['accounting_wallet_client_label'] value: settings.accounting_wallet_client_label
}, },
otherClientCode: { otherClientCode: {
name: 'accounting_other_client_code', name: 'accounting_other_client_code',
value: settings['accounting_other_client_code'] value: settings.accounting_other_client_code
}, },
otherClientLabel: { otherClientLabel: {
name: 'accounting_other_client_label', name: 'accounting_other_client_label',
value: settings['accounting_other_client_label'] value: settings.accounting_other_client_label
}, },
walletCode: { walletCode: {
name: 'accounting_wallet_code', name: 'accounting_wallet_code',
value: settings['accounting_wallet_code'] value: settings.accounting_wallet_code
}, },
walletLabel: { walletLabel: {
name: 'accounting_wallet_label', name: 'accounting_wallet_label',
value: settings['accounting_wallet_label'] value: settings.accounting_wallet_label
}, },
vatCode: { vatCode: {
name: 'accounting_VAT_code', name: 'accounting_VAT_code',
value: settings['accounting_VAT_code'] value: settings.accounting_VAT_code
}, },
vatLabel: { vatLabel: {
name: 'accounting_VAT_label', name: 'accounting_VAT_label',
value: settings['accounting_VAT_label'] value: settings.accounting_VAT_label
}, },
subscriptionCode: { subscriptionCode: {
name: 'accounting_subscription_code', name: 'accounting_subscription_code',
value: settings['accounting_subscription_code'] value: settings.accounting_subscription_code
}, },
subscriptionLabel: { subscriptionLabel: {
name: 'accounting_subscription_label', name: 'accounting_subscription_label',
value: settings['accounting_subscription_label'] value: settings.accounting_subscription_label
}, },
machineCode: { machineCode: {
name: 'accounting_Machine_code', name: 'accounting_Machine_code',
value: settings['accounting_Machine_code'] value: settings.accounting_Machine_code
}, },
machineLabel: { machineLabel: {
name: 'accounting_Machine_label', name: 'accounting_Machine_label',
value: settings['accounting_Machine_label'] value: settings.accounting_Machine_label
}, },
trainingCode: { trainingCode: {
name: 'accounting_Training_code', name: 'accounting_Training_code',
value: settings['accounting_Training_code'] value: settings.accounting_Training_code
}, },
trainingLabel: { trainingLabel: {
name: 'accounting_Training_label', name: 'accounting_Training_label',
value: settings['accounting_Training_label'] value: settings.accounting_Training_label
}, },
eventCode: { eventCode: {
name: 'accounting_Event_code', name: 'accounting_Event_code',
value: settings['accounting_Event_code'] value: settings.accounting_Event_code
}, },
eventLabel: { eventLabel: {
name: 'accounting_Event_label', name: 'accounting_Event_label',
value: settings['accounting_Event_label'] value: settings.accounting_Event_label
}, },
spaceCode: { spaceCode: {
name: 'accounting_Space_code', name: 'accounting_Space_code',
value: settings['accounting_Space_code'] value: settings.accounting_Space_code
}, },
spaceLabel: { spaceLabel: {
name: 'accounting_Space_label', name: 'accounting_Space_label',
value: settings['accounting_Space_label'] value: settings.accounting_Space_label
} }
}; };
@ -440,15 +440,14 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
$scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); }; $scope.ok = function () { $uibModalInstance.close({ rate: $scope.rate, active: $scope.isSelected }); };
$scope.cancel = function () { $uibModalInstance.dismiss('cancel'); }; $scope.cancel = function () { $uibModalInstance.dismiss('cancel'); };
const initialize = function () { const initialize = function () {
rateHistory.setting.history.forEach(function (rate) { rateHistory.setting.history.forEach(function (rate) {
$scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user }) $scope.history.push({ date: rate.created_at, rate: rate.value, user: rate.user });
}); });
activeHistory.setting.history.forEach(function (v) { activeHistory.setting.history.forEach(function (v) {
$scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user }) $scope.history.push({ date: v.created_at, enabled: v.value === 'true', user: v.user });
}); });
} };
initialize(); initialize();
}] }]
@ -589,7 +588,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; } lastClosingEnd () { return AccountingPeriod.lastClosingEnd().$promise; }
} }
}); });
} };
$scope.toggleExportModal = function () { $scope.toggleExportModal = function () {
$uibModal.open({ $uibModal.open({
@ -597,7 +596,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
controller: 'AccountingExportModalController', controller: 'AccountingExportModalController',
size: 'xl' size: 'xl'
}); });
} };
/** /**
* Test if the given date is within a closed accounting period * Test if the given date is within a closed accounting period
@ -611,7 +610,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
} }
} }
return false; return false;
} };
/** /**
* Callback to bulk save all settings in the page to the database with their values * Callback to bulk save all settings in the page to the database with their values
@ -625,7 +624,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
console.error(error); console.error(error);
} }
); );
} };
/** /**
* Return the name of the operator that creates the invoice * Return the name of the operator that creates the invoice
@ -634,7 +633,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
if (!invoice.operator) return ''; if (!invoice.operator) return '';
return `${invoice.operator.first_name} ${invoice.operator.last_name}`; return `${invoice.operator.first_name} ${invoice.operator.last_name}`;
} };
/** /**
* Open a modal dialog which ask for the stripe keys * Open a modal dialog which ask for the stripe keys
@ -647,7 +646,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
// otherwise, open a modal to ask for the stripe keys // otherwise, open a modal to ask for the stripe keys
const modalInstance = $uibModal.open({ const modalInstance = $uibModal.open({
template: require('../../../../templates/stripeKeys.html'), templateUrl: 'stripeKeys.html',
controller: 'StripeKeysModalController', controller: 'StripeKeysModalController',
resolve: { resolve: {
stripeKeys: ['Setting', function (Setting) { return Setting.query({ names: "['stripe_public_key', 'stripe_secret_key']" }).$promise; }] stripeKeys: ['Setting', function (Setting) { return Setting.query({ names: "['stripe_public_key', 'stripe_secret_key']" }).$promise; }]
@ -658,19 +657,19 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
if (success) { if (success) {
Setting.get({ name: 'stripe_public_key' }, function (res) { Setting.get({ name: 'stripe_public_key' }, function (res) {
$scope.allSettings.stripe_public_key = res.setting.value; $scope.allSettings.stripe_public_key = res.setting.value;
}) });
Setting.isPresent({ name: 'stripe_secret_key' }, function (res) { Setting.isPresent({ name: 'stripe_secret_key' }, function (res) {
$scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : ''); $scope.stripeSecretKey = (res.isPresent ? STRIPE_SK_HIDDEN : '');
}) });
Payment.onlinePaymentStatus(function (res) { Payment.onlinePaymentStatus(function (res) {
$scope.onlinePaymentStatus = res.status; $scope.onlinePaymentStatus = res.status;
}); });
} }
}) });
// return the promise // return the promise
return modalInstance.result; return modalInstance.result;
} };
/** /**
* Setup the feature-tour for the admin/invoices page. * Setup the feature-tour for the admin/invoices page.
@ -814,7 +813,7 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) { if (settings.feature_tour_display !== 'manual' && $scope.currentUser.profile.tours.indexOf('invoices') < 0) {
uitour.start(); uitour.start();
} }
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -827,18 +826,18 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I
} }
// retrieve settings from the DB through the API // retrieve settings from the DB through the API
$scope.invoice.legals.content = settings['invoice_legals']; $scope.invoice.legals.content = settings.invoice_legals;
$scope.invoice.text.content = settings['invoice_text']; $scope.invoice.text.content = settings.invoice_text;
$scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']); $scope.invoice.VAT.rate = parseFloat(settings['invoice_VAT-rate']);
$scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true'); $scope.invoice.VAT.active = (settings['invoice_VAT-active'] === 'true');
$scope.invoice.number.model = settings['invoice_order-nb']; $scope.invoice.number.model = settings['invoice_order-nb'];
$scope.invoice.code.model = settings['invoice_code-value']; $scope.invoice.code.model = settings['invoice_code-value'];
$scope.invoice.code.active = (settings['invoice_code-active'] === 'true'); $scope.invoice.code.active = (settings['invoice_code-active'] === 'true');
$scope.invoice.reference.model = settings['invoice_reference']; $scope.invoice.reference.model = settings.invoice_reference;
$scope.invoice.logo = { $scope.invoice.logo = {
filetype: 'image/png', filetype: 'image/png',
filename: 'logo.png', filename: 'logo.png',
base64: settings['invoice_logo'] base64: settings.invoice_logo
}; };
// Watch the logo, when a change occurs, save it // Watch the logo, when a change occurs, save it
@ -990,7 +989,7 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
$scope.ok = function () { $scope.ok = function () {
// check that at least 1 element of the invoice is refunded // check that at least 1 element of the invoice is refunded
$scope.avoir.invoice_items_ids = []; $scope.avoir.invoice_items_ids = [];
for (let itemId in $scope.partial) { for (const itemId in $scope.partial) {
if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) { if (Object.prototype.hasOwnProperty.call($scope.partial, itemId)) {
const refundItem = $scope.partial[itemId]; const refundItem = $scope.partial[itemId];
if (refundItem) { if (refundItem) {
@ -1031,7 +1030,7 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
} }
} }
return false; return false;
} };
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -1058,7 +1057,6 @@ Application.Controllers.controller('AvoirModalController', ['$scope', '$uibModal
} }
]); ]);
/** /**
* Controller used in the modal window allowing an admin to close an accounting period * Controller used in the modal window allowing an admin to close an accounting period
*/ */
@ -1124,11 +1122,11 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
_t( _t(
'app.admin.invoices.confirm_close_START_END', 'app.admin.invoices.confirm_close_START_END',
{ START: moment.utc($scope.period.start_at).format('LL'), END: moment.utc($scope.period.end_at).format('LL') } { START: moment.utc($scope.period.start_at).format('LL'), END: moment.utc($scope.period.end_at).format('LL') }
) ) +
+ '<br/><br/><strong>' '<br/><br/><strong>' +
+ _t('app.admin.invoices.period_must_match_fiscal_year') _t('app.admin.invoices.period_must_match_fiscal_year') +
+ '</strong><br/><br/>' '</strong><br/><br/>' +
+ _t('app.admin.invoices.this_may_take_a_while') _t('app.admin.invoices.this_may_take_a_while')
) )
}; };
} }
@ -1159,7 +1157,6 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
); );
} }
); );
}; };
/** /**
@ -1172,7 +1169,7 @@ Application.Controllers.controller('ClosePeriodModalController', ['$scope', '$ui
*/ */
$scope.downloadArchive = function (period) { $scope.downloadArchive = function (period) {
$window.location.href = `/api/accounting_periods/${period.id}/archive`; $window.location.href = `/api/accounting_periods/${period.id}/archive`;
} };
} }
]); ]);
@ -1304,14 +1301,12 @@ Application.Controllers.controller('AccountingExportModalController', ['$scope',
export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero export_invoices_at_zero: $scope.exportTarget.settings.exportInvoicesAtZero
}) })
}; };
} };
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller
return initialize(); return initialize();
}]); }]);
/** /**
* Controller used in the modal window allowing an admin to close an accounting period * Controller used in the modal window allowing an admin to close an accounting period
*/ */
@ -1343,15 +1338,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
method: 'GET', method: 'GET',
url: 'https://api.stripe.com/v1/charges', url: 'https://api.stripe.com/v1/charges',
headers: { headers: {
Authorization: `Bearer ${$scope.secretKey}`, Authorization: `Bearer ${$scope.secretKey}`
} }
}).then(function () { }).then(function () {
$scope.secretKeyStatus = true; $scope.secretKeyStatus = true;
}, function (err) { }, function (err) {
if (err.status === 401) $scope.secretKeyStatus = false; if (err.status === 401) $scope.secretKeyStatus = false;
}); });
} };
/** /**
* Trigger the test of the secret key and set the result in $scope.secretKeyStatus * Trigger the test of the secret key and set the result in $scope.secretKeyStatus
@ -1370,14 +1364,14 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
}, },
data: $httpParamSerializerJQLike({ data: $httpParamSerializerJQLike({
'pii[id_number]': 'test', 'pii[id_number]': 'test'
}) })
}).then(function () { }).then(function () {
$scope.publicKeyStatus = true; $scope.publicKeyStatus = true;
}, function (err) { }, function (err) {
if (err.status === 401) $scope.publicKeyStatus = false; if (err.status === 401) $scope.publicKeyStatus = false;
}); });
} };
/** /**
* Validate the keys * Validate the keys
@ -1385,7 +1379,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
$scope.ok = function () { $scope.ok = function () {
if ($scope.secretKeyStatus && $scope.publicKeyStatus) { if ($scope.secretKeyStatus && $scope.publicKeyStatus) {
Setting.bulkUpdate( Setting.bulkUpdate(
{ settings: [ {
settings: [
{ {
name: 'stripe_public_key', name: 'stripe_public_key',
value: $scope.publicKey value: $scope.publicKey
@ -1394,7 +1389,8 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
name: 'stripe_secret_key', name: 'stripe_secret_key',
value: $scope.secretKey value: $scope.secretKey
} }
] }, ]
},
function () { function () {
growl.success(_t('app.admin.invoices.payment.stripe_keys_saved')); growl.success(_t('app.admin.invoices.payment.stripe_keys_saved'));
$uibModalInstance.close(true); $uibModalInstance.close(true);
@ -1405,7 +1401,7 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
} }
); );
} else { } else {
growl.error(_t('app.admin.invoices.payment.error_check_keys')) growl.error(_t('app.admin.invoices.payment.error_check_keys'));
} }
}; };

View File

@ -84,7 +84,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
$scope.calendarStyle = function (calendar) { $scope.calendarStyle = function (calendar) {
return { return {
'border-color': calendar.color, 'border-color': calendar.color,
'color': calendar.text_color color: calendar.text_color
}; };
}; };
@ -106,7 +106,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
$scope.openFilterAside = () => $scope.openFilterAside = () =>
$aside.open({ $aside.open({
template: require('../../../templates/filterAside.html'), templateUrl: 'filterAside.html',
placement: 'right', placement: 'right',
size: 'md', size: 'md',
backdrop: false, backdrop: false,
@ -148,8 +148,8 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
$uibModalInstance.dismiss(); $uibModalInstance.dismiss();
return e.stopPropagation(); return e.stopPropagation();
}; };
} }]
] }); });
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
@ -175,7 +175,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
viewRender (view, element) { viewRender (view, element) {
return viewRenderCb(view, element); return viewRenderCb(view, element);
}, },
eventRender (event, element, view) { eventRender (event, element) {
return eventRenderCb(event, element); return eventRenderCb(event, element);
} }
}); });
@ -194,7 +194,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
/** /**
* Callback triggered when an event object is clicked in the fullCalendar view * Callback triggered when an event object is clicked in the fullCalendar view
*/ */
const calendarEventClickCb = function (event, jsEvent, view) { const calendarEventClickCb = function (event) {
// current calendar object // current calendar object
const { calendar } = uiCalendarConfig.calendars; const { calendar } = uiCalendarConfig.calendars;
if (event.available_type === 'machines') { if (event.available_type === 'machines') {
@ -240,7 +240,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
* This function is called when calendar view is rendered or changed * This function is called when calendar view is rendered or changed
* @see https://fullcalendar.io/docs/v3/viewRender#v2 * @see https://fullcalendar.io/docs/v3/viewRender#v2
*/ */
const viewRenderCb = function (view, element) { const viewRenderCb = function (view) {
toggleSlotEventOverlap(view); toggleSlotEventOverlap(view);
if (view.type === 'agendaDay') { if (view.type === 'agendaDay') {
// get availabilties by 1 day for show machine slots // get availabilties by 1 day for show machine slots
@ -255,7 +255,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
const eventRenderCb = function (event, element) { const eventRenderCb = function (event, element) {
if (event.tags && event.tags.length > 0) { if (event.tags && event.tags.length > 0) {
let html = ''; let html = '';
for (let tag of Array.from(event.tags)) { for (const tag of Array.from(event.tags)) {
html += `<span class='label label-success text-white'>${tag.name}</span> `; html += `<span class='label label-success text-white'>${tag.name}</span> `;
} }
element.find('.fc-title').append(`<br/>${html}`); element.find('.fc-title').append(`<br/>${html}`);
@ -269,7 +269,7 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
return { t, m, s, evt: $scope.filter.evt, dispo: $scope.filter.dispo }; return { t, m, s, evt: $scope.filter.evt, dispo: $scope.filter.dispo };
}; };
var availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`; const availabilitySourceUrl = () => `/api/availabilities/public?${$.param(getFilter())}`;
// !!! MUST BE CALLED AT THE END of the controller // !!! MUST BE CALLED AT THE END of the controller
return initialize(); return initialize();

View File

@ -32,19 +32,19 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
$scope.removeItem = function () { $scope.removeItem = function () {
const options = $scope.options.filter(function (opt) { const options = $scope.options.filter(function (opt) {
return $scope.selection.indexOf(opt) < 0; return $scope.selection.indexOf(opt) < 0;
}) });
$scope.options = options; $scope.options = options;
$scope.setting.value = options.join(' '); $scope.setting.value = options.join(' ');
growl.success(_t('app.admin.settings.COUNT_items_removed', { COUNT: $scope.selection.length })); growl.success(_t('app.admin.settings.COUNT_items_removed', { COUNT: $scope.selection.length }));
$scope.selection = []; $scope.selection = [];
} };
/** /**
* Open a modal dialog asking for the value of a new item to add * Open a modal dialog asking for the value of a new item to add
*/ */
$scope.addItem = function () { $scope.addItem = function () {
$uibModal.open({ $uibModal.open({
template: require('../../../../templates/newSelectOption.html'), templateUrl: 'newSelectOption.html',
resolve: { resolve: {
titleNew: function () { return $scope.titleNew; }, titleNew: function () { return $scope.titleNew; },
descriptionNew: function () { return $scope.descriptionNew; } descriptionNew: function () { return $scope.descriptionNew; }
@ -60,7 +60,7 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
}; };
} }
}).result['finally'](null).then(function(val) { }).result.finally(null).then(function (val) {
const options = Array.from($scope.options); const options = Array.from($scope.options);
if (typeof $scope.beforeAdd === 'function') { val = $scope.beforeAdd(val); } if (typeof $scope.beforeAdd === 'function') { val = $scope.beforeAdd(val); }
options.push(val); options.push(val);
@ -68,14 +68,14 @@ Application.Directives.directive('selectMultipleSetting', ['Setting', 'growl', '
$scope.setting.value = options.join(' '); $scope.setting.value = options.join(' ');
growl.success(_t('app.admin.settings.item_added')); growl.success(_t('app.admin.settings.item_added'));
}); });
} };
/** /**
* Callback to save the setting value to the database * Callback to save the setting value to the database
* @param setting {{value:*, name:string}} note that the value will be stringified * @param setting {{value:*, name:string}} note that the value will be stringified
*/ */
$scope.save = function (setting) { $scope.save = function (setting) {
let { value } = setting; const { value } = setting;
Setting.update( Setting.update(
{ name: setting.name }, { name: setting.name },

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
// TODO remove unused? // TODO remove unused?
(function (angular) { (function (angular) {
var deviseModal = angular.module('DeviseModal', [ const deviseModal = angular.module('DeviseModal', [
'Devise', 'Devise',
'ui.bootstrap' 'ui.bootstrap'
]); ]);
@ -28,9 +28,9 @@
} }
if (!promise) { if (!promise) {
promise = $uibModal.open({ promise = $uibModal.open({
template: require('../../../templates/deviseModal.html'), templateUrl: 'deviseModal.html',
controller: function ($scope, $uibModalInstance) { controller: function ($scope, $uibModalInstance) {
var user = $scope.user = {}; const user = $scope.user = {};
$scope.login = function () { $scope.login = function () {
$uibModalInstance.close(user); $uibModalInstance.close(user);
}; };
@ -38,7 +38,7 @@
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
}; };
} }
}).result['finally'](reset).then(Auth.login); }).result.finally(reset).then(Auth.login);
} }
retryRequestAfterLogin(); retryRequestAfterLogin();
}); });