46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/* global angular:false */
|
|
/* global $:false */
|
|
|
|
angular.module('Application').controller('BrandingController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
|
|
Client.onReady(function () { if (Client.getUserInfo().role !== 'owner') $location.path('/'); });
|
|
|
|
$scope.client = Client;
|
|
$scope.user = Client.getUserInfo();
|
|
$scope.config = Client.getConfig();
|
|
|
|
$scope.footer = {
|
|
busy: false,
|
|
content: '',
|
|
|
|
save: function () {
|
|
$scope.footer.busy = true;
|
|
|
|
Client.setFooter($scope.footer.content.trim(), function (error) {
|
|
if (error) return console.error('Failed to set footer.', error);
|
|
|
|
Client.refreshConfig(function () {
|
|
$scope.footer.busy = false;
|
|
});
|
|
});
|
|
},
|
|
|
|
refresh: function () {
|
|
$scope.footer.busy = true;
|
|
Client.getFooter(function (error, result) {
|
|
if (error) return console.error('Unable to fetch footer content.', error);
|
|
|
|
$scope.footer.content = result;
|
|
$scope.footer.busy = false;
|
|
});
|
|
}
|
|
};
|
|
|
|
Client.onReady(function () {
|
|
$scope.footer.refresh();
|
|
});
|
|
|
|
$('.modal-backdrop').remove();
|
|
}]);
|