Skip to content

Commit

Permalink
added skeleton for new development mode not_found page
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 16, 2012
1 parent bb2cd94 commit 01e5ca8
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 91 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.44 2012-01-16 00:00:00
- Added new not_found page for development mode.
- Added EXPERIMENTAL url_with helper to
Mojolicious::Plugin::DefaultHelpers. (diegok, marcus, judofyr, sri)
- Added EXPERIMENTAL support for removing query parmaters while
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojolicious/Controller.pm
Expand Up @@ -22,10 +22,11 @@ has match => sub {
has tx => sub { Mojo::Transaction::HTTP->new };

# Bundled files
my $H = Mojo::Home->new;
our $H = Mojo::Home->new;
$H->parse($H->parse($H->mojo_lib_dir)->rel_dir('Mojolicious/templates'));
our $EXCEPTION = $H->slurp_rel_file('exception.html.ep');
our $DEV_EXCEPTION = $H->slurp_rel_file('exception.development.html.ep');
our $MOJOBAR = $H->slurp_rel_file('mojobar.html.ep');
our $NOT_FOUND = $H->slurp_rel_file('not_found.html.ep');
our $DEV_NOT_FOUND = $H->slurp_rel_file('not_found.development.html.ep');

Expand Down
8 changes: 1 addition & 7 deletions lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -5,20 +5,15 @@ use IO::File;
use Mojo::Asset::File;
use Mojo::ByteStream 'b';
use Mojo::DOM;
use Mojo::Home;
use Mojo::Util 'url_escape';

use Pod::Simple::HTML;
use Pod::Simple::Search;

# Paths
our @PATHS = map { $_, "$_/pods" } @INC;

# Bundled files
my $H = Mojo::Home->new;
$H->parse($H->parse($H->mojo_lib_dir)->rel_dir('Mojolicious/templates'));
our $MOJOBAR = $H->slurp_rel_file('mojobar.html.ep');
our $PERLDOC = $H->slurp_rel_file('perldoc.html.ep');
our $PERLDOC = $Mojolicious::Controller::H->slurp_rel_file('perldoc.html.ep');

# "This is my first visit to the Galaxy of Terror and I'd like it to be a
# pleasant one."
Expand Down Expand Up @@ -113,7 +108,6 @@ sub register {
$dom->find('h1 + p')->first(sub { $title = shift->text });

# Combine everything to a proper response
$self->content_for(mojobar => $self->include(inline => $MOJOBAR));
$self->content_for(perldoc => "$dom");
$self->app->plugins->emit_hook(before_perldoc => $self);
$self->render(
Expand Down
Binary file removed lib/Mojolicious/public/amelia.png
Binary file not shown.
Binary file removed lib/Mojolicious/public/mojolicious-arrow.png
Binary file not shown.
Binary file removed lib/Mojolicious/public/mojolicious-box.png
Binary file not shown.
Binary file removed lib/Mojolicious/public/mojolicious-clouds.png
Binary file not shown.
File renamed without changes
2 changes: 1 addition & 1 deletion lib/Mojolicious/templates/exception.html.ep
Expand Up @@ -4,7 +4,7 @@
%= stylesheet begin
body { background-color: #caecf6 }
#raptor {
background: url(<%= url_for '/failraptor.png' %>);
background: url(<%= url_for '/mojolicious-failraptor.png' %>);
height: 488px;
left: 50%;
margin-left: -371px;
Expand Down
8 changes: 3 additions & 5 deletions lib/Mojolicious/templates/mojobar.html.ep
@@ -1,6 +1,6 @@
% content_for header => begin
%= javascript '/js/jquery.js'
%= stylesheet begin
%= javascript '/js/jquery.js'
<div id="mojobar">
%= stylesheet scoped => 'scoped', begin
#mojobar {
background-color: #1a1a1a;
background: -webkit-gradient(
Expand Down Expand Up @@ -54,8 +54,6 @@
}
#mojobar-links a:hover { color: #fff }
% end
% end
<div id="mojobar">
<div id="mojobar-logo">
%= link_to 'http://mojolicio.us' => begin
%= image '/mojolicious-white.png', alt => 'Mojolicious logo'
Expand Down
117 changes: 42 additions & 75 deletions lib/Mojolicious/templates/not_found.development.html.ep
Expand Up @@ -5,101 +5,68 @@
%= stylesheet '/css/prettify-mojo.css'
%= javascript '/js/prettify.js'
%= stylesheet begin
a {
color: inherit;
text-decoration: none;
}
a { color: inherit }
a:hover { color: #2a2a2a }
a img { border: 0 }
body {
background-color: #f5f6f8;
color: #333;
color: #445555;
font: 0.9em 'Helvetica Neue', 'Helvetica', sans-serif;
font-weight: normal;
line-height: 1.5;
margin: 0;
text-align: center;
}
h1 {
font: 1.5em 'Helvetica Neue', 'Helvetica', sans-serif;
font-weight: 300;
margin-bottom: 1em;
margin-top: 1em;
}
#footer {
background-color: #caecf6;
padding-top: 20em;
width: 100%;
}
#footer a img { margin-top: 20em }
#documentation {
background-color: #ecf1da;
padding-bottom: 20em;
padding-top: 20em;
}
#documentation h1 { margin-bottom: 3em }
#header {
margin-bottom: 20em;
margin-top: 15em;
width: 100%;
h1, h2, h3 {
color: #2a2a2a;
font-size: 1.5em;
margin: 0;
}
#perldoc {
h1 a, h2 a, h3 a { text-decoration: none }
pre {
background-color: #eee;
border: 2px dashed #1a1a1a;
color: #000;
display: inline-block;
margin-left: 0.1em;
padding: 0.5em;
white-space: nowrap;
}
#preview {
background-color: #1a1a1a;
background: url(<%= url_for '/mojolicious-pinstripe.gif' %>);
-moz-border-radius: 5px;
border-radius: 5px;
font: 1.5em 'Menlo', 'Monaco', Courier, monospace;
margin: 0;
margin-left: auto;
margin-right: auto;
padding: 0.5em;
padding-left: 1em;
color: #eee;
font: 0.8em 'Menlo', 'Monaco', Courier, monospace;
text-align: left;
text-shadow: #333 0 1px 0;
width: 500px;
padding-bottom: 1.5em;
padding-top: 1.5em;
white-space: pre-wrap;
}
#suggestion {
background-color: #2f3032;
color: #eee;
padding-bottom: 20em;
padding-top: 20em;
#footer {
padding-top: 1em;
text-align: center;
}
#introduction {
background-color: #fff;
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
border-bottom-right-radius: 5px;
-moz-box-shadow: 0px 0px 2px #ccc;
-webkit-box-shadow: 0px 0px 2px #ccc;
box-shadow: 0px 0px 2px #ccc;
margin-left: 5em;
margin-right: 5em;
padding: 3em;
padding-top: 7em;
}
#wrapperlicious {
max-width: 1000px;
margin: 0 auto;
}
% end
</head>
<body onload="prettyPrint()">
<div id="header">
%= image '/mojolicious-box.png', alt => 'Mojolicious banner'
<h1>This page is brand new and has not been unboxed yet!</h1>
</div>
<div id="suggestion">
%= image '/mojolicious-arrow.png', alt => 'Arrow'
<h1>Perhaps you would like to add a route for it?</h1>
<div id="preview">
% my $m = lc $self->req->method eq 'get' ? 'get' : 'any';
<pre class="prettyprint">
<%= $m %> '<%= $self->req->url->path->to_abs_string %>' => sub {
my $self = shift;
$self->render_text('Hello world!');
};</pre>
%= include inline => $Mojolicious::Controller::MOJOBAR
<div id="wrapperlicious">
<div id="introduction">
<p>INTRODUCTION GOES HERE!</p>
</div>
</div>
<div id="documentation">
<h1>
You might also enjoy our excellent documentation in
<div id="perldoc">
%= link_to 'perldoc Mojolicious::Guides', $guide
</div>
</h1>
%= image '/amelia.png', alt => 'Amelia'
</div>
<div id="footer">
<h1>And don't forget to have fun!</h1>
<p><%= image '/mojolicious-clouds.png', alt => 'Clouds' %></p>
%= link_to 'http://mojolicio.us' => begin
%= image '/mojolicious-black.png', alt => 'Mojolicious logo'
% end
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/templates/perldoc.html.ep
Expand Up @@ -4,7 +4,6 @@
<title><%= $title %></title>
%= stylesheet '/css/prettify-mojo.css'
%= javascript '/js/prettify.js'
%= content_for 'header'
%= stylesheet begin
a { color: inherit }
a:hover { color: #2a2a2a }
Expand Down Expand Up @@ -62,7 +61,7 @@
% end
</head>
<body onload="prettyPrint()">
%= content_for 'mojobar'
%= include inline => $Mojolicious::Controller::MOJOBAR
% my $link = begin
%= link_to shift, shift, class => "mojoscroll"
% end
Expand Down

0 comments on commit 01e5ca8

Please sign in to comment.