Skip to content

Commit

Permalink
added list of routes to not_found template
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 16, 2012
1 parent fee3680 commit fdd009d
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 149 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.44 2012-01-16 00:00:00
2.44 2012-01-17 00:00:00
- Added new not_found page for development mode.
- Added EXPERIMENTAL url_with helper to
Mojolicious::Plugin::DefaultHelpers. (diegok, marcus, judofyr, sri)
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -88,7 +88,7 @@ sub startup {
my $r = $self->routes;
# Normal route to controller
$r->route('/welcome')->to('example#welcome');
$r->route('/')->to('example#welcome');
}
1;
Expand Down Expand Up @@ -118,7 +118,7 @@ sub welcome {
<body>
<h2>Welcome to the Mojolicious real-time web framework!</h2>
This is the static document "public/index.html",
<a href="/welcome">click here</a> to get back to the start.
<a href="/">click here</a> to get back to the start.
</body>
</html>
Expand All @@ -132,7 +132,7 @@ use Test::Mojo;
use_ok '<%= $class %>';
my $t = Test::Mojo->new('<%= $class %>');
$t->get_ok('/welcome')->status_is(200)->content_like(qr/Mojolicious/i);
$t->get_ok('/')->status_is(200)->content_like(qr/Mojolicious/i);
@@ layout
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/generate/lite_app.pm
Expand Up @@ -24,7 +24,7 @@ use Mojolicious::Lite;
# Documentation browser under "/perldoc"
plugin 'PODRenderer';
get '/welcome' => sub {
get '/' => sub {
my $self = shift;
$self->render('index');
};
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -628,7 +628,7 @@ templates.
@@ not_found.production.html.ep
<!DOCTYPE html>
<html>
<head><title>Page Not Found</title></head>
<head><title>Page not found</title></head>
<body>Page does not seem to exist.</body>
</html>

Expand Down
231 changes: 122 additions & 109 deletions lib/Mojolicious/templates/exception.development.html.ep
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Server Error</title>
<title>Server error</title>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
%= javascript '/js/jquery.js'
Expand All @@ -14,9 +14,9 @@
background-color: #f5f6f8;
color: #445555;
font: 0.9em 'Helvetica Neue', 'Helvetica', sans-serif;
margin-left: 3em;
margin-right: 3em;
margin-top: 0;
font-weight: normal;
line-height: 1.5;
margin: 0;
}
pre {
margin: 0;
Expand Down Expand Up @@ -66,11 +66,12 @@
width: 100%;
}
#showcase {
margin-top: 1em;
-moz-border-radius-topleft: 5px;
border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
border-top-right-radius: 5px;
margin-left: 5em;
margin-right: 5em;
}
#showcase > pre {
font: 1.5em 'Helvetica Neue', 'Helvetica', sans-serif;
Expand All @@ -83,136 +84,148 @@
border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
border-bottom-right-radius: 5px;
margin-left: 5em;
margin-right: 5em;
}
#more .tap, #trace .tap { text-shadow: #ddd 0 1px 0 }
#request {
-moz-border-radius-topleft: 5px;
border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
border-top-right-radius: 5px;
margin-left: 5em;
margin-right: 5em;
margin-top: 1em;
}
#wrapperlicious {
max-width: 1000px;
margin: 0 auto;
padding-top: 90px;
}
% end
</head>
<body onload="prettyPrint()">
% my $cv = begin
% my ($key, $value, $i) = @_;
%= tag 'tr', $i ? (class => 'important') : undef, begin
<td class="key"><%= $key %>.</td>
<td class="value">
<pre class="prettyprint"><%= $value %></pre>
</td>
%= include inline => $Mojolicious::Controller::MOJOBAR
<div id="wrapperlicious">
% my $cv = begin
% my ($key, $value, $i) = @_;
%= tag 'tr', $i ? (class => 'important') : undef, begin
<td class="key"><%= $key %>.</td>
<td class="value">
<pre class="prettyprint"><%= $value %></pre>
</td>
% end
% end
% end
% my $kv = begin
% my ($key, $value) = @_;
<tr>
<td class="key"><%= $key %>:</td>
<td class="value">
<pre><%= $value %></pre>
</td>
</tr>
% end
<div id="showcase" class="code box">
<pre><%= $e->message %></pre>
<div id="context">
<table>
% for my $line (@{$e->lines_before}) {
%= $cv->($line->[0], $line->[1])
% }
% if (defined $e->line->[1]) {
%= $cv->($e->line->[0], $e->line->[1], 1)
% }
% for my $line (@{$e->lines_after}) {
%= $cv->($line->[0], $line->[1])
% }
</table>
</div>
% if (defined $e->line->[2]) {
<div id="insight">
% my $kv = begin
% my ($key, $value) = @_;
<tr>
<td class="key"><%= $key %>:</td>
<td class="value">
<pre><%= $value %></pre>
</td>
</tr>
% end
<div id="showcase" class="code box">
<pre><%= $e->message %></pre>
<div id="context">
<table>
% for my $line (@{$e->lines_before}) {
%= $cv->($line->[0], $line->[2])
%= $cv->($line->[0], $line->[1])
% }
% if (defined $e->line->[1]) {
%= $cv->($e->line->[0], $e->line->[1], 1)
% }
%= $cv->($e->line->[0], $e->line->[2], 1)
% for my $line (@{$e->lines_after}) {
%= $cv->($line->[0], $line->[2])
%= $cv->($line->[0], $line->[1])
% }
</table>
</div>
<div class="tap">tap for more</div>
%= javascript begin
var current = '#context';
$('#showcase').click(function() {
$(current).slideToggle('slow', function() {
if (current == '#context') {
current = '#insight';
}
else {
current = '#context';
}
$(current).slideToggle('slow');
% if (defined $e->line->[2]) {
<div id="insight">
<table>
% for my $line (@{$e->lines_before}) {
%= $cv->($line->[0], $line->[2])
% }
%= $cv->($e->line->[0], $e->line->[2], 1)
% for my $line (@{$e->lines_after}) {
%= $cv->($line->[0], $line->[2])
% }
</table>
</div>
<div class="tap">tap for more</div>
%= javascript begin
var current = '#context';
$('#showcase').click(function() {
$(current).slideToggle('slow', function() {
if (current == '#context') {
current = '#insight';
}
else {
current = '#context';
}
$(current).slideToggle('slow');
});
});
});
$('#insight').toggle();
% end
% }
</div>
<div class="box" id="trace">
% if (@{$e->frames}) {
<div class="infobox" id="frames">
$('#insight').toggle();
% end
% }
</div>
<div class="box" id="trace">
% if (@{$e->frames}) {
<div class="infobox" id="frames">
<table>
% for my $frame (@{$e->frames}) {
<tr>
<td class="value">
<pre><%= $frame->[1] . ':' . $frame->[2] %></pre>
</td>
</tr>
% }
</table>
</div>
<div class="tap">tap for more</div>
%= javascript begin
$('#trace').click(function() {
$('#frames').slideToggle('slow');
});
$('#frames').toggle();
% end
% }
</div>
<div class="box infobox" id="request">
<table>
% my $req = $self->req;
%= $kv->(Method => $req->method)
% my $url = $req->url;
%= $kv->(Path => $url->to_string)
%= $kv->(Base => $url->base->to_string)
%= $kv->(Parameters => dumper $req->params->to_hash)
%= $kv->(Stash => dumper $snapshot)
%= $kv->(Session => dumper session)
%= $kv->(Version => $req->version)
% for my $name (@{$self->req->headers->names}) {
% my $value = $self->req->headers->header($name);
%= $kv->($name, $value)
% }
</table>
</div>
<div class="box infobox" id="more">
<div id="infos">
<table>
% for my $frame (@{$e->frames}) {
<tr>
<td class="value">
<pre><%= $frame->[1] . ':' . $frame->[2] %></pre>
</td>
</tr>
% }
%= $kv->(Perl => "$] ($^O)")
% my $version = $Mojolicious::VERSION;
% my $codename = $Mojolicious::CODENAME;
%= $kv->(Mojolicious => "$version ($codename)")
%= $kv->(Home => app->home)
%= $kv->(Include => dumper \@INC)
%= $kv->(PID => $$)
%= $kv->(Name => $0)
%= $kv->(Executable => $^X)
%= $kv->(Time => scalar localtime(time))
</table>
</div>
<div class="tap">tap for more</div>
%= javascript begin
$('#trace').click(function() {
$('#frames').slideToggle('slow');
});
$('#frames').toggle();
% end
% }
</div>
<div class="box infobox" id="request">
<table>
% my $req = $self->req;
%= $kv->(Method => $req->method)
% my $url = $req->url;
%= $kv->(Path => $url->to_string)
%= $kv->(Base => $url->base->to_string)
%= $kv->(Parameters => dumper $req->params->to_hash)
%= $kv->(Stash => dumper $snapshot)
%= $kv->(Session => dumper session)
%= $kv->(Version => $req->version)
% for my $name (@{$self->req->headers->names}) {
% my $value = $self->req->headers->header($name);
%= $kv->($name, $value)
% }
</table>
</div>
<div class="box infobox" id="more">
<div id="infos">
<table>
%= $kv->(Perl => "$] ($^O)")
% my $version = $Mojolicious::VERSION;
% my $codename = $Mojolicious::CODENAME;
%= $kv->(Mojolicious => "$version ($codename)")
%= $kv->(Home => app->home)
%= $kv->(Include => dumper \@INC)
%= $kv->(PID => $$)
%= $kv->(Name => $0)
%= $kv->(Executable => $^X)
%= $kv->(Time => scalar localtime(time))
</table>
</div>
<div class="tap">tap for more</div>
</div>
<div id="footer">
%= link_to 'http://mojolicio.us' => begin
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/templates/exception.html.ep
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<head><title>Server Error</title></head>
<head><title>Server error</title></head>
%= stylesheet begin
body { background-color: #caecf6 }
#raptor {
Expand Down

0 comments on commit fdd009d

Please sign in to comment.