From 330501d4ad75d97d9c649880f1a932b3e5fa2077 Mon Sep 17 00:00:00 2001 From: Luc Donnet Date: Fri, 22 Aug 2014 12:47:52 +0200 Subject: Use ajax now for line index search --- app/controllers/lines_controller.rb | 1 + app/views/lines/_lines.html.erb | 9 +++++++++ app/views/lines/index.html.erb | 12 ++---------- app/views/lines/index.js.erb | 1 + 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 app/views/lines/_lines.html.erb create mode 100644 app/views/lines/index.js.erb diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index 6f717549a..3721a957d 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -4,6 +4,7 @@ class LinesController < ChouetteController respond_to :xml respond_to :json respond_to :kml, :only => :show + respond_to :js, :only => :index belongs_to :referential diff --git a/app/views/lines/_lines.html.erb b/app/views/lines/_lines.html.erb new file mode 100644 index 000000000..3bb3cd37f --- /dev/null +++ b/app/views/lines/_lines.html.erb @@ -0,0 +1,9 @@ +
+ <%= t("will_paginate.page_entries_info.search") %> <%= page_entries_info @lines %> +
+
+ <%= paginated_content(@lines) %> +
+ diff --git a/app/views/lines/index.html.erb b/app/views/lines/index.html.erb index 4eb9c29f8..34f5f1ccc 100644 --- a/app/views/lines/index.html.erb +++ b/app/views/lines/index.html.erb @@ -1,6 +1,6 @@ <%= title_tag t('lines.index.title') %> -<%= search_form_for @q, :url => referential_lines_path(@referential), :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| %> +<%= search_form_for @q, :url => referential_lines_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| %>
@@ -24,15 +24,7 @@
<% end %> -
- <%= t("will_paginate.page_entries_info.search") %> <%= page_entries_info @lines %> -
-
- <%= paginated_content(@lines) %> -
- +
<%= render 'lines' %>
<% content_for :sidebar do %>