diff options
| author | cedricnjanga | 2017-11-22 00:45:48 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-22 00:45:48 +0100 |
| commit | 510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9 (patch) | |
| tree | 1b3a162722389df4f6b2e444d03e91131032f0d5 /app/controllers/route_sections_controller.rb | |
| parent | be2bd2e4f902ef12a21425ebe7dcf5699768762a (diff) | |
| parent | 96afaed78fa043449c0264ea09f0106147755c8e (diff) | |
| download | chouette-core-510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9.tar.bz2 | |
Merge branch 'master' into 4941-refactoring_object_id
Diffstat (limited to 'app/controllers/route_sections_controller.rb')
| -rw-r--r-- | app/controllers/route_sections_controller.rb | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/app/controllers/route_sections_controller.rb b/app/controllers/route_sections_controller.rb deleted file mode 100644 index 03d6cf176..000000000 --- a/app/controllers/route_sections_controller.rb +++ /dev/null @@ -1,70 +0,0 @@ -class RouteSectionsController < ChouetteController - - defaults :resource_class => Chouette::RouteSection - - respond_to :html - respond_to :kml, :only => :show - - belongs_to :referential - - before_action :save_return_to_path, only: [:edit, :create_to_edit] - - helper_method :search - - def new - @stop_areas = referential.stop_areas.with_geometry.order :name - new! - end - - def show - @map = RouteSectionMap.new(resource).with_helpers(self) - show! - end - - def edit - @map = RouteSectionMap.new(resource, true).with_helpers(self) - edit! - end - - def update - update! { session.delete(:return_to) } - end - - def create - create! { session.delete(:return_to) } - end - - def create_to_edit - route_section = Chouette::RouteSection.create(route_section_params) - if route_section.id - redirect_to edit_referential_route_section_path(referential, route_section) - else - flash[:alert] = I18n.t('route_sections.unable_to_contact_server') - redirect_to :back - end - end - - protected - - def save_return_to_path - session[:return_to] = params[:return_to] if params[:return_to] - end - - def collection - # if q = params[:q] - # @route_sections ||= Chouette::RouteSection.joins(:departure, :arrival).where(departure: {name: "#{q}"}).or.where(arrival: {name: "#{q}"}) - # end - @route_sections ||= search.collection.includes(:departure, :arrival).paginate page: params[:page] - end - - def search - @search ||= RouteSectionSearch.new(params[:route_section_search]) - end - - private - - def route_section_params - params.require(:route_section).permit(:departure_id, :arrival_id, :editable_geometry, :no_processing) - end - -end |
