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 {