diff options
| author | Teddy Wing | 2017-07-10 12:33:15 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-07-12 11:11:14 +0200 |
| commit | 09aef0d99cd86a75afe6aa81297cc7d3e7d8cae4 (patch) | |
| tree | d2f1cdad211b7836b8815745b51dfb4b87b48a1f /app | |
| parent | 2215e9696dc435940a8a40ffb45c1a11d95e3ee9 (diff) | |
| download | chouette-core-09aef0d99cd86a75afe6aa81297cc7d3e7d8cae4.tar.bz2 | |
RoutingConstraintZones#index: Use new table builder helper
Render table of `RoutingConstraintZones` using the new table builder.
Refs #3479
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/routing_constraint_zones_controller.rb | 15 | ||||
| -rw-r--r-- | app/views/routing_constraint_zones/index.html.slim | 29 |
2 files changed, 37 insertions, 7 deletions
diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb index f019b5ea9..3d0ee19ed 100644 --- a/app/controllers/routing_constraint_zones_controller.rb +++ b/app/controllers/routing_constraint_zones_controller.rb @@ -10,6 +10,21 @@ class RoutingConstraintZonesController < ChouetteController belongs_to :line, parent_class: Chouette::Line end + def index + index! do |format| + @routing_constraint_zones = ModelDecorator.decorate( + @routing_constraint_zones, + with: RoutingConstraintZoneDecorator, + context: { + referential: referential, + line: parent + } + ) + + build_breadcrumb :index + end + end + def show show! do |format| @routing_constraint_zone = @routing_constraint_zone.decorate(context: { diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim index 596ea9e91..6b3e73096 100644 --- a/app/views/routing_constraint_zones/index.html.slim +++ b/app/views/routing_constraint_zones/index.html.slim @@ -16,13 +16,28 @@ - if @routing_constraint_zones.any? .row .col-lg-12 - = table_builder @routing_constraint_zones, - { 'ID' => Proc.new { |n| n.try(:objectid).try(:local_id) }, - :name => 'name', :stop_points_count => 'stop_points_count', - :route => 'route_name' }, - [:show, :edit, :delete], - [], - 'table has-filter has-search' + = table_builder_2 @routing_constraint_zones, + [ \ + TableBuilderHelper::Column.new( \ + name: 'ID', \ + attribute: Proc.new { |n| n.try(:objectid).try(:local_id) }, \ + sortable: false \ + ), \ + TableBuilderHelper::Column.new( \ + key: :name, \ + attribute: 'name' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :stop_points_count, \ + attribute: 'stop_points_count' \ + ), \ + TableBuilderHelper::Column.new( \ + key: :route, \ + attribute: 'route_name' \ + ), \ + ], + links: [:show], + cls: 'table has-filter has-search' - unless @routing_constraint_zones.any? .row.mt-xs |
