From c273f36bb088d6564726888f06f76ba816d71023 Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 24 Mar 2014 17:31:37 +0000 Subject: [PATCH 01/11] Order errors by severity. error -> warning -> typsetting --- services/web/public/coffee/pdf/CompiledView.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/public/coffee/pdf/CompiledView.coffee b/services/web/public/coffee/pdf/CompiledView.coffee index cae6cbb948..9c3684aa18 100644 --- a/services/web/public/coffee/pdf/CompiledView.coffee +++ b/services/web/public/coffee/pdf/CompiledView.coffee @@ -90,7 +90,7 @@ define [ logButtonHtml = "Logs" if compileErrors? - for error in compileErrors.all + for error in compileErrors.errors.concat(compileErrors.warnings).concat(compileErrors.typesetting) errorView = new LatexErrorView(@options.manager.ide, error) errorView.render() @errorViews.push(errorView) From a434243bd2c52b79533acb9c089aedbb7f1a9340 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 13:11:32 +0000 Subject: [PATCH 02/11] Fix slight history range glitch --- services/web/public/stylesheets/less/trackchanges.less | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/public/stylesheets/less/trackchanges.less b/services/web/public/stylesheets/less/trackchanges.less index b27a81802d..e569b3e935 100644 --- a/services/web/public/stylesheets/less/trackchanges.less +++ b/services/web/public/stylesheets/less/trackchanges.less @@ -256,6 +256,7 @@ li.hover-selected { .change-selectors { .range { + top: 0; background-color: #999; } } From fe99be48acbd5f62ba4f16b8f6eb480d235f4e6e Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 13:31:53 +0000 Subject: [PATCH 03/11] Add upgrade message to history for free users --- services/web/app/views/templates.jade | 4 ++++ .../coffee/track-changes/ChangeListView.coffee | 3 +++ .../track-changes/TrackChangesManager.coffee | 16 +++++++++++++--- .../public/stylesheets/less/trackchanges.less | 9 +++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/templates.jade b/services/web/app/views/templates.jade index cb582e7c42..d8c4000e31 100644 --- a/services/web/app/views/templates.jade +++ b/services/web/app/views/templates.jade @@ -463,6 +463,10 @@ ul.change-list.nav.nav-pills.nav-stacked li.loading-changes Loading... li.empty-message You haven't made any changes yet! + li.upgrade-message + p We only store one week of changes for free accounts. Upgrade for an unlimited history. + p + button.btn.btn-primary.upgrade Upgrade script(type='text/template')#hotKeysListTemplate .hotkeys diff --git a/services/web/public/coffee/track-changes/ChangeListView.coffee b/services/web/public/coffee/track-changes/ChangeListView.coffee index 80a0fb0915..373f091360 100644 --- a/services/web/public/coffee/track-changes/ChangeListView.coffee +++ b/services/web/public/coffee/track-changes/ChangeListView.coffee @@ -17,6 +17,7 @@ define [ events: "scroll" : () -> @loadUntilFull() + "click button.upgrade": () -> @trigger "upgrade" initialize: () -> @itemViews = [] @@ -36,6 +37,8 @@ define [ render: -> @$el.html Mustache.to_html @template + if !@options.promptToUpgrade + @$(".upgrade-message").hide() @$el.css overflow: "scroll" this diff --git a/services/web/public/coffee/track-changes/TrackChangesManager.coffee b/services/web/public/coffee/track-changes/TrackChangesManager.coffee index ab27d883a1..4dca137583 100644 --- a/services/web/public/coffee/track-changes/TrackChangesManager.coffee +++ b/services/web/public/coffee/track-changes/TrackChangesManager.coffee @@ -3,10 +3,11 @@ define [ "track-changes/models/Diff" "track-changes/ChangeListView" "track-changes/DiffView" + "account/AccountManager" "utils/Modal" "models/Doc" "moment" -], (ChangeList, Diff, ChangeListView, DiffView, Modal, Doc, moment) -> +], (ChangeList, Diff, ChangeListView, DiffView, AccountManager, Modal, Doc, moment) -> class TrackChangesManager template: $("#trackChangesPanelTemplate").html() @@ -47,8 +48,9 @@ define [ @changes = new ChangeList([], project_id: @project_id, ide: @ide) @changeListView = new ChangeListView( - collection : @changes, - el : @$el.find(".change-list-area") + el: @$el.find(".change-list-area") + collection: @changes + promptToUpgrade: !@ide.project.get("features").versioning ) @changeListView.render() @changeListView.loadUntilFull (error) => @@ -57,6 +59,8 @@ define [ @changeListView.on "change_diff", (fromIndex, toIndex) => @selectDocAndUpdateDiff(fromIndex, toIndex) + @changeListView.on "upgrade", () => @askToUpgrade() + if @diffView? @diffView.remove() @@ -191,4 +195,10 @@ define [ disable: () -> @enabled = false + askToUpgrade: () -> + ga('send', 'event', 'subscription-funnel', 'askToUpgrade', "trackchanges") + AccountManager.askToUpgrade @ide, + onUpgrade: () => + ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "trackchanges") + return TrackChangesManager diff --git a/services/web/public/stylesheets/less/trackchanges.less b/services/web/public/stylesheets/less/trackchanges.less index e569b3e935..a1d1190b76 100644 --- a/services/web/public/stylesheets/less/trackchanges.less +++ b/services/web/public/stylesheets/less/trackchanges.less @@ -193,6 +193,10 @@ } li.loading-changes, li.empty-message { padding: 6px; + cursor: default; + &:hover { + background-color: inherit; + } } li.selected-change { background-color: #eaeaea; @@ -242,6 +246,11 @@ } } } + li.upgrade-message { + padding: 15px; + background-color: rgb(255, 251, 210); + cursor: default; + } } ul.change-list.hover-state { li { From dfdfba4b2e6f84afbffddc20df6ceb279d9338d1 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 14:06:56 +0000 Subject: [PATCH 04/11] Undelegate old events when refreshing history --- services/web/public/coffee/track-changes/ChangeListView.coffee | 3 +++ .../web/public/coffee/track-changes/TrackChangesManager.coffee | 3 +++ 2 files changed, 6 insertions(+) diff --git a/services/web/public/coffee/track-changes/ChangeListView.coffee b/services/web/public/coffee/track-changes/ChangeListView.coffee index 373f091360..bfc95fd3bd 100644 --- a/services/web/public/coffee/track-changes/ChangeListView.coffee +++ b/services/web/public/coffee/track-changes/ChangeListView.coffee @@ -43,6 +43,9 @@ define [ overflow: "scroll" this + remove: () -> + @undelegateEvents() + addItem: (model) -> index = @collection.indexOf(model) previousModel = @collection.models[index - 1] diff --git a/services/web/public/coffee/track-changes/TrackChangesManager.coffee b/services/web/public/coffee/track-changes/TrackChangesManager.coffee index 4dca137583..fecc639cbb 100644 --- a/services/web/public/coffee/track-changes/TrackChangesManager.coffee +++ b/services/web/public/coffee/track-changes/TrackChangesManager.coffee @@ -47,6 +47,9 @@ define [ show: () -> @changes = new ChangeList([], project_id: @project_id, ide: @ide) + if @changeListView? + @changeListView.remove() + @changeListView = new ChangeListView( el: @$el.find(".change-list-area") collection: @changes From 0e54c4ae496284db731069da99142336f5b79630 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 16:24:50 +0000 Subject: [PATCH 05/11] Set up history with AB testing for different methods of upgrading --- services/web/app/views/layout.jade | 2 +- services/web/app/views/templates.jade | 11 ++++-- .../coffee/account/AccountManager.coffee | 15 ++++++-- .../coffee/analytics/AnalyticsManager.coffee | 19 +++++++++- .../ProjectMembersManager.coffee | 3 +- .../track-changes/ChangeListView.coffee | 3 -- .../track-changes/TrackChangesManager.coffee | 27 ++++++++++++-- .../public/stylesheets/less/trackchanges.less | 35 ++++++++++++++++++- 8 files changed, 101 insertions(+), 14 deletions(-) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 74ac1276cd..a849944252 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -28,7 +28,7 @@ html(itemscope, itemtype='http://schema.org/Product') ga('send', 'pageview'); - else script(type='text/javascript') - window.ga = function() {}; + window.ga = function() { console.log("Sending to GA", arguments) }; script window.csrfToken = "#{csrfToken}"; diff --git a/services/web/app/views/templates.jade b/services/web/app/views/templates.jade index d8c4000e31..f4143382f4 100644 --- a/services/web/app/views/templates.jade +++ b/services/web/app/views/templates.jade @@ -434,6 +434,13 @@ i.icon-remove .change-list-area .track-changes-diff + .track-changes-upgrade-popup(style="display: none;") + .message + p You need to upgrade your plan to use the History feature. + button.btn.btn-primary.start-free-trial Start free trial + .track-changes-upgrade-control(style="display: none;") + .message History is not yet enabled for this project. + button.btn.btn-primary.btn-large.upgrade Enable History script(type='text/template')#trackChangesDiffTemplate .track-changes-diff-toolbar.btn-toolbar @@ -463,10 +470,10 @@ ul.change-list.nav.nav-pills.nav-stacked li.loading-changes Loading... li.empty-message You haven't made any changes yet! - li.upgrade-message + li.track-changes-upgrade-oneweek(style="display: none;") p We only store one week of changes for free accounts. Upgrade for an unlimited history. p - button.btn.btn-primary.upgrade Upgrade + button.btn.btn-primary.start-free-trial Start free trial script(type='text/template')#hotKeysListTemplate .hotkeys diff --git a/services/web/public/coffee/account/AccountManager.coffee b/services/web/public/coffee/account/AccountManager.coffee index 2120ce35bc..5329d36de3 100644 --- a/services/web/public/coffee/account/AccountManager.coffee +++ b/services/web/public/coffee/account/AccountManager.coffee @@ -25,8 +25,19 @@ define [ },{ text: "Enter Billing Information" class: "btn-primary" - callback: () -> - window.location = "/user/subscription/new?planCode=student_free_trial" + callback: () => + options.onUpgrade?() + @gotoSubscriptionsPage() + }] + + gotoSubscriptionsPage: () -> + window.open("/user/subscription/new?planCode=student_free_trial") + Modal.createModal + title: "Please refresh" + message: "Please refresh this page after starting your free trial. This will make sure all of your features are enabled." + buttons: [{ + text: "OK" + class: "" }] showUpgradeDialog: (ide, options = {}) -> diff --git a/services/web/public/coffee/analytics/AnalyticsManager.coffee b/services/web/public/coffee/analytics/AnalyticsManager.coffee index 9b2bc49702..e06cf264c3 100644 --- a/services/web/public/coffee/analytics/AnalyticsManager.coffee +++ b/services/web/public/coffee/analytics/AnalyticsManager.coffee @@ -1,4 +1,6 @@ -define () -> +define [ + "libs/md5" +], () -> class AnalyticsManager constructor: (@ide) -> @ide.editor.on "update:doc", () => @@ -14,3 +16,18 @@ define () -> ga('send', 'event', 'editor-interaction', 'single-compile') if @compileCount == 3 ga('send', 'event', 'editor-interaction', 'multi-compile') + + getABTestBucket: (test_name, buckets = []) -> + hash = CryptoJS.MD5("#{@ide.user.get("id")}:#{test_name}") + bucketIndex = parseInt(hash.toString().slice(0,2), 16) % buckets.length + return buckets[bucketIndex] + + startABTest: (test_name, buckets = []) -> + value = @getABTestBucket(test_name, buckets) + ga('send', 'event', 'ab_tests', test_name, "viewed-#{value}") + return value + + endABTest: (test_name, buckets = []) -> + value = @getABTestBucket(test_name, buckets) + ga('send', 'event', 'ab_tests', test_name, "converted-#{value}") + return value \ No newline at end of file diff --git a/services/web/public/coffee/project-members/ProjectMembersManager.coffee b/services/web/public/coffee/project-members/ProjectMembersManager.coffee index 82ff4bfdcc..d597345777 100644 --- a/services/web/public/coffee/project-members/ProjectMembersManager.coffee +++ b/services/web/public/coffee/project-members/ProjectMembersManager.coffee @@ -76,17 +76,18 @@ define [ @ide.socket.emit "removeUserFromProject", member.id addMember: (email, privileges) -> + console.log "Adding member", email @ide.socket.emit "addUserToProject", email, privileges, (error, added) => if error? @ide.showGenericServerErrorMessage() return if !added + console.log "got response", error, added ga('send', 'event', 'subscription-funnel', 'askToUpgrade', "projectMemebrs") AccountManager.askToUpgrade @ide, why: "to add additional collaborators" onUpgrade: () => ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "projectMemebrs") - @addMember(email, privileges) afterMemberRemoved: (memberId) -> for member in @members.models diff --git a/services/web/public/coffee/track-changes/ChangeListView.coffee b/services/web/public/coffee/track-changes/ChangeListView.coffee index bfc95fd3bd..223f94ce47 100644 --- a/services/web/public/coffee/track-changes/ChangeListView.coffee +++ b/services/web/public/coffee/track-changes/ChangeListView.coffee @@ -17,7 +17,6 @@ define [ events: "scroll" : () -> @loadUntilFull() - "click button.upgrade": () -> @trigger "upgrade" initialize: () -> @itemViews = [] @@ -37,8 +36,6 @@ define [ render: -> @$el.html Mustache.to_html @template - if !@options.promptToUpgrade - @$(".upgrade-message").hide() @$el.css overflow: "scroll" this diff --git a/services/web/public/coffee/track-changes/TrackChangesManager.coffee b/services/web/public/coffee/track-changes/TrackChangesManager.coffee index fecc639cbb..46f3083f8a 100644 --- a/services/web/public/coffee/track-changes/TrackChangesManager.coffee +++ b/services/web/public/coffee/track-changes/TrackChangesManager.coffee @@ -44,16 +44,15 @@ define [ @doc_id = doc_id @updateDiff() + AB_BUCKETS: ["control", "one-week", "pop-up"] show: () -> @changes = new ChangeList([], project_id: @project_id, ide: @ide) if @changeListView? @changeListView.remove() - @changeListView = new ChangeListView( el: @$el.find(".change-list-area") collection: @changes - promptToUpgrade: !@ide.project.get("features").versioning ) @changeListView.render() @changeListView.loadUntilFull (error) => @@ -62,7 +61,7 @@ define [ @changeListView.on "change_diff", (fromIndex, toIndex) => @selectDocAndUpdateDiff(fromIndex, toIndex) - @changeListView.on "upgrade", () => @askToUpgrade() + @showUpgradeView() if @diffView? @diffView.remove() @@ -72,6 +71,21 @@ define [ @ide.fileViewManager.disable() @enable() + showUpgradeView: () -> + @upgradeType ||= @ide.analyticsManager.startABTest('track-changes-upgrade', @AB_BUCKETS) + @$el.find("button.upgrade").off "click.track-changes" + @$el.find("button.start-free-trial").off "click.track-changes" + @$el.find("button.upgrade").on "click.track-changes", () => @askToUpgrade() + @$el.find("button.start-free-trial").on "click.track-changes", () => @gotoFreeTrial() + + if !@ide.project.get("features").versioning + if @upgradeType == "pop-up" + @$el.find(".track-changes-upgrade-popup").show() + else if @upgradeType == "control" + @$el.find(".track-changes-upgrade-control").show() + else if @upgradeType == "one-week" + @$el.find(".track-changes-upgrade-oneweek").show() + hide: () -> @ide.editor.enable() @ide.fileViewManager.enable() @@ -200,8 +214,15 @@ define [ askToUpgrade: () -> ga('send', 'event', 'subscription-funnel', 'askToUpgrade', "trackchanges") + ga('send', 'event', 'ab_tests', 'track-changes-upgrade', "prompted-to-upgrade-#{@upgradeType}") AccountManager.askToUpgrade @ide, onUpgrade: () => + @ide.analyticsManager.endABTest('track-changes-upgrade', @AB_BUCKETS) ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "trackchanges") + gotoFreeTrial: () -> + AccountManager.gotoSubscriptionsPage() + @ide.analyticsManager.endABTest('track-changes-upgrade', @AB_BUCKETS) + ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', "trackchanges") + return TrackChangesManager diff --git a/services/web/public/stylesheets/less/trackchanges.less b/services/web/public/stylesheets/less/trackchanges.less index a1d1190b76..f9f12bbcc8 100644 --- a/services/web/public/stylesheets/less/trackchanges.less +++ b/services/web/public/stylesheets/less/trackchanges.less @@ -79,6 +79,39 @@ } } + .track-changes-upgrade-control, .track-changes-upgrade-popup { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 100; + } + + .track-changes-upgrade-popup { + background-color: rgba(128,128,128,0.4); + .message { + margin: auto; + margin-top: 200px; + padding: 10px 10px 14px 10px; + width: 400px; + font-weight: bold; + text-align: center; + background-color: white; + .border-radius(8px); + } + } + + .track-changes-upgrade-control { + background-color: #eeeeee; + text-align: center; + .message { + font-size: 18px; + margin: 12px; + margin-top: 36px; + } + } + .deleted-change-background, .deleted-change-foreground, .inserted-change-background, @@ -246,7 +279,7 @@ } } } - li.upgrade-message { + li.track-changes-upgrade-oneweek { padding: 15px; background-color: rgb(255, 251, 210); cursor: default; From 6f2b7e43a6304722840803c1d3d9f379bb74b5fb Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 16:44:10 +0000 Subject: [PATCH 06/11] Add in tooltips to make the radio buttons clearer in the history view --- .../public/coffee/track-changes/ChangeListView.coffee | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/web/public/coffee/track-changes/ChangeListView.coffee b/services/web/public/coffee/track-changes/ChangeListView.coffee index 223f94ce47..1212faa1fe 100644 --- a/services/web/public/coffee/track-changes/ChangeListView.coffee +++ b/services/web/public/coffee/track-changes/ChangeListView.coffee @@ -211,6 +211,17 @@ define [ else @$el.addClass("first-in-day") + @$(".change-selector-from").tooltip({ + title: "Show back to this change", + placement: "left", + animation: false + }) + @$(".change-selector-to").tooltip({ + title: "Show up to this change", + placement: "left", + animation: false + }) + return this onClick: (e) -> From 8146dd7ce9dece28b19f0dce7eefc2467e66c5f0 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 21:43:42 +0000 Subject: [PATCH 07/11] Intercept response status code in tpds worker and catch errors before proxying --- services/web/TpdsWorker.coffee | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/services/web/TpdsWorker.coffee b/services/web/TpdsWorker.coffee index 5ffc1e303d..ba982ac2d5 100644 --- a/services/web/TpdsWorker.coffee +++ b/services/web/TpdsWorker.coffee @@ -38,21 +38,25 @@ processingFuncs = request options.streamOrigin, (err,res, body)-> logger.log options:options, body:body origin = request(options.streamOrigin) + origin.on 'response', (res) -> + if 200 <= res.statusCode < 300 + dest = request(options) + origin.pipe(dest) + + dest.on "error", (err)-> + logger.error err:err, options:options, "something went wrong in pipeStreamFrom dest" + callback(err) + + dest.on 'end', callback + else + error = new Error("received non-success status code: #{res.statusCode}") + logger.error err: error, options: options, "something went wrong connecting to origin" + callback(error) + origin.on 'error', (err)-> logger.error err:err, options:options, "something went wrong in pipeStreamFrom origin" - if err? - callback(err) - else - callback() - dest = request(options) - origin.pipe(dest) - dest.on "error", (err)-> - logger.error err:err, options:options, "something went wrong in pipeStreamFrom dest" - if err? - callback(err) - else - callback() - dest.on 'end', callback + callback(err) + workerRegistration = (groupKey, method, options, callback)-> From 1ec8bdcaeabb6bfc797a7ccea6424152940ba1e2 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 22:28:39 +0000 Subject: [PATCH 08/11] Add timeout to tpds worker --- services/web/TpdsWorker.coffee | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/services/web/TpdsWorker.coffee b/services/web/TpdsWorker.coffee index ba982ac2d5..9c70c2abeb 100644 --- a/services/web/TpdsWorker.coffee +++ b/services/web/TpdsWorker.coffee @@ -33,12 +33,20 @@ processingFuncs = else callback() - pipeStreamFrom: (options, callback)-> + pipeStreamFrom: (options, _callback)-> + callback = (args...) -> + _callback(args...) + _callback = () -> + if options.filePath == "/droppy/main.tex" request options.streamOrigin, (err,res, body)-> logger.log options:options, body:body + origin = request(options.streamOrigin) + + cancelled = false origin.on 'response', (res) -> + return if cancelled if 200 <= res.statusCode < 300 dest = request(options) origin.pipe(dest) @@ -54,9 +62,17 @@ processingFuncs = callback(error) origin.on 'error', (err)-> + return if cancelled logger.error err:err, options:options, "something went wrong in pipeStreamFrom origin" callback(err) + setTimeout () -> + cancelled = true + error = new Error("timeout") + logger.error err: error, options: options, "timeout" + callback(error) + , 5000 + workerRegistration = (groupKey, method, options, callback)-> From 73b67026c786f9c5cfe4dca7834af1eaa03c03a2 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 23:05:32 +0000 Subject: [PATCH 09/11] Only put timeout on response, not whole request --- services/web/TpdsWorker.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/TpdsWorker.coffee b/services/web/TpdsWorker.coffee index 9c70c2abeb..481448f313 100644 --- a/services/web/TpdsWorker.coffee +++ b/services/web/TpdsWorker.coffee @@ -45,8 +45,10 @@ processingFuncs = origin = request(options.streamOrigin) cancelled = false + gotResponse = false origin.on 'response', (res) -> return if cancelled + gotResponse = true if 200 <= res.statusCode < 300 dest = request(options) origin.pipe(dest) @@ -63,10 +65,12 @@ processingFuncs = origin.on 'error', (err)-> return if cancelled + gotResponse = true logger.error err:err, options:options, "something went wrong in pipeStreamFrom origin" callback(err) setTimeout () -> + return if gotResponse cancelled = true error = new Error("timeout") logger.error err: error, options: options, "timeout" From cb1020d5c1b060baf7c2c6f3f5fc6835618c2f48 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 25 Mar 2014 23:05:55 +0000 Subject: [PATCH 10/11] Reduce timeout --- services/web/TpdsWorker.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/TpdsWorker.coffee b/services/web/TpdsWorker.coffee index 481448f313..cfc5dcd875 100644 --- a/services/web/TpdsWorker.coffee +++ b/services/web/TpdsWorker.coffee @@ -75,7 +75,7 @@ processingFuncs = error = new Error("timeout") logger.error err: error, options: options, "timeout" callback(error) - , 5000 + , 2000 From 0255e08e1f8276e3075cacf5f2eafc3236c92a43 Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 26 Mar 2014 13:20:08 +0000 Subject: [PATCH 11/11] Don't show upgrade prompts for non-owners --- services/web/app/views/templates.jade | 10 +++++++--- .../coffee/track-changes/TrackChangesManager.coffee | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/templates.jade b/services/web/app/views/templates.jade index f4143382f4..aaccdbde8a 100644 --- a/services/web/app/views/templates.jade +++ b/services/web/app/views/templates.jade @@ -435,9 +435,11 @@ .change-list-area .track-changes-diff .track-changes-upgrade-popup(style="display: none;") - .message + .message.show-when-owner p You need to upgrade your plan to use the History feature. button.btn.btn-primary.start-free-trial Start free trial + .message.show-when-not-owner + p Please ask the project owner to upgrade to use the History feature. .track-changes-upgrade-control(style="display: none;") .message History is not yet enabled for this project. button.btn.btn-primary.btn-large.upgrade Enable History @@ -471,9 +473,11 @@ li.loading-changes Loading... li.empty-message You haven't made any changes yet! li.track-changes-upgrade-oneweek(style="display: none;") - p We only store one week of changes for free accounts. Upgrade for an unlimited history. - p + p We only store one week of changes for free accounts. + p.show-when-owner Upgrade for an unlimited history. + p.show-when-owner button.btn.btn-primary.start-free-trial Start free trial + p.show-when-not-owner Please ask the project owner to upgrade. script(type='text/template')#hotKeysListTemplate .hotkeys diff --git a/services/web/public/coffee/track-changes/TrackChangesManager.coffee b/services/web/public/coffee/track-changes/TrackChangesManager.coffee index 46f3083f8a..393163c781 100644 --- a/services/web/public/coffee/track-changes/TrackChangesManager.coffee +++ b/services/web/public/coffee/track-changes/TrackChangesManager.coffee @@ -86,6 +86,11 @@ define [ else if @upgradeType == "one-week" @$el.find(".track-changes-upgrade-oneweek").show() + if @ide.project.get("owner") == @ide.user + @$el.find(".show-when-not-owner").hide() + else + @$el.find(".show-when-owner").hide() + hide: () -> @ide.editor.enable() @ide.fileViewManager.enable()