Created
February 7, 2014 03:57
-
-
Save dbouwman/8857184 to your computer and use it in GitHub Desktop.
Map Controls view with calls to log the event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Composer.module('MapBarModule.Controls', function (Controls, App, Backbone, Marionette, $, _) { | |
//Controls item view | |
Controls.View = Backbone.Marionette.ItemView.extend({ | |
model: Controls.Model, | |
template: 'mapbar/controls/controls_view', | |
className: 'mapbar-controls', | |
events: { | |
"click .type": "_changeBasemap" | |
}, | |
_changeBasemap: function(e) { | |
var id = e.target.id; | |
//toggle some classes to update the UI | |
this.$el.find('.type').removeClass('selected-type'); | |
this.$el.find('#'+id).addClass('selected-type'); | |
//log that the user did this action | |
App.logUiEvent(id, 'map-basemap'); | |
//event bus call | |
App.execute('map:new:basemap', id.replace(/basemap-/, '')); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment