Commit 5293de9484ebcbd06058898114463efb0b75760d
1 parent
35b00cd4
Exists in
master
and in
29 other branches
[search-improvements] Realize search through ajax and update only results
Missing update through ajax on sorting
Showing
10 changed files
with
41 additions
and
4 deletions
Show diff stats
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +jQuery('#search-content').html('<%= escape_javascript(render :partial => "search_content") %>'); |
app/views/search/search_page.html.erb
@@ -3,10 +3,7 @@ | @@ -3,10 +3,7 @@ | ||
3 | <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> | 3 | <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> |
4 | <%= render :partial => 'results_header' %> | 4 | <%= render :partial => 'results_header' %> |
5 | 5 | ||
6 | -<%= display_results(@searches, @asset) %> | ||
7 | -<% if params[:display] != 'map' %> | ||
8 | - <%= pagination_links @searches[@asset][:results] %> | ||
9 | -<% end %> | 6 | +<%= render :partial => 'search_content' %> |
10 | 7 | ||
11 | <div style="clear: both"></div> | 8 | <div style="clear: both"></div> |
12 | 9 | ||
@@ -15,3 +12,5 @@ | @@ -15,3 +12,5 @@ | ||
15 | jQuery('.search-product-price-details').altBeautify(); | 12 | jQuery('.search-product-price-details').altBeautify(); |
16 | <% end %> | 13 | <% end %> |
17 | <% end %> | 14 | <% end %> |
15 | + | ||
16 | +<%= javascript_include_tag 'search' %> |
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
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 | + ); | ||
10 | + | ||
11 | + // Search form | ||
12 | + $('form.search_form').submit(function () { | ||
13 | + $.ajax({ | ||
14 | + url: this.action, | ||
15 | + data: $(this).serialize(), | ||
16 | + beforeSend: function(){$('#search-content').addClass('searching')}, | ||
17 | + complete: function() {$('#search-content').removeClass('searching')}, | ||
18 | + dataType: 'script' | ||
19 | + }) | ||
20 | + return false; | ||
21 | + }); | ||
22 | +})(jQuery); |
public/stylesheets/application.css
@@ -6690,3 +6690,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { | @@ -6690,3 +6690,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { | ||
6690 | #signup-form #result-strong { | 6690 | #signup-form #result-strong { |
6691 | color: green; | 6691 | color: green; |
6692 | } | 6692 | } |
6693 | + | ||
6694 | +#search-content.searching { | ||
6695 | + opacity: 0.3; | ||
6696 | +} |