diff --git a/app/views/search/_search_content.html.erb b/app/views/search/_search_content.html.erb new file mode 100644 index 0000000..805feba --- /dev/null +++ b/app/views/search/_search_content.html.erb @@ -0,0 +1,6 @@ +
+<%= display_results(@searches, @asset) %> +<% if params[:display] != 'map' %> + <%= pagination_links @searches[@asset][:results] %> +<% end %> +
diff --git a/app/views/search/articles.js.erb b/app/views/search/articles.js.erb new file mode 120000 index 0000000..4f709c8 --- /dev/null +++ b/app/views/search/articles.js.erb @@ -0,0 +1 @@ +search.js.erb \ No newline at end of file diff --git a/app/views/search/communities.js.erb b/app/views/search/communities.js.erb new file mode 120000 index 0000000..4f709c8 --- /dev/null +++ b/app/views/search/communities.js.erb @@ -0,0 +1 @@ +search.js.erb \ No newline at end of file diff --git a/app/views/search/enterprises.js.erb b/app/views/search/enterprises.js.erb new file mode 120000 index 0000000..4f709c8 --- /dev/null +++ b/app/views/search/enterprises.js.erb @@ -0,0 +1 @@ +search.js.erb \ No newline at end of file diff --git a/app/views/search/people.js.erb b/app/views/search/people.js.erb new file mode 120000 index 0000000..4f709c8 --- /dev/null +++ b/app/views/search/people.js.erb @@ -0,0 +1 @@ +search.js.erb \ No newline at end of file diff --git a/app/views/search/products.js.erb b/app/views/search/products.js.erb new file mode 120000 index 0000000..4f709c8 --- /dev/null +++ b/app/views/search/products.js.erb @@ -0,0 +1 @@ +search.js.erb \ No newline at end of file diff --git a/app/views/search/search.js.erb b/app/views/search/search.js.erb new file mode 100644 index 0000000..be591f3 --- /dev/null +++ b/app/views/search/search.js.erb @@ -0,0 +1 @@ +jQuery('#search-content').html('<%= escape_javascript(render :partial => "search_content") %>'); diff --git a/app/views/search/search_page.html.erb b/app/views/search/search_page.html.erb index 2222e51..a7e0a14 100644 --- a/app/views/search/search_page.html.erb +++ b/app/views/search/search_page.html.erb @@ -3,10 +3,7 @@ <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> <%= render :partial => 'results_header' %> -<%= display_results(@searches, @asset) %> -<% if params[:display] != 'map' %> - <%= pagination_links @searches[@asset][:results] %> -<% end %> +<%= render :partial => 'search_content' %>
@@ -15,3 +12,5 @@ jQuery('.search-product-price-details').altBeautify(); <% end %> <% end %> + +<%= javascript_include_tag 'search' %> diff --git a/public/javascripts/search.js b/public/javascripts/search.js new file mode 100644 index 0000000..98191c3 --- /dev/null +++ b/public/javascripts/search.js @@ -0,0 +1,22 @@ +(function($) { + //TODO Sorting + // Sorting and pagination links. + $('#search-content .pagination a').live('click', + function () { + $.getScript(this.href); + return false; + } + ); + + // Search form + $('form.search_form').submit(function () { + $.ajax({ + url: this.action, + data: $(this).serialize(), + beforeSend: function(){$('#search-content').addClass('searching')}, + complete: function() {$('#search-content').removeClass('searching')}, + dataType: 'script' + }) + return false; + }); +})(jQuery); diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index f6b9fea..3ac49aa 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -6690,3 +6690,7 @@ li.profile-activity-item.upload_image .activity-gallery-images-count-1 img { #signup-form #result-strong { color: green; } + +#search-content.searching { + opacity: 0.3; +} -- libgit2 0.21.2