summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gruntfile.js1
-rw-r--r--config.json.example1
-rw-r--r--public/assets/javascripts/ui/_router.js10
-rw-r--r--server/index.js1
-rw-r--r--server/lib/api/subscription.js19
-rw-r--r--server/lib/webhook/webhook.js14
-rw-r--r--views/about/brochure.ejs3
-rw-r--r--views/partials/edit-subscription.ejs1
-rw-r--r--views/partials/scripts.ejs1
9 files changed, 46 insertions, 5 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index f62cc82..ed236c5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -99,6 +99,7 @@ module.exports = function(grunt) {
"public/assets/javascripts/ui/site/LayoutsModal.js",
"public/assets/javascripts/ui/site/EditProjectModal.js",
"public/assets/javascripts/ui/site/EditProfileModal.js",
+ "public/assets/javascripts/ui/site/EditSubscriptionModal.js",
"public/assets/javascripts/ui/site/DocumentModal.js",
"public/assets/javascripts/ui/site/HomeView.js",
diff --git a/config.json.example b/config.json.example
index b8c310c..dc79edd 100644
--- a/config.json.example
+++ b/config.json.example
@@ -5,6 +5,5 @@
"socketPort": 1337,
"webhookPort": 5000,
"databaseHost": "lvh.me",
- "pageSize": 10,
"env": { "development": 1 }
}
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js
index 3532428..9e7ce75 100644
--- a/public/assets/javascripts/ui/_router.js
+++ b/public/assets/javascripts/ui/_router.js
@@ -9,6 +9,7 @@ var SiteRouter = Router.extend({
"click [data-role='new-project-modal']": 'newProject',
"click [data-role='edit-project-modal']": 'editProject',
"click [data-role='edit-profile-modal']": 'editProfile',
+ "click [data-role='edit-subscription-modal']": 'editSubscription',
"click [data-role='new-document-modal']": 'newDocument',
"click [data-role='edit-document-modal']": 'editDocument',
"click [data-role='destroy-document-modal']": 'destroyDocument',
@@ -29,6 +30,7 @@ var SiteRouter = Router.extend({
"/profile": 'profile',
"/profile/edit": 'editProfile',
+ "/profile/billing": 'editSubscription',
"/profile/:name": 'profile',
"/about/:name/edit": 'editDocument',
"/about/new": 'newDocument',
@@ -56,6 +58,7 @@ var SiteRouter = Router.extend({
"/profile": 'profile',
"/profile/edit": 'editProfile',
+ "/profile/billing": 'editSubscription',
"/profile/:name": 'profile',
"/project/:name": 'projectViewer',
@@ -69,6 +72,7 @@ var SiteRouter = Router.extend({
this.newProjectModal = new NewProjectModal()
this.editProjectModal = new EditProjectModal()
this.editProfileModal = new EditProfileModal()
+ this.editSubscriptionModal = new EditSubscriptionModal()
this.passwordForgotModal = new PasswordForgot()
this.documentModal = new DocumentModal()
this.profileView = new ProfileView()
@@ -195,6 +199,12 @@ var SiteRouter = Router.extend({
this.editProfileModal.load()
},
+ editSubscription: function(e){
+ e && e.preventDefault()
+ window.history.pushState(null, document.title, "/profile/billing")
+
+ this.editSubscriptionModal.load()
+ },
newDocument: function(e){
diff --git a/server/index.js b/server/index.js
index 02fea3c..475054d 100644
--- a/server/index.js
+++ b/server/index.js
@@ -102,6 +102,7 @@ site.route = function () {
app.get('/profile', views.profile)
app.get('/profile/edit', views.profile)
+ app.get('/profile/billing', views.profile)
app.get('/profile/:username', views.profile)
app.get('/about', views.docs);
diff --git a/server/lib/api/subscription.js b/server/lib/api/subscription.js
index bd19127..83644cf 100644
--- a/server/lib/api/subscription.js
+++ b/server/lib/api/subscription.js
@@ -18,16 +18,29 @@ var subscription = module.exports = {
})
},
*/
- show: function(req,res){
+ middleware: {
+ fetchAccount: function(req, res, next){
+ recurly.subscriptions.listByAccount(req.user._id, function(data){
+ })
+ },
+ },
+
+ // synchronise an account with recurly..
+ // useful when testing locally (if webhooks do not fire)
+ sync: function(req, res){
+ // fetch req.user._id
+ },
+
+ show: function(req, res){
// fetch from recurly
},
- update: function(req,res){
+ update: function(req, res){
// update plan_type on recurly
// update add_ons on recurly
},
- destroy: function(req,res){
+ destroy: function(req, res){
// destroy on recurly
},
diff --git a/server/lib/webhook/webhook.js b/server/lib/webhook/webhook.js
index e9a7925..4f23d0b 100644
--- a/server/lib/webhook/webhook.js
+++ b/server/lib/webhook/webhook.js
@@ -134,7 +134,21 @@ var subscribe = module.exports = {
});
},
+ list: function(req, res){
+ recurly.subscriptions.listByAccount(req.params.id, function(data){
+ if (data.data != 404) {
+ res.json(data)
+ return
+ }
+ else {
+ res.json(data)
+ return
+ }
+ })
+ },
+
route: function(app){
app.post('/subscribe/webhook', subscribe.handle);
+ app.get('/subscribe/list/:id', subscribe.list);
},
}
diff --git a/views/about/brochure.ejs b/views/about/brochure.ejs
index 1c808f8..49b03db 100644
--- a/views/about/brochure.ejs
+++ b/views/about/brochure.ejs
@@ -123,6 +123,9 @@
text-align: center;
margin-bottom: 10px;
}
+.about_plan ul {
+ margin-bottom: 60px;
+}
.planbox li {
list-style-type: none;
margin-bottom: 5px;
diff --git a/views/partials/edit-subscription.ejs b/views/partials/edit-subscription.ejs
index 1f8db62..adc3f71 100644
--- a/views/partials/edit-subscription.ejs
+++ b/views/partials/edit-subscription.ejs
@@ -44,7 +44,6 @@
<button>Upgrade your subscription</button>
<button>Cancel your subscription</button>
- [[ } ]]
</li>
</ul>
</form>
diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs
index fc94992..04bd945 100644
--- a/views/partials/scripts.ejs
+++ b/views/partials/scripts.ejs
@@ -95,6 +95,7 @@
<script type="text/javascript" src="/assets/javascripts/ui/site/LayoutsModal.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/site/EditProjectModal.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/site/EditProfileModal.js"></script>
+<script type="text/javascript" src="/assets/javascripts/ui/site/EditSubscriptionModal.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/site/DocumentModal.js"></script>
<script type="text/javascript" src="/assets/javascripts/ui/site/HomeView.js"></script>