Show subscription dialog on app update

This commit is contained in:
Johannes Zellner
2017-06-06 13:14:50 +02:00
parent 32fa3b8a51
commit b7e3447a46
3 changed files with 18 additions and 9 deletions

View File

@@ -145,10 +145,10 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" id="updateModalLabel">Setup Auto Update Subscription</h4>
<h4 class="modal-title" id="updateModalLabel">Setup Update Subscription</h4>
</div>
<div class="modal-body">
To get effortless automatic app and platform updates, subscribe to our Cloudron.io plans.<br/>
To get effortless and automatic app and platform updates, subscribe to our Cloudron.io plans.<br/>
<br/>
See detailed information <a ng-href="{{ config.webServerOrigin + '/pricing.html' }}" target="_blank">here</a>.
</div>

View File

@@ -33,14 +33,18 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
};
$scope.showUpdateModal = function (form) {
$scope.update.error.generic = null;
$scope.update.error.password = null;
$scope.update.password = '';
if ($scope.currentSubscription.plan && $scope.currentSubscription.plan.id === 'free') {
$('#setupSubscriptionModal').modal('show');
} else {
$scope.update.error.generic = null;
$scope.update.error.password = null;
$scope.update.password = '';
form.$setPristine();
form.$setUntouched();
form.$setPristine();
form.$setUntouched();
$('#updateModal').modal('show');
$('#updateModal').modal('show');
}
};
$scope.doUpdate = function () {

View File

@@ -329,7 +329,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
Client.getAppBackups(app.id, function (error, backups) {
if (error) {
Client.error(error)
Client.error(error);
} else {
$scope.appRestore.backups = backups;
if (backups.length) $scope.appRestore.selectedBackup = backups[0]; // pre-select first backup
@@ -393,6 +393,11 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
};
$scope.showUpdate = function (app) {
if ($scope.$parent.currentSubscription.plan && $scope.$parent.currentSubscription.plan.id === 'free') {
$('#setupSubscriptionModal').modal('show');
return;
}
$scope.reset();
$scope.appUpdate.app = app;