@@ -296,7 +296,7 @@ my %routeParameters = (
296
296
logout options instructor_tools problem_list)
297
297
],
298
298
module => ' ProblemSets' ,
299
- path => ' /#courseID'
299
+ path => { ' /#courseID' => [ courseID => qr / [ \w -]* / ] }
300
300
},
301
301
302
302
logout => {
@@ -429,7 +429,7 @@ my %routeParameters = (
429
429
instructor_problem_grader => {
430
430
title => x(' Manual Grader' ),
431
431
module => ' Instructor::ProblemGrader' ,
432
- path => ' /grader/#setID/# problemID'
432
+ path => ' /grader/#setID/< problemID:num> '
433
433
},
434
434
instructor_add_users => {
435
435
title => x(' Add Users' ),
@@ -471,7 +471,7 @@ my %routeParameters = (
471
471
instructor_problem_editor_withset_withproblem => {
472
472
title => ' [_3]' ,
473
473
module => ' Instructor::PGProblemEditor' ,
474
- path => ' /# problemID'
474
+ path => ' /< problemID:num> '
475
475
},
476
476
instructor_scoring => {
477
477
title => x(' Scoring Tools' ),
@@ -503,7 +503,7 @@ my %routeParameters = (
503
503
instructor_problem_statistics => {
504
504
title => ' [_3]' ,
505
505
module => ' Instructor::Stats' ,
506
- path => ' /# problemID'
506
+ path => ' /< problemID:num> '
507
507
},
508
508
instructor_user_statistics => {
509
509
title => ' [_1]' ,
@@ -570,7 +570,7 @@ my %routeParameters = (
570
570
title => ' [_3]' ,
571
571
children => [qw( show_me_another) ],
572
572
module => ' Problem' ,
573
- path => ' /# problemID' ,
573
+ path => ' /< problemID:num> ' ,
574
574
unrestricted => 1
575
575
},
576
576
show_me_another => {
@@ -617,15 +617,22 @@ sub setup_content_generator_routes_recursive {
617
617
my $action = $routeParameters {$child }{action } // ' go' ;
618
618
619
619
if ($routeParameters {$child }{children }) {
620
- my $child_route = $route -> under($routeParameters {$child }{path }, [ problemID => qr /\d +/ ])-> name($child );
620
+ my $child_route = $route -> under(
621
+ ref ($routeParameters {$child }{path }) eq ' HASH'
622
+ ? %{ $routeParameters {$child }{path } }
623
+ : $routeParameters {$child }{path })-> name($child );
621
624
$child_route -> any($routeParameters {$child }{methods } // (), ' /' )-> to(" $routeParameters {$child }{module}#$action " )
622
625
-> name($child );
623
626
for (@{ $routeParameters {$child }{children } }) {
624
627
setup_content_generator_routes_recursive($child_route , $_ );
625
628
}
626
629
} else {
627
- $route -> any($routeParameters {$child }{methods } // (), $routeParameters {$child }{path }, [ problemID => qr /\d +/ ])
628
- -> to(" $routeParameters {$child }{module}#$action " )-> name($child );
630
+ $route -> any(
631
+ $routeParameters {$child }{methods } // (),
632
+ ref ($routeParameters {$child }{path }) eq ' HASH'
633
+ ? %{ $routeParameters {$child }{path } }
634
+ : $routeParameters {$child }{path }
635
+ )-> to(" $routeParameters {$child }{module}#$action " )-> name($child );
629
636
}
630
637
631
638
return ;
0 commit comments