Merge branch 'master' into pdfng

This commit is contained in:
Brian Gough 2014-11-26 14:17:02 +00:00
commit 33d94af930
16 changed files with 184 additions and 56 deletions

View file

@ -57,6 +57,7 @@ module.exports = SubscriptionController =
plan_code: req.query.planCode
currency: currency
plan:plan
showStudentPlan: req.query.ssp
recurlyConfig: JSON.stringify
currency: currency
subdomain: Settings.apis.recurly.subdomain

View file

@ -6,13 +6,20 @@ logger = require("logger-sharelatex")
currencyMappings = {
"GB":"GBP"
"US":"USD"
"CH":"CHF"
"NZ":"NZD"
"AU":"AUD"
"DK":"DKK"
"NO":"NOK"
"CA":"CAD"
"SE":"SEK"
}
# Countries which would likely prefer Euro's
EuroCountries = ["AT", "BE", "BG", "HR", "CY", "CZ",
"DK", "EE", "FI", "FR", "DE", "EL", "HU", "IE",
EuroCountries = ["AT", "BE", "BG", "HR", "CY", "CZ",
"EE", "FI", "FR", "DE", "EL", "HU", "IE",
"IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT",
"RO", "SK", "SI", "ES", "SE"]
"RO", "SK", "SI", "ES"]
_.each EuroCountries, (country)-> currencyMappings[country] = "EUR"

View file

@ -25,8 +25,8 @@ script(type="text/ng-template", id="dropboxModalTemplate")
strong Dropbox/sharelatex/{{ project.name }}
div.text-center(ng-hide="dbState.hasDropboxFeature")
p #{translate("need_to_upgrade_for_dropbox")}
p
a.btn.btn-info(ng-click="startFreeTrial('dropbox')") #{translate("start_free_trial")}
p(ng-controller="FreeTrialModalController")
a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial")
| #{translate("refresh_page_after_starting_free_trial")}

View file

@ -99,7 +99,7 @@ div.full-size.pdf(ng-controller="PdfController")
p
a.btn.btn-info(
href
ng-click="startFreeTrial('compile-timeout')"
ng-click="hello('compile-timeout')"
) #{translate("start_free_trial")}

View file

@ -68,8 +68,8 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
) #{translate("share")}
div.text-center(ng-hide="canAddCollaborators")
p #{translate("need_to_upgrade_for_more_collabs")}.
p
a.btn.btn-info(href, ng-click="startFreeTrial('projectMembers')") #{translate("start_free_trial")}
p(ng-controller="FreeTrialModalController")
a.btn(href, ng-click="startFreeTrial('projectMembers')", ng-class="buttonClass") #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial")
| #{translate("refresh_page_after_starting_free_trial")}.

View file

@ -2,9 +2,10 @@ div#trackChanges(ng-show="ui.view == 'track-changes'")
.upgrade-prompt(ng-show="!project.features.versioning")
.message(ng-show="project.owner._id == user.id")
p #{translate("need_to_upgrade_for_history")}
p
a.btn.btn-info(
p(ng-controller="FreeTrialModalController")
a.btn(
href
ng-class="buttonClass"
ng-click="startFreeTrial('track-changes')"
) #{translate("start_free_trial")}
p.small(ng-show="startedFreeTrial") #{translate("refresh_page_after_starting_free_trial")}

View file

@ -34,6 +34,12 @@ block content
.col-md-3.col-md-pull-6
if showStudentPlan == 'true'
a.btn-primary.btn.plansPageStudentLink(
href,
ng-click="switchToStudent()"
) #{translate("half_price_student")}
.card.card-first
.paymentPageFeatures
.page-header
@ -80,7 +86,7 @@ block content
Recurly.buildSubscriptionForm(recurlySubscriptionFormConfig);
window.ab = [
{step:1, bucket:"eu-eu", testName:"multi_currency"},
{step:1, bucket:"eu-usd", testName:"multi_currency"}
{step:1, bucket:"red", testName:"button_color"},
{step:1, bucket:"blue", testName:"button_color"}
]

View file

@ -35,11 +35,9 @@ block content
script(type="text/javascript").
window.ab = [
{step:2, bucket:"eu-eu", testName:"multi_currency"},
{step:2, bucket:"eu-usd", testName:"multi_currency"},
{step:1, bucket:"eu-eu", testName:"multi_currency_editor"},
{step:1, bucket:"eu-usd", testName:"multi_currency_editor"}
{step:1, bucket:"student_control", testName:"editor_plan"},
{step:1, bucket:"collab_test", testName:"editor_plan"},
{step:2, bucket:"blue", testName:"button_color"},
{step:2, bucket:"red", testName:"button_color"}
]

View file

@ -28,7 +28,7 @@ script(type="text/ng-template", id="BonusLinkToUsModal")
div.text-center(ng-hide="dbState.hasDropboxFeature")
p You need to upgrade your account to link to dropbox.
p
a.btn.btn-info(ng-click="startFreeTrial('dropbox')") Start Free Trial
a.btn(ng-click="startFreeTrial('dropbox')", ng-class="buttonClass") Start Free Trial
p.small(ng-show="startedFreeTrial")
| Please refresh this page after starting your free trial.

View file

@ -99,7 +99,7 @@ module.exports =
apiKey: ""
subdomain: ""
geoIpLookup:
url: "https://freegeoip.net/json/"
url: "http://localhost:8080/json"
templates:
user_id: process.env.TEMPLATES_USER_ID or "5395eb7aad1f29a88756c7f2"

View file

@ -2,8 +2,23 @@ define [
"base"
"libs/md5"
], (App) ->
oldKeys = [
"sl_abt_multi_currency_editor_eu-eu"
"sl_abt_multi_currency_eu-eu"
"sl_abt_multi_currency_editor_eu-usd"
"sl_abt_multi_currency_eu-usd"
"sl_abt_trial_len_14d"
"sl_abt_trial_len_7d"
"sl_abt_trial_len_30d"
"sl_utt"
"sl_utt_trial_len"
"sl_utt_multi_currency"
]
App.factory "abTestManager", ($http, ipCookie) ->
_.each oldKeys, (oldKey)->
ipCookie.remove(oldKey)
_buildCookieKey = (testName, bucket)->
key = "sl_abt_#{testName}_#{bucket}"

View file

@ -27,6 +27,7 @@ define [
"directives/rightClick"
"filters/formatDate"
"main/event-tracking"
"main/account-upgrade"
], (
App
FileTreeManager
@ -38,7 +39,8 @@ define [
PdfManager
BinaryFilesManager
) ->
App.controller "IdeController", ($scope, $timeout, ide, abTestManager) ->
App.controller "IdeController", ($scope, $timeout, ide) ->
# Don't freak out if we're already in an apply callback
$scope.$originalApply = $scope.$apply
$scope.$apply = (fn = () ->) ->
@ -64,11 +66,7 @@ define [
$scope.chat = {}
$scope.startFreeTrial = (source) ->
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
window.open("/user/subscription/new?planCode=student_free_trial_7_days")
$scope.startedFreeTrial = true
window._ide = ide
ide.project_id = $scope.project_id = window.project_id

View file

@ -0,0 +1,27 @@
define [
"base"
], (App) ->
App.controller "FreeTrialModalController", ($scope, abTestManager)->
buttonColorBuckets = [
{ bucketName:"red", btnClass:"primary"}
{ bucketName:"blue", btnClass:"info"}
]
buttonColorBucket = abTestManager.getABTestBucket "button_color", buttonColorBuckets
abTestManager.processTestWithStep("button_color", buttonColorBucket.bucketName, 0)
$scope.buttonClass = "btn-#{buttonColorBucket.btnClass}"
$scope.startFreeTrial = (source) ->
testBuckets = [
{ bucketName:"student_control", planName:"student"}
{ bucketName:"collab_test", planName:"collaborator"}
]
editorPlanBucket = abTestManager.getABTestBucket "editor_plan", testBuckets
abTestManager.processTestWithStep("editor_plan", editorPlanBucket.bucketName, 0)
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
window.open("/user/subscription/new?planCode=#{editorPlanBucket.planName}_free_trial_7_days&ssp=#{editorPlanBucket.planName == 'collaborator'}")
$scope.startedFreeTrial = true

View file

@ -7,16 +7,8 @@ define [
$scope.currencyCode = MultiCurrencyPricing.currencyCode
$scope.plans = MultiCurrencyPricing.plans
if MultiCurrencyPricing.currencyCode != "USD"
currencyBuckets = [
{ bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode}
{ bucketName:"eu-usd", currency:"USD"}
]
multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets
$scope.currencyCode = multiCurrencyBucket.currency
abTestManager.processTestWithStep("multi_currency_editor", multiCurrencyBucket.bucketName, 0)
$scope.changeCurrency = (newCurrency)->
window.location = "/user/subscription/new?planCode=#{window.plan_code}&currency=#{newCurrency}"
window.location = "/user/subscription/new?planCode=#{window.plan_code}&currency=#{newCurrency}"
$scope.switchToStudent = ()->
window.location = "/user/subscription/new?planCode=student&currency=#{$scope.currencyCode}"

View file

@ -46,29 +46,111 @@ define [
professional:
monthly: "£24"
annual: "£288"
SEK:
symbol: "kr"
student:
monthly: "60 kr"
annual: "600 kr"
collaborator:
monthly: "110 kr"
annual: "1320 kr"
professional:
monthly: "220 kr"
annual: "2640 kr"
CAD:
symbol: "$"
student:
monthly: "$9"
annual: "$90"
collaborator:
monthly: "$17"
annual: "$204"
professional:
monthly: "$34"
annual: "$408"
NOK:
symbol: "kr"
student:
monthly: "60 kr"
annual: "600 kr"
collaborator:
monthly: "110 kr"
annual: "1320 kr"
professional:
monthly: "220 kr"
annual: "2640 kr"
DKK:
symbol: "kr"
student:
monthly: "50 kr"
annual: "500 kr"
collaborator:
monthly: "90 kr"
annual: "1080 kr"
professional:
monthly: "180 kr"
annual: "2160 kr"
AUD:
symbol: "$"
student:
monthly: "$10"
annual: "$100"
collaborator:
monthly: "$18"
annual: "$216"
professional:
monthly: "$35"
annual: "$420"
NZD:
symbol: "$"
student:
monthly: "$10"
annual: "$100"
collaborator:
monthly: "$18"
annual: "$216"
professional:
monthly: "$35"
annual: "$420"
CHF:
symbol: "Fr"
student:
monthly: "Fr 8"
annual: "Fr 80"
collaborator:
monthly: "Fr 15"
annual: "Fr 180"
professional:
monthly: "Fr 30"
annual: "Fr 360"
SGD:
symbol: "$"
student:
monthly: "$12"
annual: "$120"
collaborator:
monthly: "$20"
annual: "$240"
professional:
monthly: "$40"
annual: "$480"
}
App.controller "PlansController", ($scope, $modal, event_tracking, abTestManager, MultiCurrencyPricing, $http) ->
$scope.plans = MultiCurrencyPricing.plans
$scope.currencyCode = MultiCurrencyPricing.currencyCode
if MultiCurrencyPricing.currencyCode != "USD"
currencyBuckets = [
{ bucketName:"eu-eu", currency:MultiCurrencyPricing.currencyCode}
{ bucketName:"eu-usd", currency:"USD"}
]
multiCurrencyBucket = abTestManager.getABTestBucket "multi_currency", currencyBuckets
$scope.currencyCode = multiCurrencyBucket.currency
$scope.trial_len = 7
$scope.planQueryString = '_free_trial_7_days'
@ -76,14 +158,10 @@ define [
view: "monthly"
$scope.changeCurreny = (newCurrency)->
$scope.currencyCode = newCurrency
$scope.signUpNowClicked = (plan, annual)->
if multiCurrencyBucket?
abTestManager.processTestWithStep("multi_currency", multiCurrencyBucket.bucketName, 0)
if $scope.ui.view == "annual"
plan = "#{plan}_annual"

View file

@ -91,6 +91,11 @@
}
}
.plansPageStudentLink {
margin-left: 20px;
margin-top: 20px;
}