using partials
How should I use partials in bones views ? any example to follow up ? Wiki says: To invoke partials, use this'PartialName'. but where should I call it ?
Call this from the template code that requires the partial. See https://github.com/mapbox/tilestream/blob/master/templates/Map._#L2 for an example.
Thanks kkaefer for your answer.
please see this code https://gist.github.com/1076231
What did I miss where ? Thanks again.
From the error in that file, the include of the partial seems to happen just fine. However, search_label isn't defined in the template arguments, so it throws an error. Can you paste the contents of /views/Home.server.bones? I can only see the Search view, not the Home view
views/Home.bones
view = Backbone.View.extend({ el: 'view', initialize: function(){ this.render(); } });
Home.server.bones:
views['Home'].prototype.render = function() { this.el = templates.Home(); return this; };
well, it works now: views['Home'].prototype.render = function() { var variables = { search_label: "My Search" }; this.el = templates.Home(variables); return this; };
where should I put events for Search template ?
/views/Search.bones
view = Backbone.View.extend({
initialize: function(){
this.render();
},
events: {
"click input[type=button]": "doSearch"
},
doSearch: function( event ){
// Button clicked, you can access the element that was clicked with event.currentTarget
alert( "Search for " + $("#search_input").val() );
}
});
or perhaps I should put events into Home.bones instead.
Thanks. I have found this FW + bones-auth + bones-admin the only one that works with models on client and server side and against CouchDB. Quite helpful.