aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/lines_controller.rb
diff options
context:
space:
mode:
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])