aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/lines_controller.rb
blob: e85c29fc99dfb18dac2b3a35dbf5a1ca1c31e88c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class LinesController < ChouetteController
  defaults :resource_class => Chouette::Line
  respond_to :html
  respond_to :xml
  respond_to :json
  respond_to :kml, :only => :show

  belongs_to :referential

  def show
    @map = LineMap.new(resource).with_helpers(self)
    @routes = @line.routes
    show!
  end

  def destroy_all
    objects =
      get_collection_ivar || set_collection_ivar(end_of_association_chain.where(:id => params[:ids]))
    objects.destroy_all
    respond_with(objects, :location => smart_collection_url)
  end

  protected

  def collection
    @q = referential.lines.search(params[:q])
    @lines ||= @q.result(:distinct => true).order(:number).paginate(:page => params[:page]).includes([:network, :company])
  end

end