aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/time_tables_controller.rb
diff options
context:
space:
mode:
authorMarc Florisson2012-06-13 16:07:30 +0200
committerMarc Florisson2012-06-13 16:07:30 +0200
commitcbd9618b0a9d4ea7f2b0733c134d1c85010f0a2f (patch)
tree88413299c9fe5573ace27a25c3cb60a4d7b99892 /app/controllers/time_tables_controller.rb
parentbfcaec8ebed6cc7cfeb1ab64a48d9182a5c3e567 (diff)
downloadchouette-core-cbd9618b0a9d4ea7f2b0733c134d1c85010f0a2f.tar.bz2
add views for vehicle_journeys
Diffstat (limited to 'app/controllers/time_tables_controller.rb')
-rw-r--r--app/controllers/time_tables_controller.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index dbecde0eb..b860d2948 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -6,8 +6,24 @@ class TimeTablesController < ChouetteController
belongs_to :referential
+ def comment_filter
+ respond_to do |format|
+ format.json { render :json => filtered_time_tables_maps}
+ end
+
+ end
+
protected
+ def filtered_time_tables_maps
+ filtered_time_tables.collect do |time_table|
+ { :id => time_table.id.to_s, :name => time_table.comment }
+ end
+ end
+ def filtered_time_tables
+ referential.time_tables.select{ |t| t.comment =~ /#{params[:q]}/i }
+ end
+
def collection
@q = referential.time_tables.search(params[:q])
@time_tables ||= @q.result(:distinct => true).order(:comment).paginate(:page => params[:page], :per_page => 10)