Commit e81cf389ae720fb63e762b8c4d9e2f4eed6f5e77

Authored by Rodrigo Souto
1 parent d3c8e3c4

[search-improvements] Pagination and filtering through ajax

Showing 1 changed file with 15 additions and 8 deletions   Show diff stats
public/javascripts/search.js
1 (function($) { 1 (function($) {
2 - //TODO Sorting  
3 - // Sorting and pagination links.  
4 - $('#search-content .pagination a').live('click',  
5 - function () {  
6 - $.getScript(this.href);  
7 - return false;  
8 - }  
9 - ); 2 + // Pagination.
  3 + $('#search-content .pagination a').live('click', function () {
  4 + $.ajax({
  5 + url: this.href,
  6 + beforeSend: function(){$('#search-content').addClass('searching')},
  7 + complete: function() {$('#search-content').removeClass('searching')},
  8 + dataType: 'script'
  9 + })
  10 + return false;
  11 + });
  12 +
  13 + // Sorting
  14 + $('#search-filters select').change(function(){
  15 + $('form.search_form').submit();
  16 + });
10 17
11 // Search form 18 // Search form
12 $('form.search_form').submit(function () { 19 $('form.search_form').submit(function () {