-
-
Save svenwelte/e6cc614010d38af1289e to your computer and use it in GitHub Desktop.
Example usage of _render_menu
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
_renderMenu: (ul, items) -> | |
self = this | |
ul.addClass @options.popupClass if @options.popupClass | |
$.each items, (index, item) -> | |
switch item.renderer | |
when "category" | |
$("<li class='ui-autocomplete-item ui-autocomplete-group category-" + item.category + "'>" + item.label + "</li>").appendTo ul | |
when "message" | |
$("<li class='ui-autocomplete-item ui-autocomplete-message'>" + item.label + "</li>").appendTo ul | |
when "multiline" | |
template = _.template("<li><a><%= label %><br/> <small><%= additionalInfo %></small></a></li>") | |
$(template(item).toString()).data("ui-autocomplete-item", item).appendTo ul | |
when "extra-classes" | |
template = _.template("<li class='<%= classes %>'><a><%= label %></a></li>") | |
$(template(item).toString()).data("ui-autocomplete-item", item).appendTo ul | |
when "action" | |
template = _.template("<li class='special-action <%= classes %>'><a><%= actionLabel %></a></li>") | |
$(template(item).toString()).data("ui-autocomplete-item", item).appendTo ul | |
else | |
self._renderItemData ul, item | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment