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
+34
View File
@@ -0,0 +1,34 @@
<div class="content">
<div class="text-left">
<h1>Branding</h1>
</div>
<div class="text-left">
<h3>Footer</h3>
</div>
<div class="card" style="margin-bottom: 15px;">
<div class="row" ng-hide="config.features.branding">
<div class="col-xs-12">
<b>Customizing the footer is only available in the business plan.</b>
</div>
</div>
<div class="row" ng-show="config.features.branding">
<div class="col-md-12">
<div class="form-group">
<p>Use <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">markdown</a> to style the footer.</p>
<textarea class="form-control" ng-model="footer.content" ng-disabled="footer.busy"></textarea>
</div>
</div>
<div class="col-md-12 text-right">
<button class="btn btn-outline btn-primary pull-right" ng-click="footer.save()"><i class="fa fa-circle-notch fa-spin" ng-show="footer.busy"></i> Save</button>
</div>
</div>
<br/>
</div>
</div>
+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();
}]);
-29
View File
@@ -384,33 +384,4 @@
</div>
</div>
</div>
<div class="text-left">
<h3>Branding</h3>
</div>
<div class="card" style="margin-bottom: 15px;">
<div class="row" ng-hide="config.features.branding">
<div class="col-xs-12">
<b>Customizing the footer is only available in the business plan.</b>
</div>
</div>
<div class="row" ng-show="config.features.branding">
<div class="col-md-12">
<div class="form-group">
<label class="control-label" style="width: 100%">Footer</label>
<p class="text-small">Use <a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">markdown</a> to style the footer.</p>
<textarea class="form-control" ng-model="branding.footer.content" ng-disabled="branding.footer.busy"></textarea>
</div>
</div>
<div class="col-md-12 text-right">
<button class="btn btn-outline btn-primary pull-right" ng-click="branding.footer.save()"><i class="fa fa-circle-notch fa-spin" ng-show="branding.footer.busy"></i> Save</button>
</div>
</div>
<br/>
</div>
</div>
-34
View File
@@ -21,39 +21,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
}
};
$scope.branding = {
footer: {
busy: false,
content: '',
save: function () {
$scope.branding.footer.busy = true;
Client.setFooter($scope.branding.footer.content.trim(), function (error) {
if (error) return console.error('Failed to set footer.', error);
Client.refreshConfig(function () {
$scope.branding.footer.busy = false;
});
});
},
refresh: function () {
$scope.branding.footer.busy = true;
Client.getFooter(function (error, result) {
if (error) return console.error('Unable to fetch footer content.', error);
$scope.branding.footer.content = result;
$scope.branding.footer.busy = false;
});
}
},
refresh: function () {
$scope.branding.footer.refresh();
}
}
$scope.update = {
error: {}, // this is for the dialog
busy: false,
@@ -489,7 +456,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
getTimeZone();
$scope.update.checkStatus();
$scope.branding.refresh();
if ($scope.user.isAtLeastOwner) getSubscription();
});