Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Created July 3, 2013 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knownasilya/5917601 to your computer and use it in GitHub Desktop.
Save knownasilya/5917601 to your computer and use it in GitHub Desktop.
Providers Show View
App.ProvidersShowView = Ember.View.extend({
templateName: "providersShow",
elementId: "providers",
popupBinding: "controller.controllers.map.providerPopup",
init: function () {
this._super();
this.createElement();
},
/* Begin Providers Collection */
providersCollection: Ember.CollectionView.extend({
tagName: "ul",
contentBinding: "controller.content",
/* Begin Item Class */
itemViewClass: Ember.View.extend({
templateName: "providerItem",
click: function (event) {
// Doesn't fire
alert("clicked - item");
}
}),
/* End Item Class*/
onChildViewsChanged : function (obj, key) {
var length = this.get( "childViews.length" );
if (length > 0) {
Ember.run.scheduleOnce("afterRender", this, "childViewsDidRender");
}
}.observes("childViews"),
childViewsDidRender : function () {
this.get("parentView").updatePopup();
},
click: function (event) {
// Doesn't fire
alert("clicked - coll");
}
}),
/* End Providers Collection */
updatePopup: function () {
var view = this,
popup = this.get("popup"),
markerGroup = this.get("controller.controllers.map.providerMarkerGroup"),
map = this.get("controller.controllers.map.map");
popup.setContent(/*this.$().get(0)*/"");
if (popup && popup.hasOwnProperty("_content")) {
markerGroup.eachLayer(function (marker) {
marker.bindPopup(popup);
});
}
map.on("popupopen", function (event) {
this.destroyElement();
this.appendTo($(".leaflet-popup-content"));
}, view);
},
click: function (event) {
// Doesn't fire
alert("clicked - parent");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment