<% end %>
</ul>
</div>
- <div id="searchResourcesResults" class="autocomplete" style="display:none"></div>
+ <div id="searchResourcesResults" class="autocomplete" style="display:none"
+ data-results="<%= message('search.results') -%>"
+ data-no-results="<%= message('no_results') -%>"></div>
</div>
<%= render 'layouts/breadcrumb' if @breadcrumbs || selected_section==Navigation::SECTION_RESOURCE -%>
<div id="body">
});
});
+ resultsEl.append('<div class="autocompleteNote">' + r.total + ' ' + resultsEl.data('results') + '</div>');
+
resultsEl.show();
- items = resultsEl.find('li');
- index = -1;
- total = items.length;
- selectNext();
-
- items
- .on('mouseover', function() {
- index = items.index($(this));
- select();
- })
- .on('click', function() {
- index = items.index($(this));
- select();
- choose();
- });
+
+ if (r.total === 0) {
+ ul.append('<li>' + resultsEl.data('no-results') + '</li>');
+ } else {
+ items = resultsEl.find('li');
+ index = -1;
+ total = items.length;
+ selectNext();
+
+ items
+ .on('mouseover', function() {
+ index = items.index($(this));
+ select();
+ })
+ .on('click', function() {
+ index = items.index($(this));
+ select();
+ choose();
+ });
+ }
},
hide = function() {