aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/referential_lines_controller.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-07-06 15:57:09 +0200
committerTeddy Wing2017-07-07 12:58:11 +0200
commita59bf68668a74d9be6cdc64dca5ad801c833708c (patch)
tree3bfad1a2ccb310b0ff2e5762cd44ef2d356c18cc /app/controllers/referential_lines_controller.rb
parent72c90c1b3da9b09319a435bd549ba3b5070df31a (diff)
downloadchouette-core-a59bf68668a74d9be6cdc64dca5ad801c833708c.tar.bz2
ReferentialLines#show: Use new table builder helper
Convert the table of `Route`s on this page to use the new table builder helper. This gives us the links from the `RouteDecorator` in the gear menu next to each row in the table. Ended up removing the `route_sp` field from the `RouteDecorator` context because it seems like we can just grab that collection directly from the `Route` object. At first I thought about renaming it because after coming back to this code I thought, 'what does sp mean?'. Then after some investigation, it appears that we don't need to pass it in explicitly. Now, no need to bother with that from the ReferentialLines controller. The RoutesController does create a separate `@route_sp` variable, but this only changes the sort order of the stop points, not the contents of the collection. Thus it seems safe to get them directly from the Route in the decorator. Refs #3479
Diffstat (limited to 'app/controllers/referential_lines_controller.rb')
-rw-r--r--app/controllers/referential_lines_controller.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb
index 5d36e7da7..4b4a822b4 100644
--- a/app/controllers/referential_lines_controller.rb
+++ b/app/controllers/referential_lines_controller.rb
@@ -39,6 +39,15 @@ class ReferentialLinesController < ChouetteController
@routes = @routes.paginate(page: params[:page], per_page: 10)
+ @routes = ModelDecorator.decorate(
+ @routes,
+ with: RouteDecorator,
+ context: {
+ referential: referential,
+ line: @line
+ }
+ )
+
show! do
build_breadcrumb :show
end