aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/lines_controller.rb
diff options
context:
space:
mode:
authorLuc Donnet2012-10-11 09:39:25 +0200
committerLuc Donnet2012-10-11 09:39:25 +0200
commit0f61b9f0de549290b9ebf4f5cc2d00b63c2fd02e (patch)
treef2955e539117ecaa10331994fd42f0345e17fbf7 /app/controllers/lines_controller.rb
parent09419f7fbe6be35abba2b638431e41480e8cf764 (diff)
parent8b8c8f3ec124e6327e535c13a4045c1d62859d52 (diff)
downloadchouette-core-0f61b9f0de549290b9ebf4f5cc2d00b63c2fd02e.tar.bz2
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
Diffstat (limited to 'app/controllers/lines_controller.rb')
-rw-r--r--app/controllers/lines_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index e85c29fc9..c8655908d 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -10,6 +10,7 @@ class LinesController < ChouetteController
def show
@map = LineMap.new(resource).with_helpers(self)
@routes = @line.routes
+ @group_of_lines = @line.group_of_lines
show!
end
@@ -20,8 +21,25 @@ class LinesController < ChouetteController
respond_with(objects, :location => smart_collection_url)
end
+ def name_filter
+ respond_to do |format|
+ format.json { render :json => filtered_lines_maps}
+ end
+
+ end
+
protected
+ def filtered_lines_maps
+ filtered_lines.collect do |line|
+ { :id => line.id, :name => line.published_name }
+ end
+ end
+
+ def filtered_lines
+ referential.lines.select{ |t| t.published_name =~ /#{params[:q]}/i }
+ end
+
def collection
@q = referential.lines.search(params[:q])
@lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company])