This commit is contained in:
Henry Oswald 2015-02-03 11:36:16 +00:00
commit e9ab77351a
5 changed files with 22 additions and 5 deletions

View file

@ -62,7 +62,8 @@ module.exports = SubscriptionController =
recurlyConfig: JSON.stringify
currency: currency
subdomain: Settings.apis.recurly.subdomain
showCouponField:req.query.scf
showCouponField: req.query.scf
couponCode: req.query.cc or ""
subscriptionFormOptions: JSON.stringify
acceptedCards: ['discover', 'mastercard', 'visa']
target : "#subscribeForm"

View file

@ -106,6 +106,15 @@ app.use (req, res, next) ->
app.get "/status", (req, res)->
res.send("web sharelatex is alive")
req.session.destroy()
profiler = require "v8-profiler"
app.get "/profile", (req, res) ->
time = parseInt(req.query.time || "1000")
profiler.startProfiling("test")
setTimeout () ->
profile = profiler.stopProfiling("test")
res.json(profile)
, time
logger.info ("creating HTTP server").yellow
server = require('http').createServer(app)

View file

@ -8,7 +8,7 @@ block scripts
window.countryCode = '#{countryCode}'
window.plan_code = '#{plan_code}'
window.recurlyApiKey = "!{settings.apis.recurly.publicKey}"
window.couponCode = "#{couponCode}"
block content
- locals.supressDefaultJs = true
@ -148,11 +148,10 @@ block content
mixin countries_options()
.row
.col-md-8
if showCouponField == 'true'
if (showCouponField)
.form-group
input.form-control(type='text', ng-blur="applyCoupon()", ng-model="data.coupon", placeholder="#{translate('coupon')}")
.row
.col-xs-7
.form-group

View file

@ -41,6 +41,7 @@
"translations-sharelatex": "git+https://github.com/sharelatex/translations-sharelatex.git#master",
"underscore": "1.6.0",
"underscore.string": "^3.0.2",
"v8-profiler": "^5.2.3",
"xml2js": "0.2.0"
},
"devDependencies": {

View file

@ -27,6 +27,7 @@ define [
state:""
city:""
country:window.countryCode
coupon: window.couponCode
$scope.validation =
@ -41,7 +42,13 @@ define [
pricing = recurly.Pricing()
window.pricing = pricing
pricing.plan(window.plan_code, { quantity: 1 }).address({country: $scope.data.country}).tax({tax_code: 'digital', vat_number: ''}).currency($scope.currencyCode).done()
initialPricing = pricing
.plan(window.plan_code, { quantity: 1 })
.address({country: $scope.data.country})
.tax({tax_code: 'digital', vat_number: ''})
.currency($scope.currencyCode)
.coupon($scope.data.coupon)
.done()
pricing.on "change", =>
$scope.planName = pricing.items.plan.name