summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/ui/site/EditSubscriptionModal.js12
-rw-r--r--server/lib/auth/index.js4
-rw-r--r--views/partials/footer.ejs6
3 files changed, 18 insertions, 4 deletions
diff --git a/public/assets/javascripts/ui/site/EditSubscriptionModal.js b/public/assets/javascripts/ui/site/EditSubscriptionModal.js
index 6823740..82f6903 100644
--- a/public/assets/javascripts/ui/site/EditSubscriptionModal.js
+++ b/public/assets/javascripts/ui/site/EditSubscriptionModal.js
@@ -12,7 +12,7 @@ var EditSubscriptionModal = ModalView.extend({
events: {
"click [data-role='addLayouts']": 'addLayouts',
"click [data-role='changePlan']": 'changePlan',
- "click [data-role='cancelSubscription']": 'cancelSubscription',
+ "click [data-role='cancelSubscription']": 'destroy',
"click .gear": 'sync',
"click .planList button": 'followLink',
},
@@ -132,6 +132,13 @@ var EditSubscriptionModal = ModalView.extend({
this.$planTotal.toDollars ( totals.plan_total )
},
+ addLayouts: function(e){
+ e.preventDefault()
+ },
+ changePlan: function(e){
+ e.preventDefault()
+ },
+
sync: function(){
this.$gear.addClass("turning")
$.ajax({
@@ -152,7 +159,8 @@ var EditSubscriptionModal = ModalView.extend({
})
},
- destroy: function(){
+ destroy: function(e){
+ e.preventDefault()
var msg = "Are you sure you want to cancel your subscription?"
ConfirmModal.confirm(msg, function(){
$.ajax({
diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js
index a9a2400..199377d 100644
--- a/server/lib/auth/index.js
+++ b/server/lib/auth/index.js
@@ -135,12 +135,12 @@ var auth = {
deserializeUser: function (id, done) {
try {
var _id = mongoose.Types.ObjectId(id)
- User.findOne({ _id: _id }, "_id displayName username photo isStaff", function (err, user) {
+ User.findOne({ _id: _id }, "_id displayName username photo isStaff plan_level", function (err, user) {
done(err, user);
});
}
catch (e) {
- User.findOne({ twitter_id: id }, "_id displayName username photo isStaff", function (err, user) {
+ User.findOne({ twitter_id: id }, "_id displayName username photo isStaff plan_level", function (err, user) {
done(err, user);
});
}
diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs
index e3c572f..8a95fc4 100644
--- a/views/partials/footer.ejs
+++ b/views/partials/footer.ejs
@@ -15,6 +15,12 @@
<a href="/about">About</a>
<a href="/about/howto">How To</a>
+
+ [[ if (logged_in && user.plan_level > 0) { ]]
+ <a href="/profile/billing">Billing</a>
+ [[ } else { ]]
+ <a href="/about/brochure">Subscribe</a>
+ [[ } ]]
<a href="/about/terms">Terms</a>
<a href="/about/privacy">Privacy</a>
<a href="mailto:hello@vvalls.com">Contact</a>