diff options
| author | Xinhui | 2016-12-08 12:28:35 +0100 | 
|---|---|---|
| committer | Xinhui | 2016-12-08 12:28:35 +0100 | 
| commit | 9b37986ef2f7c10e26fec5c7ce1297e071f53aa4 (patch) | |
| tree | 21c1997d998dc189f90ab945dfe8d4765a4a0ce2 /app | |
| parent | 2011d02e79659c17eebcd5f38e75a1afa34352ee (diff) | |
| download | chouette-core-9b37986ef2f7c10e26fec5c7ce1297e071f53aa4.tar.bz2 | |
Journey patterns collection controller
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/journey_patterns_collections_controller.rb | 25 | ||||
| -rw-r--r-- | app/controllers/journey_patterns_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/journey_patterns/index.rabl | 4 | ||||
| -rw-r--r-- | app/views/journey_patterns/show.rabl | 20 | ||||
| -rw-r--r-- | app/views/journey_patterns_collections/show.html.slim | 1 | ||||
| -rw-r--r-- | app/views/journey_patterns_collections/show.rabl | 3 | 
6 files changed, 29 insertions, 29 deletions
| diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb new file mode 100644 index 000000000..c4dc92584 --- /dev/null +++ b/app/controllers/journey_patterns_collections_controller.rb @@ -0,0 +1,25 @@ +class JourneyPatternsCollectionsController < ChouetteController +  defaults :resource_class => Chouette::JourneyPattern + +  respond_to :html +  respond_to :json + +  belongs_to :referential do +    belongs_to :line, :parent_class => Chouette::Line do +      belongs_to :route, :parent_class => Chouette::Route +    end +  end +  alias_method :route, :parent + +  def show +    @q = route.journey_patterns.search(params[:q]) +    @journey_patterns ||= @q.result(:distinct => true).order(:name) +  end + +  def update +    ap "-----Call to #{params[:action]} from #{params[:controller]}" +    ap '------------------------------------------------------------' +    ap params +    ap '------------------------------------------------------------' +  end +end diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb index 1e2d2f191..326c5397a 100644 --- a/app/controllers/journey_patterns_controller.rb +++ b/app/controllers/journey_patterns_controller.rb @@ -19,11 +19,6 @@ class JourneyPatternsController < ChouetteController      object.special_update    end -  def bulk_update -    ap "--------call to bulk_update action ------------" -    ap params -  end -    def show      @map = JourneyPatternMap.new(journey_pattern).with_helpers(self)      @stop_points = journey_pattern.stop_points.paginate(:page => params[:page]) diff --git a/app/views/journey_patterns/index.rabl b/app/views/journey_patterns/index.rabl deleted file mode 100644 index fc4175e2b..000000000 --- a/app/views/journey_patterns/index.rabl +++ /dev/null @@ -1,4 +0,0 @@ -collection @journey_patterns - -extends "journey_patterns/show" - diff --git a/app/views/journey_patterns/show.rabl b/app/views/journey_patterns/show.rabl deleted file mode 100644 index b1eaf2376..000000000 --- a/app/views/journey_patterns/show.rabl +++ /dev/null @@ -1,20 +0,0 @@ -object @journey_pattern -extends "api/v1/trident_objects/show" - -[:name, :published_name, :registration_number, :comment].each do |attr| -  attributes attr, :unless => lambda { |m| m.send( attr).nil?} -end - -node(:route_short_description) do |journey_pattern| -  partial("api/v1/routes/short_description", :object => journey_pattern.route) -end - -node(:vehicle_journey_object_ids) do |journey_pattern| -  journey_pattern.vehicle_journeys.map(&:objectid) -end unless root_object.vehicle_journeys.empty? - -child :stop_points => :stop_area_short_descriptions do |stop_points| -  node do |stop_point| -    partial("api/v1/stop_areas/short_description", :object => stop_point.stop_area) -  end -end unless root_object.stop_points.empty? diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim new file mode 100644 index 000000000..2c4a38bd6 --- /dev/null +++ b/app/views/journey_patterns_collections/show.html.slim @@ -0,0 +1 @@ += javascript_include_tag 'es6_browserified/journey_patterns/index.js' diff --git a/app/views/journey_patterns_collections/show.rabl b/app/views/journey_patterns_collections/show.rabl new file mode 100644 index 000000000..c241a9c0e --- /dev/null +++ b/app/views/journey_patterns_collections/show.rabl @@ -0,0 +1,3 @@ +collection @journey_patterns +extends "api/v1/journey_patterns/show" + | 
