% if (!model_class->can("autocomplete")) {
Please select <%= a_printable(current_object) %> using one of the other menu items.
% if ($self->app->routes->find(current_object."/list")) {
For instance, the <%= link_to current_object."/list" => begin %> list <% end %> page.
% if ($self->app->routes->find(current_object."/search")) {
Or the <%= link_to current_object."/search" => begin %> search <% end %> page.
% }
% } else {
% if ($self->app->routes->find(current_object."/search")) {
For instance, the <%= link_to current_object."/search" => begin %> search <% end %> page.
% }
% }
% } else {
%# Uses https://github.com/mlmorg/bootstrap
%= javascript begin
$('#ta').typeahead({
source : function () {
$.get( "<%= url_for("$object/autocomplete") %>?q=" + encodeURIComponent($("#ta").val()),
[],
function(data,textStatus,jqXHR) {
$("#searchq").html($("#ta").val());
var out = '';
$.each(data, function ( i, v ) {
out = out + '- ' + '' + v.name + '' + '
';
} );
out = out + '
';
$("#results").html(out);
}
);
}
})
%= end
% }