Extend LinkView to allow click tracking.

Allows us to hook in to certain links and see how they're used.
This commit is contained in:
Mathias Meyer 2014-05-08 09:35:41 +02:00
parent 80b3c2c826
commit 3b2e8d69f3
2 changed files with 11 additions and 1 deletions

View File

@ -149,6 +149,16 @@ Travis.FormSettingsView = Ember.View.extend Ember.TargetActionSupport,
event.preventDefault()
@triggerAction()
Ember.LinkView.reopen
init: ->
@_super()
eventName = Ember.get(this, 'eventName')
if Ember.get(this, 'trackEvent')
@on(eventName, this, @_trackEvent)
@on(eventName, this, @_invoke)
_trackEvent: (event) ->
event.preventDefault()
Ember.Handlebars.registerHelper('settings-form', (path, options) ->
if arguments.length == 1

View File

@ -12,6 +12,6 @@
</li>
<li id="tab_new" {{bind-attr class="view.classNew"}}>
<h5>{{#link-to "profile.index" title="Add New Repository"}}+{{/link-to}}</h5>
<h5>{{#link-to "profile.index" trackEvent="add-repository-from-list" title="Add New Repository"}}+{{/link-to}}</h5>
</li>
</ul>