@@ -53,37 +53,37 @@ def render_page(page)
5353 render ( inline : page . call )
5454 end
5555
56- def root_route ( router )
56+ def root_route ( req )
5757 if TinyAdmin . settings . root [ :redirect ]
58- router . redirect route_for ( TinyAdmin . settings . root [ :redirect ] )
58+ req . redirect route_for ( TinyAdmin . settings . root [ :redirect ] )
5959 else
6060 page_class = to_class ( TinyAdmin . settings . root [ :page ] )
6161 attributes = TinyAdmin . settings . root . slice ( :content , :title , :widgets )
6262 render_page prepare_page ( page_class , attributes : attributes , params : request . params )
6363 end
6464 end
6565
66- def setup_page_route ( router , slug , page_data )
67- router . get slug do
66+ def setup_page_route ( req , slug , page_data )
67+ req . get slug do
6868 attributes = page_data . slice ( :content , :title , :widgets )
6969 render_page prepare_page ( page_data [ :class ] , slug : slug , attributes : attributes , params : request . params )
7070 end
7171 end
7272
73- def setup_resource_routes ( router , slug , options :)
74- router . on slug do
75- setup_collection_routes ( router , slug , options : options )
76- setup_member_routes ( router , slug , options : options )
73+ def setup_resource_routes ( req , slug , options :)
74+ req . on slug do
75+ setup_collection_routes ( req , slug , options : options )
76+ setup_member_routes ( req , slug , options : options )
7777 end
7878 end
7979
80- def setup_collection_routes ( router , slug , options :)
80+ def setup_collection_routes ( req , slug , options :)
8181 repository = options [ :repository ] . new ( options [ :model ] )
8282 action_options = options [ :index ] || { }
8383
8484 # Custom actions
8585 custom_actions = setup_custom_actions (
86- router ,
86+ req ,
8787 options [ :collection_actions ] ,
8888 options : action_options ,
8989 repository : repository ,
@@ -92,12 +92,12 @@ def setup_collection_routes(router, slug, options:)
9292
9393 # Index
9494 if options [ :only ] . include? ( :index ) || options [ :only ] . include? ( 'index' )
95- router . is do
95+ req . is do
9696 context = Context . new (
9797 actions : custom_actions ,
9898 repository : repository ,
9999 request : request ,
100- router : router ,
100+ router : req ,
101101 slug : slug
102102 )
103103 index_action = TinyAdmin ::Actions ::Index . new
@@ -106,14 +106,14 @@ def setup_collection_routes(router, slug, options:)
106106 end
107107 end
108108
109- def setup_member_routes ( router , slug , options :)
109+ def setup_member_routes ( req , slug , options :)
110110 repository = options [ :repository ] . new ( options [ :model ] )
111111 action_options = ( options [ :show ] || { } ) . merge ( record_not_found_page : TinyAdmin . settings . record_not_found )
112112
113- router . on String do |reference |
113+ req . on String do |reference |
114114 # Custom actions
115115 custom_actions = setup_custom_actions (
116- router ,
116+ req ,
117117 options [ :member_actions ] ,
118118 options : action_options ,
119119 repository : repository ,
@@ -123,13 +123,13 @@ def setup_member_routes(router, slug, options:)
123123
124124 # Show
125125 if options [ :only ] . include? ( :show ) || options [ :only ] . include? ( 'show' )
126- router . is do
126+ req . is do
127127 context = Context . new (
128128 actions : custom_actions ,
129129 reference : reference ,
130130 repository : repository ,
131131 request : request ,
132- router : router ,
132+ router : req ,
133133 slug : slug
134134 )
135135 show_action = TinyAdmin ::Actions ::Show . new
@@ -139,18 +139,18 @@ def setup_member_routes(router, slug, options:)
139139 end
140140 end
141141
142- def setup_custom_actions ( router , custom_actions , options :, repository :, slug :, reference : nil )
142+ def setup_custom_actions ( req , custom_actions = nil , options :, repository :, slug :, reference : nil )
143143 ( custom_actions || [ ] ) . each_with_object ( { } ) do |custom_action , result |
144144 action_slug , action = custom_action . first
145145 action_class = to_class ( action )
146146
147- router . get action_slug . to_s do
147+ req . get action_slug . to_s do
148148 context = Context . new (
149149 actions : { } ,
150150 reference : reference ,
151151 repository : repository ,
152152 request : request ,
153- router : router ,
153+ router : req ,
154154 slug : slug
155155 )
156156 custom_action = action_class . new
0 commit comments