diff options
| -rw-r--r-- | public/assets/javascripts/ui/site/EditSubscriptionModal.js | 32 | ||||
| -rwxr-xr-x | public/assets/stylesheets/app.css | 60 | ||||
| -rw-r--r-- | server/index.js | 2 | ||||
| -rw-r--r-- | server/lib/api/subscription.js | 10 | ||||
| -rw-r--r-- | server/lib/views/index.js | 9 | ||||
| -rw-r--r-- | views/about/brochure.ejs | 113 | ||||
| -rw-r--r-- | views/partials/edit-subscription.ejs | 17 | ||||
| -rw-r--r-- | views/staff/plans/_form.ejs | 24 |
8 files changed, 114 insertions, 153 deletions
diff --git a/public/assets/javascripts/ui/site/EditSubscriptionModal.js b/public/assets/javascripts/ui/site/EditSubscriptionModal.js index 8952e42..d5eb9ac 100644 --- a/public/assets/javascripts/ui/site/EditSubscriptionModal.js +++ b/public/assets/javascripts/ui/site/EditSubscriptionModal.js @@ -47,22 +47,28 @@ var EditSubscriptionModal = ModalFormView.extend({ basic: 1, pro: 2, }, + + sync: function(){ + $.put(this.syncAction, this.didLoad.bind(this)) + }, loaded: false, load: function(){ this.reset() if (this.loaded) { return this.show() } - $.get(this.action, function(data){ - this.loaded = true - if (data.subscriber) { - this.subscriber = data.subscription - this.plans = data.plans - } - else if (data.error) { - // ...no subscription found - } - return this.show() - }.bind(this)) + $.get(this.action, this.didLoad.bind(this)) + }, + didLoad: function(data){ + this.loaded = true + this.plans = data.plans + if (data.subscription) { + this.subscriber = data.subscription + } + else if (data.error) { + // ...no subscription found + this.subscriber = null + } + return this.show() }, show: function(){ @@ -122,20 +128,18 @@ var EditSubscriptionModal = ModalFormView.extend({ type: "put", data: { _csrf: this.$csrf.val() }, success: function(data){ - window.location.href = "/profile" } }) }, destroy: function(){ - var msg = "Are you sure you want to cancel your subscription " + sanitize(this.$name.val()) + "?" + var msg = "Are you sure you want to cancel your subscription?" ConfirmModal.confirm(msg, function(){ $.ajax({ url: this.destroyAction, type: "delete", data: { _csrf: this.$csrf.val() }, success: function(data){ - window.location.href = "/profile" } }) }.bind(this)) diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 0ce2c5e..5d7199c 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -156,7 +156,7 @@ a{ display: none; border-right:0px!important; } -.editProfile, .profileLink { +.profileLink { border-right:0px!important; } .editing #help-button { @@ -849,6 +849,7 @@ iframe.embed { } + .projectList.about.gopro { padding:6% 0; } @@ -900,6 +901,57 @@ iframe.embed { background:black; color:white; } + +/* PLANS BROCHURE */ +/* nb these styles should be fixed for narrower screens/mobile layout */ +.about_plan { + width: 28vw; + margin: 2vw; + float: left; + min-height: 28vw; + position: relative; +} +.about_plan button { + position: absolute; + bottom: 5%; + left: 5%; + width: 90%; +} +.about_custom { + clear: both; + width: 76vw; + margin: 2vw 10vw; +} +.planbox { + padding: 2vw; + border: 1px solid #ddd; + background: white; + border-radius: 25px; + font-size: 15px; + line-height: 23px; + text-align: center; +} +.planbox h3 { + text-align: center; + margin-bottom: 10px; +} +.about_plan ul { + margin-bottom: 60px; +} +.planbox li { + list-style-type: none; + margin-bottom: 5px; +} +.planbox.miscbox { + border: 0; + background: #f8f8f8; +} +.about_custom a { + border-bottom: 1px solid; +} + +/* LAYOUTS MODAL */ + .templates { overflow: auto; max-height: 100%; @@ -918,8 +970,8 @@ iframe.embed { } .templates::-webkit-scrollbar-thumb { -background-color: white; -border-left: 1px solid black; + background-color: white; + border-left: 1px solid black; } .templates::-webkit-scrollbar-track { @@ -990,6 +1042,8 @@ border-left: 1px solid black; float:right; } +/* MX SCENE STUFF */ + .mx-scene { position:fixed; top:0; diff --git a/server/index.js b/server/index.js index 2f6cb2d..fa7044b 100644 --- a/server/index.js +++ b/server/index.js @@ -156,6 +156,8 @@ site.route = function () { app.put('/api/subscription', middleware.ensureAuthenticated, api.subscription.middleware.ensureSubscription, api.subscription.update) app.delete('/api/subscription', middleware.ensureAuthenticated, api.subscription.middleware.ensureSubscription, api.subscription.destroy) + app.get('/partials/plans', views.partials.plans) + app.get('/test/*', middleware.ensureAuthenticated, middleware.ensureIsStaff, views.modal) views.staff.route(app) diff --git a/server/lib/api/subscription.js b/server/lib/api/subscription.js index 9478d78..b7b3434 100644 --- a/server/lib/api/subscription.js +++ b/server/lib/api/subscription.js @@ -84,7 +84,10 @@ var subscription = module.exports = { subscriber.save(function(){ user.save(function(){ - res.render(subscriber) + res.render({ + subscription: req.subscription, + plans: res.locals.plans + }) }) }) }) @@ -98,7 +101,10 @@ var subscription = module.exports = { }) } else { - res.json({ error: "no subscription" }) + res.json({ + error: "no subscription", + plans: res.locals.plans, + }) } }, diff --git a/server/lib/views/index.js b/server/lib/views/index.js index 0ce0357..89167f7 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -104,6 +104,15 @@ var views = module.exports = { }) }, + partials: { + plans: function (req, res){ + views_middleware.ensurePlans(req, res, function(){ + console.log("<<<<<HI") + res.render('about/_plans') + }) + }, + }, + docs: function (req, res){ var name = req.params.name || "about" diff --git a/views/about/brochure.ejs b/views/about/brochure.ejs index 1dad763..855f897 100644 --- a/views/about/brochure.ejs +++ b/views/about/brochure.ejs @@ -16,72 +16,9 @@ <br><br> </div> - <div class="about_plan planbox"> - <h3>[[- plans.free.name ]]</h3> - <ul> - <li> [[- plans.free.stock_project_limit ]] exhibition with pre-designed template floor plan - </ul> - </div> - - <div class="about_plan planbox"> - <h3>[[- plans.basic.name ]]</h3> - <ul> - <li> $[[- plans.basic.monthly_price ]]/mo or $[[- plans.basic.yearly_price ]]/year - <li> Comes with [[- plans.basic.basic_layout_limit ]] basic floor plan and [[- plans.basic.basic_project_limit ]] exhibitions - <li> Each new basic floor plan costs $[[- plans.basic.basic_layout_monthly_price ]]/mo - or $[[- plans.basic.basic_layout_yearly_price ]]/year, minimum 3 months - <li> Each new floor plan can have up to [[- plans.basic.basic_project_limit ]] exhibitions - <li> VValls logo appears when embedding an exhibition on a web page - <li> - [[ if (! logged_in) { ]] - <button data-role="show-signup-modal">Sign Up</button> - [[ } else if (! user.plan_level) { ]] - <a href="https://vvalls.recurly.com/subscribe/basic-monthly/[[- user._id ]]/[[- user.username ]]"><button>Buy Now</button></a> - [[ } else if (user.plan_level == plan.level) { ]] - Current Level - [[ } ]] - </ul> - </div> - - <div class="about_plan planbox"> - <h3>[[- plans.pro.name ]]</h3> - <ul> - <li> $[[- plans.pro.monthly_price ]]/mo or $[[- plans.pro.yearly_price ]]/year - <li> Comes with [[- plans.pro.pro_layout_limit ]] pro floor plan and [[- plans.pro.pro_project_limit ]] exhibitions - <li> Each new pro floor plan costs $[[- plans.pro.pro_layout_monthly_price ]]/mo - or $[[- plans.pro.pro_layout_yearly_price ]]/year, minimum 3 months - <li> Each new pro floor plan can have up to [[- plans.pro.pro_project_limit ]] exhibitions - <li> Includes planning for 3D objects in the room - <li> No VValls logo on embed - <li> - [[ if (! logged_in) { ]] - <button data-role="show-signup-modal">Sign Up</button> - [[ } else if (! user.plan_level) { ]] - <a href="https://vvalls.recurly.com/subscribe/pro-monthly/[[- user._id ]]/[[- user.username ]]"><button>Buy Now</button></a> - [[ } else if (user.plan_level == plan.level) { ]] - Current Level - [[ } else if (user.plan_level < plan.level) { ]] - <a href="/profile/billing"><button>Upgrade Now</button></a> - [[ } ]] - </ul> - </div> - - <div class="about_custom planbox miscbox"> - <ul> - <li> Buying any extra floor plan unlocks collaboration. Invite an artist or curator to work on the exhibition with you. - <li> Basic Floor plan: Rectangle-based design of any dimension. - <li> Pro Floor plan: Trace an arbitrary floor plan from image. - </ul> - </div> - - <div class="about_custom planbox"> - <h3>Want Something Custom?</h3> - <li> We offer customized white-label options for business and educational uses. - <li> <a href="mailto:hello@vvalls.com">Contact us</a> for more information. - </div> + [[ include _plans ]] </div> - [[ include ../partials/confirm-modal ]] [[ include ../projects/layouts-modal ]] [[ include ../partials/sign-in ]] @@ -91,51 +28,3 @@ </body> [[ include ../partials/scripts ]] </html> -<style> -/* nb these styles should be fixed for narrower screens/mobile layout */ -.about_plan { - width: 28vw; - margin: 2vw; - float: left; - min-height: 28vw; - position: relative; -} -.about_plan button { - position: absolute; - bottom: 5%; - left: 5%; - width: 90%; -} -.about_custom { - clear: both; - width: 76vw; - margin: 2vw 10vw; -} -.planbox { - padding: 2vw; - border: 1px solid #ddd; - background: white; - border-radius: 25px; - font-size: 15px; - line-height: 23px; - text-align: center; -} -.planbox h3 { - text-align: center; - margin-bottom: 10px; -} -.about_plan ul { - margin-bottom: 60px; -} -.planbox li { - list-style-type: none; - margin-bottom: 5px; -} -.planbox.miscbox { - border: 0; - background: #f8f8f8; -} -.about_custom a { - border-bottom: 1px solid; -} -</style>
\ No newline at end of file diff --git a/views/partials/edit-subscription.ejs b/views/partials/edit-subscription.ejs index bb7cc27..2f6e4c1 100644 --- a/views/partials/edit-subscription.ejs +++ b/views/partials/edit-subscription.ejs @@ -7,15 +7,14 @@ <li class="section_break"> <h3>Edit Subscription</h3> </li> - <div id="free_plan"> - You are currently using the free plan. For access to all of Vvalls features, + <li id="free_plan"> + You are currently using the free version of Vvalls. For access to all of Vvalls features, consider upgrading to a paid plan. - <p> - <a href="/about/brochure">View the Plans</a> - </div> - <div id="paid_plan"> + <br><br> + <a href="/about/brochure"><button>View the Plans</button></a> + </li> + <li id="paid_plan"> Your current plan level is <span data-role="planName"></span> - <table> <tr class="planRow"> <td><span data-role="planName"></span></td> @@ -41,9 +40,7 @@ <td>$<span data-role="planTotal"></span></td> </tr> </table> - - <button data-role="upgradeSubscription">Upgrade your subscription</button> - + <button data-role="upgradeSubscription">Upgrade your subscription</button> <button data-role="cancelSubscription">Cancel your subscription</button> </li> </ul> diff --git a/views/staff/plans/_form.ejs b/views/staff/plans/_form.ejs index b55c5cd..0240e56 100644 --- a/views/staff/plans/_form.ejs +++ b/views/staff/plans/_form.ejs @@ -18,7 +18,7 @@ <li> <label for="plan_level">Level</label> - <div><input id="plan_level" name="level" type="number" value="[[- plan.level ]]"></div> + <div><input id="plan_level" name="level" type="number" min="0" value="[[- plan.level ]]"></div> </li> <!-- - - - - --> @@ -29,12 +29,12 @@ <li> <label for="plan_monthly_price">Monthly Price</label> - <div><input id="plan_monthly_price" name="monthly_price" type="number" value="[[- plan.monthly_price ]]"></div> + <div><input id="plan_monthly_price" name="monthly_price" type="number" min="0" value="[[- plan.monthly_price ]]"></div> </li> <li> <label for="plan_yearly_price">Yearly Price</label> - <div><input id="plan_yearly_price" name="yearly_price" type="number" value="[[- plan.yearly_price ]]"></div> + <div><input id="plan_yearly_price" name="yearly_price" type="number" min="0" value="[[- plan.yearly_price ]]"></div> </li> <p> @@ -49,22 +49,22 @@ <li> <label for="plan_basic_layout_monthly_price">Basic Template Price (Monthly)</label> - <div><input id="plan_basic_layout_monthly_price" name="basic_layout_monthly_price" type="number" value="[[- plan.basic_layout_monthly_price ]]"></div> + <div><input id="plan_basic_layout_monthly_price" name="basic_layout_monthly_price" type="number" min="0" value="[[- plan.basic_layout_monthly_price ]]"></div> </li> <li> <label for="plan_basic_layout_yearly_price">Basic Template Price (Yearly)</label> - <div><input id="plan_basic_layout_yearly_price" name="basic_layout_yearly_price" type="number" value="[[- plan.basic_layout_yearly_price ]]"></div> + <div><input id="plan_basic_layout_yearly_price" name="basic_layout_yearly_price" type="number" min="0" value="[[- plan.basic_layout_yearly_price ]]"></div> </li> <li> <label for="plan_pro_layout_monthly_price">Pro Template Price (Monthly)</label> - <div><input id="plan_pro_layout_monthly_price" name="pro_layout_monthly_price" type="number" value="[[- plan.pro_layout_monthly_price ]]"></div> + <div><input id="plan_pro_layout_monthly_price" name="pro_layout_monthly_price" type="number" min="0" value="[[- plan.pro_layout_monthly_price ]]"></div> </li> <li> <label for="plan_pro_layout_yearly_price">Pro Template Price (Yearly)</label> - <div><input id="plan_pro_layout_yearly_price" name="pro_layout_yearly_price" type="number" value="[[- plan.pro_layout_yearly_price ]]"></div> + <div><input id="plan_pro_layout_yearly_price" name="pro_layout_yearly_price" type="number" min="0" value="[[- plan.pro_layout_yearly_price ]]"></div> </li> <!-- - - - - --> @@ -75,12 +75,12 @@ <li> <label for="plan_basic_layout_limit">Basic Template Limit</label> - <div><input id="plan_basic_layout_limit" name="basic_layout_limit" type="number" value="[[- plan.basic_layout_limit ]]"></div> + <div><input id="plan_basic_layout_limit" name="basic_layout_limit" type="number" min="0" value="[[- plan.basic_layout_limit ]]"></div> </li> <li> <label for="plan_pro_layout_limit">Pro Template Limit</label> - <div><input id="plan_pro_layout_limit" name="pro_layout_limit" type="number" value="[[- plan.pro_layout_limit ]]"></div> + <div><input id="plan_pro_layout_limit" name="pro_layout_limit" type="number" min="0" value="[[- plan.pro_layout_limit ]]"></div> </li> <!-- - - - - --> @@ -91,17 +91,17 @@ <li> <label for="plan_stock_project_limit">Stock Project Limit</label> - <div><input id="plan_stock_project_limit" name="stock_project_limit" type="number" value="[[- plan.stock_project_limit ]]"></div> + <div><input id="plan_stock_project_limit" name="stock_project_limit" type="number" min="0" value="[[- plan.stock_project_limit ]]"></div> </li> <li> <label for="plan_basic_project_limit">Basic Project Limit</label> - <div><input id="plan_basic_project_limit" name="basic_project_limit" type="number" value="[[- plan.basic_project_limit ]]"></div> + <div><input id="plan_basic_project_limit" name="basic_project_limit" type="number" min="0" value="[[- plan.basic_project_limit ]]"></div> </li> <li> <label for="plan_pro_project_limit">Pro Layout Limit</label> - <div><input id="plan_pro_project_limit" name="pro_project_limit" type="number" value="[[- plan.pro_project_limit ]]"></div> + <div><input id="plan_pro_project_limit" name="pro_project_limit" type="number" min="0" value="[[- plan.pro_project_limit ]]"></div> </li> <!-- - - - - --> |
