Skip to content

Instantly share code, notes, and snippets.

@gugod gugod/Page.pm
Created Aug 17, 2009

Embed
What would you like to do?
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
You can’t perform that action at this time.