Created
December 12, 2010 09:47
-
-
Save devth/737960 to your computer and use it in GitHub Desktop.
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
var info_div = "" + | |
" <div class='neighborhood'>" + | |
" <h3>{{name}}</h3>" + | |
" <ul>" + | |
" {{#addresses}}" + | |
" <li class='spot'>" + | |
" <a href='#' data-address-id='{{id}}'>{{spot/name}}</a>" + | |
" <ul class='days_available'>{{#days_available}}{{/days_available}}</ul>" + | |
" </li>" + | |
" {{/addresses}}" + | |
" </ul>" + | |
" </div>" + | |
""; | |
Handlebars.registerHelper('days_available', function(context, fn) { | |
var self = this; | |
return $.map(days, function(value){ | |
var class_name = self.__get__(value) ? "available" : ""; | |
return "<li class='" + class_name + "'>" + value[0] + "</li>"; | |
}).join(""); | |
}); | |
var info_div_template = Handlebars.compile(info_div); | |
info_panel.append(info_div_template(neighborhood_data)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment