Permalink
Browse files

support layout

  • Loading branch information...
1 parent c0cc9d3 commit d7e25afbf055917cd0da92a25e68ab46209e5985 @dann committed Mar 14, 2009
@@ -0,0 +1,32 @@
+<html>
+[%-
+ DEFAULT header_tt = 'header.tt';
+ DEFAULT footer_tt = 'footer.tt';
+ DEFAULT library_scripts = [ '/static/js/jquery-1.2.6.js' ];
+ DEFAULT scripts = [];
+ DEFAULT library_styles = [ '/static/css/base.css' ];
+ DEFAULT styles = [];
+-%]
+<head>
+ <title>[% title %]</title>
+[% FOREACH script IN library_scripts %]
+ <script src="[% script %]" type="text/javascript"></script>
+[% END %]
+[% FOREACH script IN scripts %]
+ <script src="[% script %]" type="text/javascript"></script>
+[% END %]
+[% FOREACH style IN library_styles %]
+ <link rel="stylesheet" type="text/css" href="[% style %]">
+[% END %]
+[% FOREACH style IN styles %]
+ <link rel="stylesheet" type="text/css" href="[% style %]">
+[% END %]
+</head>
+<body>
+<div id="container">
+ <div id="content">
+[% content %]
+ </div>
+</div>
+</body>
+</html>
@@ -0,0 +1,8 @@
+package Angelos::Context;
+use Angelos::Class;
+
+has 'app' => (
+ is => 'rw',
+);
+
+__END_OF_CLASS__
@@ -50,7 +50,12 @@ sub po_dir {
sub templates_dir {
my $self = shift;
- dir( $self->root_dir, 'templates' );
+ dir( $self->root_dir, 'views' );
+}
+
+sub layouts_dir {
+ my $self = shift;
+ dir( $self->templates_dir, 'layouts');
}
sub db_dir {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -2,6 +2,7 @@ package Angelos::View::TT;
use Angelos::Class;
use Template;
use Path::Class;
+use Angelos::Registrar;
extends 'Angelos::View';
has 'INCLUDE_PATH' => ( is => 'rw', );
@@ -24,7 +25,7 @@ has 'PRE_PROCESS' => (
# TODO: Implement at _build_engine
has 'WRAPPER' => (
is => 'rw',
- isa => 'Str',
+ builder => 'build_wrapper',
);
# TODO: Implement at _build_engine
@@ -49,6 +50,15 @@ has 'FILTERS' => (
lazy => 1,
);
+sub build_wrapper {
+ my $self = shift;
+ file($self->context->project_structure->layouts_dir, 'application.tt');
+}
+
+sub context {
+ Angelos::Registrar::context();
+}
+
sub build_filters {
# load filters
die 'Implement me';

0 comments on commit d7e25af

Please sign in to comment.