diff options
| author | Luc Donnet | 2017-07-03 15:13:08 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-07-03 15:13:08 +0200 |
| commit | 34775f5157902a30d1bbbb18991a1872b59fde3b (patch) | |
| tree | cbd14a9e0e721f9ec70d682cad624b8107d0ab32 /app/controllers | |
| parent | 1adc021ba4d797152a6f31cfe17161ef20877fb7 (diff) | |
| download | chouette-core-34775f5157902a30d1bbbb18991a1872b59fde3b.tar.bz2 | |
Fix routing constraint zones edit and new Refs #3953
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/routing_constraint_zones_controller.rb | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index 6fb5348f0..1eb2ddf28 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -4,14 +4,33 @@ class RoutingConstraintZonesController < ChouetteController defaults resource_class: Chouette::RoutingConstraintZone respond_to :html, :xml, :json - before_action :check_stoppoint_param, only: [:create, :update] + # before_action :check_stoppoint_param, only: [:create, :update] belongs_to :referential do belongs_to :line, parent_class: Chouette::Line end + def show + show! do |format| + @routing_constraint_zone = @routing_constraint_zone.decorate(context: { + referential: current_referential, + line: parent.id + }) + end + end + + def new + new! do |format| + format.html + @route = @line.routes.find params[:route_id] if params[:route_id] + format.js + end + end + protected + alias_method :routing_constraint_zone, :resource + def collection @q = current_referential.routing_constraint_zones.search(params[:q]) @@ -25,26 +44,6 @@ class RoutingConstraintZonesController < ChouetteController end end - def resource - @routing_constraint_zone ||= begin - routing_constraint_zone = current_referential.routing_constraint_zones.find(params[:id]) - routing_constraint_zone = routing_constraint_zone.decorate(context: { - referential: current_referential, - line: parent.id - }) - end - end - - def build_resource - @routing_constraint_zone ||= begin - routing_constraint_zone = current_referential.routing_constraint_zones.new - routing_constraint_zone = routing_constraint_zone.decorate(context: { - referential: current_referential, - line: parent.id - }) - end - end - private def sort_column (Chouette::RoutingConstraintZone.column_names).include?(params[:sort]) ? params[:sort] : 'name' |
