Change subscription dialog to reflect 1.0

This commit is contained in:
Johannes Zellner
2017-06-13 17:08:36 +02:00
parent 84d34ec004
commit 5a291fa2a4
2 changed files with 26 additions and 48 deletions

View File

@@ -148,7 +148,7 @@
<h4 class="modal-title" id="updateModalLabel">Setup Subscription</h4>
</div>
<div class="modal-body">
<p>
<p ng-show="config.update.box">
You can update to the next version once you have selected a <a ng-href="{{ config.webServerOrigin + '/pricing.html' }}" target="_blank">paid plan</a>.
</p>
<p>
@@ -156,34 +156,7 @@
</p>
</div>
<div class="modal-footer">
<a class="btn btn-success" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email }}" target="_blank">Setup Subscription</a>
</div>
</div>
</div>
</div>
<!-- Modal version 1.0 -->
<div class="modal fade" id="version1Modal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h3>Cloudron 1.0 is here!</h3>
<p>
Your Cloudron will update to 1.0 once you have selected a <a ng-href="{{ config.webServerOrigin + '/pricing.html' }}" target="_blank">plan</a>.
</p>
<p>
With a paid plan, you get continuous updates for the Cloudron and apps just like you had until now. This ensures you are running the latest versions of apps and keeps your server secure. All paid plans come with support via <a href="mailto:support@cloudron.io">email</a> and <a target="_blank" href="https://chat.cloudron.io">live chat</a>.
</p>
<p>
With the free plan, you can keep the Cloudron and Apps updated on your own
following the instructions in our <a href="https://git.cloudron.io/cloudron/box/wikis/home" target="_blank">wiki</a>.
</p>
<p>
You can read more about our pricing changes in our <a href="https://cloudron.io/blog/2017-06-06-pricing.html" target="_blank">blog</a>.
</p>
</div>
<div class="modal-footer">
<a class="btn btn-success" ng-click="waitForPlanSelection()" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank"><i class="fa fa-circle-o-notch fa-spin" ng-show="waitingForPlanSelection"></i> Setup Subscription</a>
<a class="btn btn-success" ng-click="waitForPlanSelection()" ng-href="{{ config.webServerOrigin + '/console.html#/userprofile?view=subscriptions&email=' + appstoreConfig.profile.email + '&cloudronId=' + appstoreConfig.cloudronId }}" target="_blank" ng-disabled="waitingForPlanSelection"><i class="fa fa-circle-o-notch fa-spin" ng-show="waitingForPlanSelection"></i> Setup Subscription</a>
</div>
</div>
</div>
@@ -213,6 +186,11 @@
<span class="badge badge-success">Update available</span>
</a>
</li>
<li ng-show="appstoreConfig && !config.update.box && user.admin && (currentSubscription.plan.id === 'undecided' || currentSubscription.plan.id === 'free')">
<a ng-href="" ng-click="showSubscriptionModal()" style="cursor: pointer">
<span class="badge badge-success">Setup automatic updates</span>
</a>
</li>
<li>
<a ng-class="{ active: isActive('/apps')}" href="#/apps"><i class="fa fa-cloud-download fa-fw"></i> My Apps</a>
</li>

View File

@@ -33,7 +33,7 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
};
$scope.waitingForPlanSelection = false;
$('#version1Modal').on('hide.bs.modal', function () {
$('#setupSubscriptionModal').on('hide.bs.modal', function () {
$scope.waitingForPlanSelection = false;
});
@@ -45,18 +45,29 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
function checkPlan() {
if (!$scope.waitingForPlanSelection) return;
if ($scope.currentSubscription.plan.id !== 'undecided') {
$scope.waitingForPlanSelection = false;
$('#version1Modal').modal('hide');
$('#updateModal').modal('show');
} else {
$timeout(checkPlan, 1000);
}
AppStore.getSubscription($scope.appstoreConfig, function (error, result) {
if (error) return console.error(error);
$scope.currentSubscription = result;
// check again to give more immediate feedback once a subscription was setup
if (result.plan.id === 'undecided' || result.plan.id === 'free') {
$timeout(checkPlan, 5000);
} else {
$scope.waitingForPlanSelection = false;
$('#setupSubscriptionModal').modal('hide');
if ($scope.config.update && $scope.config.update.box) $('#updateModal').modal('show');
}
});
}
checkPlan();
};
$scope.showSubscriptionModal = function () {
$('#setupSubscriptionModal').modal('show');
};
$scope.showUpdateModal = function (form) {
$scope.update.error.generic = null;
$scope.update.error.password = null;
@@ -73,14 +84,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$('#updateModal').modal('show');
} else if (!$scope.currentSubscription || !$scope.currentSubscription.plan) {
// do nothing as we were not able to get a subscription, yet
} else if ($scope.config.update.box.version === '1.0.0') {
// special case for updating to 1.0
if ($scope.currentSubscription.plan.id === 'undecided') {
$('#version1Modal').modal('show');
} else {
// user selected a plan already, let him update
$('#updateModal').modal('show');
}
} else {
$('#updateModal').modal('show');
}
@@ -160,9 +163,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
if (error) return console.error(error);
$scope.currentSubscription = result;
// check again to give more immediate feedback once a subscription was setup
if (result.plan.id === 'undecided') $timeout(getSubscription, 5000);
});
});
}