Skip to content

Instantly share code, notes, and snippets.

@gugod
Created August 17, 2009 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gugod/168919 to your computer and use it in GitHub Desktop.
Save gugod/168919 to your computer and use it in GitHub Desktop.
package MyApp::View::Page;
use strict;
use warnings;
use utf8;
use encoding 'utf8';
use base qw/Jifty::View::Declare::Page/;
use Template::Declare::Tags;
use Jifty::View::Declare::Helpers;
# Let header part emits the new HTML5 prototype.
sub render_header {
my $self = shift;
return if $self->done_header;
Template::Declare->new_buffer_frame;
outs_raw("<!doctype html>\n<html>\n");
$self->_render_header($self->_title || Jifty->config->framework('ApplicationName'));
$self->done_header(Template::Declare->buffer->data);
Template::Declare->end_buffer_frame;
return '';
};
sub render_page {
my $self = shift;
with(id => "doc"), div {
# render the CRUD/notify messages at the very top of the page
# to make it really stand out.
Jifty->web->render_messages;
with(id=>"header"), div {
with(class => "container_16 clearfix"), div {
with(class => "grid_16"), div {
h1 { hyperlink(label => "Write", url => "/") };
# Should define this in MyApp::View
show("/menu");
};
};
};
with(class => "container_16 clearfix", id => "wrapper"), div {
with(class => "grid_16"), div {
# These statements are simply copied from the Jifty::View::Page class.
no warnings qw( redefine once );
local *is::title = $self->mk_title_handler();
$self->render_pre_content_hook();
$self->content_code->();
$self->render_header();
$self->render_jifty_page_detritus();
};
};
with(class => "container_16 clearfix", id => "footer"), div {
with(class => "grid_16"), div {
outs_raw "<address>Copyright &copy; 2009 Somebody.</address>";
};
};
};
# I always put javascript at the end of the page to speed-up page-rendering.
Jifty->web->include_javascript;
# This method should returns coderef.
return sub {};
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment