Showing 2 changed files with 9 additions and 9 deletions
+3 -9
lib/Gitprep.pm
... ...
@@ -9,6 +9,7 @@ use Gitprep::Git;
9 9
 use Gitprep::Manager;
10 10
 use Scalar::Util 'weaken';
11 11
 use Validator::Custom;
12
+use Mojolicious::Plugin::AutoRoute::Util 'template';
12 13
 
13 14
 # Digest::SHA loading to Mojo::Util if not loaded
14 15
 {
... ...
@@ -145,13 +146,6 @@ sub startup {
145 146
   # Basic auth plugin
146 147
   $self->plugin('BasicAuth');
147 148
 
148
-  # Routes
149
-  sub template {
150
-    my $template = shift;
151
-    
152
-    return sub { shift->render($template, , 'mojo.maybe' => 1) };
153
-  }
154
-  
155 149
   {
156 150
     my $r = $self->routes;
157 151
 
... ...
@@ -188,14 +182,14 @@ sub startup {
188 182
       
189 183
       # Auto routes
190 184
       $self->plugin('AutoRoute', route => $r);
191
-
185
+      
192 186
       # Custom routes
193 187
       {
194 188
         # User
195 189
         my $r = $r->route('/:user');
196 190
         {
197 191
           # Home
198
-          $r->get('/' => template '/user');
192
+          $r->get('/' => [format => 0] => template '/user');
199 193
           
200 194
           # Settings
201 195
           $r->get('/_settings' => template '/user-settings');
+6
xt/user.t
... ...
@@ -314,6 +314,12 @@ note 'Profile';
314 314
     ok(-f "$rep_home/kimoto1/t1.git/git-daemon-export-ok");
315 315
     ok(-f "$rep_home/kimoto1/t1.git/hooks/post-update");
316 316
 
317
+    # Create repository(first character is .)
318
+    $t->post_ok('/_new?op=create', form => {project => '.dot', description => 'Dot'});
319
+    $t->content_like(qr/Create a new repository on the command line/);
320
+    $t->content_like(qr/\.dot\.git/);
321
+    $t->content_like(qr/Dot/);
322
+
317 323
     # Create repository(with readme)
318 324
     $t->post_ok('/_new?op=create', form => {project => 't2', description => 'Hello', readme => 1});
319 325
     $t->content_like(qr/first commit/);