mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 08:00:03 +00:00
- migrated event tracking to new pages/angular
- hooked up the search field on projects to search on keypress
This commit is contained in:
parent
608fc8364b
commit
57ad5e4182
6 changed files with 63 additions and 18 deletions
|
@ -6,7 +6,8 @@
|
|||
placeholder='Search projects…',
|
||||
autofocus='autofocus',
|
||||
ng-model="searchText",
|
||||
focus-on='search:clear'
|
||||
focus-on='search:clear',
|
||||
ng-keyup="searchProjects()"
|
||||
)
|
||||
i.fa.fa-search.form-control-feedback-left
|
||||
i.fa.fa-times.form-control-feedback(
|
||||
|
|
|
@ -19,17 +19,17 @@ block content
|
|||
li(ng-class="{'active': ui.view == 'monthly'}")
|
||||
a(
|
||||
href,
|
||||
ng-click="ui.view = 'monthly'"
|
||||
ng-click="switchToMonthly()"
|
||||
) Monthly
|
||||
li(ng-class="{'active': ui.view == 'annual'}")
|
||||
a(
|
||||
href
|
||||
ng-click="ui.view = 'annual'"
|
||||
ng-click="switchToAnnual()"
|
||||
) Annual
|
||||
li(ng-class="{'active': ui.view == 'student'}")
|
||||
a(
|
||||
href,
|
||||
ng-click="ui.view = 'student'"
|
||||
ng-click="switchToStudent()"
|
||||
) Half Price Student Plans
|
||||
|
||||
.row(ng-cloak)
|
||||
|
@ -62,7 +62,7 @@ block content
|
|||
li
|
||||
br
|
||||
a.btn.btn-primary(
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=collaborator{{ ui.view == 'annual' && '_annual' || ''}}"
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=collaborator{{ ui.view == 'annual' && '_annual' || ''}}", ng-click="signUpNowClicked('collaborator')"
|
||||
) Sign up now!
|
||||
.card
|
||||
.card-header
|
||||
|
@ -81,7 +81,7 @@ block content
|
|||
li
|
||||
br
|
||||
a.btn.btn-primary(
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=professional{{ ui.view == 'annual' && '_annual' || ''}}"
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=professional{{ ui.view == 'annual' && '_annual' || ''}}", ng-click="signUpNowClicked('professional')"
|
||||
) Sign up now!
|
||||
|
||||
.card-group.text-centered(ng-if="ui.view == 'student'")
|
||||
|
@ -109,7 +109,7 @@ block content
|
|||
li
|
||||
br
|
||||
a.btn.btn-primary(
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=student"
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=student", ng-click="signUpNowClicked('student')"
|
||||
) Sign up now!
|
||||
.card
|
||||
.card-header
|
||||
|
@ -125,7 +125,7 @@ block content
|
|||
li
|
||||
br
|
||||
a.btn.btn-primary(
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=student_annual"
|
||||
ng-href="#{baseUrl}/user/subscription/new?planCode=student_annual", ng-click="signUpNowClicked('student')"
|
||||
) Sign up now!
|
||||
|
||||
.row(ng-cloak)
|
||||
|
@ -175,7 +175,7 @@ block content
|
|||
li.small All the advantages of the Professional account for each team member
|
||||
li
|
||||
br
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_5_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_5_members{{ ui.view == 'annual' && '_annual' || ''}}", ng-click="signUpNowClicked('group_5_members')") Sign up now!
|
||||
.card.highlighted
|
||||
.card-header
|
||||
h2 Research Lab
|
||||
|
@ -191,7 +191,7 @@ block content
|
|||
li.small All the advantages of the Professional account for each team member
|
||||
li
|
||||
br
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_10_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_10_members{{ ui.view == 'annual' && '_annual' || ''}}", ng-click="signUpNowClicked('group_10_members')") Sign up now!
|
||||
.card
|
||||
.card-header
|
||||
h2 Department
|
||||
|
@ -207,4 +207,4 @@ block content
|
|||
li.small All the advantages of the Professional account for each team member
|
||||
li
|
||||
br
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_20_members{{ ui.view == 'annual' && '_annual' || ''}}") Sign up now!
|
||||
a.btn.btn-primary(href="#{baseUrl}/user/subscription/new?planCode=group_20_members{{ ui.view == 'annual' && '_annual' || ''}}", ng-click="signUpNowClicked('group_20_members')") Sign up now!
|
||||
|
|
|
@ -6,6 +6,7 @@ define [
|
|||
"main/plans"
|
||||
"main/group-members"
|
||||
"main/scribtex-popup"
|
||||
"main/event-tracking"
|
||||
"directives/asyncForm"
|
||||
"directives/stopPropagation"
|
||||
"directives/focus"
|
||||
|
@ -15,5 +16,6 @@ define [
|
|||
"directives/selectAll"
|
||||
"directives/maxHeight"
|
||||
"filters/formatDate"
|
||||
|
||||
], () ->
|
||||
angular.bootstrap(document.body, ["SharelatexApp"])
|
||||
|
|
17
services/web/public/coffee/main/event-tracking.coffee
Normal file
17
services/web/public/coffee/main/event-tracking.coffee
Normal file
|
@ -0,0 +1,17 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
|
||||
App.factory "event_tracking", ->
|
||||
return {
|
||||
send: (category, action, label, value)->
|
||||
ga('send', 'event', category, action, label, value)
|
||||
}
|
||||
|
||||
|
||||
#header
|
||||
$('.navbar a').on "click", (e)->
|
||||
href = $(e.target).attr("href")
|
||||
if href?
|
||||
ga('send', 'event', 'navigation', 'top menu bar', href)
|
||||
|
|
@ -1,6 +1,24 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.controller "PlansController", ($scope) ->
|
||||
App.controller "PlansController", ($scope, event_tracking) ->
|
||||
|
||||
$scope.ui =
|
||||
view: "monthly"
|
||||
view: "monthly"
|
||||
|
||||
$scope.signUpNowClicked = (plan, annual)->
|
||||
if $scope.ui.view == "annual"
|
||||
plan = "#{plan}_annual"
|
||||
event_tracking.send 'subscription-funnel', 'sign_up_now_button', plan
|
||||
|
||||
$scope.switchToMonthly = ->
|
||||
$scope.ui.view = "monthly"
|
||||
event_tracking.send 'subscription-funnel', 'plans-page', 'monthly-prices'
|
||||
|
||||
$scope.switchToStudent = ->
|
||||
$scope.ui.view = "student"
|
||||
event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
|
||||
|
||||
$scope.switchToAnnual = ->
|
||||
$scope.ui.view = "annual"
|
||||
event_tracking.send 'subscription-funnel', 'plans-page', 'student-prices'
|
||||
|
|
|
@ -50,7 +50,7 @@ define [
|
|||
|
||||
]
|
||||
|
||||
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp) ->
|
||||
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking) ->
|
||||
$scope.projects = window.data.projects
|
||||
$scope.tags = window.data.tags
|
||||
$scope.allSelected = false
|
||||
|
@ -89,6 +89,10 @@ define [
|
|||
else
|
||||
return ""
|
||||
|
||||
$scope.searchProjects = ->
|
||||
event_tracking.send 'project-list-page-interaction', 'project-search', 'keydown'
|
||||
$scope.updateVisibleProjects()
|
||||
|
||||
$scope.clearSearchText = () ->
|
||||
$scope.searchText = ""
|
||||
$scope.$emit "search:clear"
|
||||
|
@ -196,6 +200,7 @@ define [
|
|||
|
||||
$scope.addSelectedProjectsToTag = (tag) ->
|
||||
selected_projects = $scope.getSelectedProjects()
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'addSelectedProjectsToTag'
|
||||
|
||||
# Add project_ids into tag.project_ids
|
||||
added_project_ids = []
|
||||
|
@ -217,6 +222,7 @@ define [
|
|||
}
|
||||
|
||||
$scope.createTag = (name) ->
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'createTag'
|
||||
$scope.tags.push {
|
||||
name: name
|
||||
project_ids: []
|
||||
|
@ -261,6 +267,7 @@ define [
|
|||
return deferred.promise
|
||||
|
||||
$scope.openCreateProjectModal = (template = "none") ->
|
||||
event_tracking.send 'project-list-page-interaction', 'new-project', template
|
||||
modalInstance = $modal.open(
|
||||
templateUrl: "newProjectModalTemplate"
|
||||
controller: "NewProjectModalController"
|
||||
|
@ -282,7 +289,7 @@ define [
|
|||
$scope.openRenameProjectModal = () ->
|
||||
project = $scope.getFirstSelectedProject()
|
||||
return if !project? or project.accessLevel != "owner"
|
||||
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'Rename'
|
||||
modalInstance = $modal.open(
|
||||
templateUrl: "renameProjectModalTemplate"
|
||||
controller: "RenameProjectModalController"
|
||||
|
@ -297,7 +304,7 @@ define [
|
|||
|
||||
$scope.cloneProject = (project, cloneName) ->
|
||||
deferred = $q.defer()
|
||||
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'Clone'
|
||||
queuedHttp
|
||||
.post("/project/#{project.id}/clone", {
|
||||
_csrf: window.csrfToken
|
||||
|
@ -339,7 +346,7 @@ define [
|
|||
resolve:
|
||||
projects: () -> $scope.getSelectedProjects()
|
||||
)
|
||||
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'Delete'
|
||||
modalInstance.result.then () ->
|
||||
$scope.archiveOrLeaveSelectedProjects()
|
||||
|
||||
|
@ -431,7 +438,7 @@ define [
|
|||
|
||||
$scope.downloadSelectedProjects = () ->
|
||||
selected_project_ids = $scope.getSelectedProjectIds()
|
||||
|
||||
event_tracking.send 'project-list-page-interaction', 'project action', 'Download Zip'
|
||||
if selected_project_ids.length > 1
|
||||
path = "/project/download/zip?project_ids=#{selected_project_ids.join(',')}"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue