add new branding view

This commit is contained in:
Girish Ramakrishnan
2020-03-18 17:53:50 -07:00
parent 19e2df65ca
commit 0e3ae2b450
7 changed files with 85 additions and 65 deletions
+45
View File
@@ -0,0 +1,45 @@
'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();
}]);