diff options
| author | Zog | 2018-05-29 10:18:16 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-05-30 16:29:33 +0200 | 
| commit | 3e8d95ac8168205ac9526fb8663459d691d09c30 (patch) | |
| tree | fd2bc220473f4defe30a35668d6b9eead76f00fa /app/controllers | |
| parent | 971b267958c3bf78abea332e0af4c46a23679b61 (diff) | |
| download | chouette-core-3e8d95ac8168205ac9526fb8663459d691d09c30.tar.bz2 | |
Refs #6433; Fix specs
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/api/v1/connection_links_controller.rb | 12 | ||||
| -rw-r--r-- | app/controllers/autocomplete_timebands_controller.rb | 23 | ||||
| -rw-r--r-- | app/controllers/connection_link_areas_controller.rb | 28 | ||||
| -rw-r--r-- | app/controllers/connection_links_controller.rb | 59 | ||||
| -rw-r--r-- | app/controllers/referential_stop_areas_controller.rb | 1 | ||||
| -rw-r--r-- | app/controllers/timebands_controller.rb | 14 | ||||
| -rw-r--r-- | app/controllers/vehicle_journey_frequencies_controller.rb | 26 | 
7 files changed, 0 insertions, 163 deletions
| diff --git a/app/controllers/api/v1/connection_links_controller.rb b/app/controllers/api/v1/connection_links_controller.rb deleted file mode 100644 index c5cf39812..000000000 --- a/app/controllers/api/v1/connection_links_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Api::V1::ConnectionLinksController < Api::V1::ChouetteController - -  defaults :resource_class => Chouette::ConnectionLink, :finder => :find_by_objectid! - -protected - -  def collection -    @connection_links ||= ( @referential ? @referential.connection_links.search(params[:q]).result(:distinct => true) : []) -  end  - -end - diff --git a/app/controllers/autocomplete_timebands_controller.rb b/app/controllers/autocomplete_timebands_controller.rb deleted file mode 100644 index af041c33e..000000000 --- a/app/controllers/autocomplete_timebands_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AutocompleteTimebandsController < ChouetteController -  respond_to :json, :only => [:index] - -  include ReferentialSupport - -  protected - -  def select_timebands -    if params[:route_id] -      referential.timebands.joins( vehicle_journeys: :route).where( "routes.id IN (#{params[:route_id]})") -    else -      referential.timebands -    end -  end - -  def referential_timebands -    @referential_timebands ||= select_timebands -  end - -  def collection -    @timebands = referential_timebands.select{ |p| p.fullname =~ /#{params[:q]}/i  } -  end -end diff --git a/app/controllers/connection_link_areas_controller.rb b/app/controllers/connection_link_areas_controller.rb deleted file mode 100644 index 981a7639e..000000000 --- a/app/controllers/connection_link_areas_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class ConnectionLinkAreasController < ChouetteController -  include ReferentialSupport - -  respond_to :json, :only => :index - -  def index -    respond_to do |format| -      format.json { render :json => areas_maps } -    end -  end - -  def areas_maps -    areas.collect do |area| -      { :id => area.id.to_s, -        :name => area.name, -        :country_code =>  area.country_code, -        :zip_code => area.zip_code || "", -        :city_name => area.city_name || "", -        :area_type => t("area_types.label.#{area.area_type.underscore}") -      } -    end -  end - -  def areas -    referential.connection_links.find(params[:connection_link_id]).possible_areas.select{ |p| p.name =~ /#{params[:q]}/i  } -  end - -end diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb deleted file mode 100644 index a7f9758e8..000000000 --- a/app/controllers/connection_links_controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -class ConnectionLinksController < ChouetteController -  include ReferentialSupport -  defaults :resource_class => Chouette::ConnectionLink - -  belongs_to :referential do -    belongs_to :departure, :parent_class => Chouette::StopArea, :optional => true -    belongs_to :arrival, :parent_class => Chouette::StopArea, :optional => true -  end - -  respond_to :html, :xml, :json -  respond_to :kml, :only => :show -  respond_to :js, :only => :index - -  include PolicyChecker - -  def index -    index! do |format| -      format.html { -        if collection.out_of_bounds? -          redirect_to params.merge(:page => 1) -        end -      } -    end -  end - -  def show -    show! -  end - -  def select_areas -    @connection_link = connection_link -    @departure = connection_link.departure -    @arrival = connection_link.arrival -  end - -  protected - -  alias_method :connection_link, :resource - -  def collection -    @q = referential.connection_links.search(params[:q]) -    @connection_links ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page]) -  end - -  def resource_url(connection_link = nil) -    referential_connection_link_path(referential, connection_link || resource) -  end - -  def collection_url -    referential_connection_links_path(referential) -  end - -  private - -  def connection_link_params -    params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs ) -  end - -end diff --git a/app/controllers/referential_stop_areas_controller.rb b/app/controllers/referential_stop_areas_controller.rb index fa09bb773..a5fd15fcb 100644 --- a/app/controllers/referential_stop_areas_controller.rb +++ b/app/controllers/referential_stop_areas_controller.rb @@ -6,7 +6,6 @@ class ReferentialStopAreasController  < ChouetteController    belongs_to :referential do      belongs_to :line, :parent_class => Chouette::Line, :optional => true, :polymorphic => true      belongs_to :network, :parent_class => Chouette::Network, :optional => true, :polymorphic => true -    belongs_to :connection_link, :parent_class => Chouette::ConnectionLink, :optional => true, :polymorphic => true    end    respond_to :html, :kml, :xml, :json diff --git a/app/controllers/timebands_controller.rb b/app/controllers/timebands_controller.rb deleted file mode 100644 index 937283b0e..000000000 --- a/app/controllers/timebands_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -class TimebandsController < ChouetteController -  include ReferentialSupport - -  defaults :resource_class => Chouette::Timeband - -  respond_to :html - -  belongs_to :referential - -  private -  def timeband_params -    params.require(:timeband).permit( :name, :start_time, :end_time ) -  end -end diff --git a/app/controllers/vehicle_journey_frequencies_controller.rb b/app/controllers/vehicle_journey_frequencies_controller.rb deleted file mode 100644 index 6e12c0247..000000000 --- a/app/controllers/vehicle_journey_frequencies_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -class VehicleJourneyFrequenciesController < VehicleJourneysController - -  defaults resource_class: Chouette::VehicleJourneyFrequency - -  def new -    new! do -      vehicle_journey.journey_frequencies.build -    end -  end - -  private - -  def vehicle_journey_frequency_params -    params.require(:vehicle_journey_frequency).permit( { footnote_ids: [] } , :journey_pattern_id, :number, :published_journey_name, -                                             :published_journey_identifier, :comment, :transport_mode, -                                             :mobility_restricted_suitability, :flexible_service, -                                             :facility, :vehicle_type_identifier, :objectid, :time_table_tokens, -                                             { date: [ :hour, :minute ] }, :button, :referential_id, :line_id, -                                             :route_id, :id, { vehicle_journey_at_stops_attributes: [ :arrival_time, -                                                                                                      :id, :_destroy, -                                                                                                      :stop_point_id, -                                                                                                      :departure_time] }, -                                             { journey_frequencies_attributes: [ :id, :_destroy, :scheduled_headway_interval, :first_departure_time, -                                                                                 :last_departure_time, :exact_time, :timeband_id ] } ) -  end -end | 
