From 0da21beb53bba595fec04ddf200a46675ae0be31 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 8 Feb 2006 14:45:28 +0000 Subject: view::TTsite git-svn-id: svn://luxion/repos/IscrittiGroLUG/trunk@165 fcb26f47-9200-0410-b104-b98ab5b095f3 --- GroLUG/lib/GroLUG/V/TT.pm | 42 +++++++++++++++++++++++++++++++++++++++++ GroLUG/root/lib/config/col | 21 +++++++++++++++++++++ GroLUG/root/lib/config/main | 27 ++++++++++++++++++++++++++ GroLUG/root/lib/config/url | 8 ++++++++ GroLUG/root/lib/site/footer | 3 +++ GroLUG/root/lib/site/header | 3 +++ GroLUG/root/lib/site/html | 12 ++++++++++++ GroLUG/root/lib/site/layout | 7 +++++++ GroLUG/root/lib/site/wrapper | 8 ++++++++ GroLUG/root/src/error.tt2 | 10 ++++++++++ GroLUG/root/src/message.tt2 | 16 ++++++++++++++++ GroLUG/root/src/ttsite.css | 45 ++++++++++++++++++++++++++++++++++++++++++++ GroLUG/root/src/welcome.tt2 | 9 +++++++++ 13 files changed, 211 insertions(+) create mode 100644 GroLUG/lib/GroLUG/V/TT.pm create mode 100644 GroLUG/root/lib/config/col create mode 100644 GroLUG/root/lib/config/main create mode 100644 GroLUG/root/lib/config/url create mode 100644 GroLUG/root/lib/site/footer create mode 100644 GroLUG/root/lib/site/header create mode 100644 GroLUG/root/lib/site/html create mode 100644 GroLUG/root/lib/site/layout create mode 100644 GroLUG/root/lib/site/wrapper create mode 100644 GroLUG/root/src/error.tt2 create mode 100644 GroLUG/root/src/message.tt2 create mode 100644 GroLUG/root/src/ttsite.css create mode 100644 GroLUG/root/src/welcome.tt2 diff --git a/GroLUG/lib/GroLUG/V/TT.pm b/GroLUG/lib/GroLUG/V/TT.pm new file mode 100644 index 0000000..1882af2 --- /dev/null +++ b/GroLUG/lib/GroLUG/V/TT.pm @@ -0,0 +1,42 @@ +package GroLUG::V::TT; + +use strict; +use base 'Catalyst::View::TT'; + +__PACKAGE__->config({ + CATALYST_VAR => 'Catalyst', + INCLUDE_PATH => [ + GroLUG->path_to( 'root', 'src' ), + GroLUG->path_to( 'root', 'lib' ) + ], + PRE_PROCESS => 'config/main', + WRAPPER => 'site/wrapper', + ERROR => 'error.tt2', + TIMER => 0 +}); + +=head1 NAME + +GroLUG::V::TT - Catalyst TTSite View + +=head1 SYNOPSIS + +See L + +=head1 DESCRIPTION + +Catalyst TTSite View. + +=head1 AUTHOR + +A clever guy + +=head1 LICENSE + +This library is free software, you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +1; + diff --git a/GroLUG/root/lib/config/col b/GroLUG/root/lib/config/col new file mode 100644 index 0000000..811f0af --- /dev/null +++ b/GroLUG/root/lib/config/col @@ -0,0 +1,21 @@ +[% site.rgb = { + black = '#000000' + white = '#ffffff' + grey1 = '#46494c' + grey2 = '#c6c9cc' + grey3 = '#e3e6ea' + red = '#CC4444' + green = '#66AA66' + blue = '#89b8df' + orange = '#f08900' + }; + + site.col = { + page = site.rgb.white + text = site.rgb.grey1 + head = site.rgb.grey3 + line = site.rgb.orange + message = site.rgb.green + error = site.rgb.red + }; +%] diff --git a/GroLUG/root/lib/config/main b/GroLUG/root/lib/config/main new file mode 100644 index 0000000..89de4ae --- /dev/null +++ b/GroLUG/root/lib/config/main @@ -0,0 +1,27 @@ +[% # config/main + # + # This is the main configuration template which is processed before + # any other page, by virtue of it being defined as a PRE_PROCESS + # template. This is the place to define any extra template variables, + # macros, load plugins, and perform any other template setup. + + IF Catalyst.debug; + # define a debug() macro directed to Catalyst's log + MACRO debug(message) CALL Catalyst.log.debug(message); + END; + + # define a data structure to hold sitewide data + site = { + title => 'Catalyst::View::TTSite Example Page', + copyright => '2006 Your Name Here', + }; + + # load up any other configuration items + PROCESS config/col + + config/url; + + # set defaults for variables, etc. + DEFAULT + message = 'There is no message'; + +-%] diff --git a/GroLUG/root/lib/config/url b/GroLUG/root/lib/config/url new file mode 100644 index 0000000..f6c036f --- /dev/null +++ b/GroLUG/root/lib/config/url @@ -0,0 +1,8 @@ +[% base = Catalyst.req.base; + + site.url = { + base = base + home = "${base}welcome" + message = "${base}message" + } +-%] diff --git a/GroLUG/root/lib/site/footer b/GroLUG/root/lib/site/footer new file mode 100644 index 0000000..d16739b --- /dev/null +++ b/GroLUG/root/lib/site/footer @@ -0,0 +1,3 @@ + + + diff --git a/GroLUG/root/lib/site/header b/GroLUG/root/lib/site/header new file mode 100644 index 0000000..35159db --- /dev/null +++ b/GroLUG/root/lib/site/header @@ -0,0 +1,3 @@ + +

[% template.title or site.title %]

+ diff --git a/GroLUG/root/lib/site/html b/GroLUG/root/lib/site/html new file mode 100644 index 0000000..0bf8c27 --- /dev/null +++ b/GroLUG/root/lib/site/html @@ -0,0 +1,12 @@ + + + + [% template.title or site.title %] + + + +[% content %] + + diff --git a/GroLUG/root/lib/site/layout b/GroLUG/root/lib/site/layout new file mode 100644 index 0000000..6024fe3 --- /dev/null +++ b/GroLUG/root/lib/site/layout @@ -0,0 +1,7 @@ + + +
+[% content %] +
+ + diff --git a/GroLUG/root/lib/site/wrapper b/GroLUG/root/lib/site/wrapper new file mode 100644 index 0000000..3e55955 --- /dev/null +++ b/GroLUG/root/lib/site/wrapper @@ -0,0 +1,8 @@ +[% IF template.name.match('\.(css|js|txt)'); + debug("Passing page through as text: $template.name"); + content; + ELSE; + debug("Applying HTML page layout wrappers to $template.name\n"); + content WRAPPER site/html + site/layout; + END; +-%] diff --git a/GroLUG/root/src/error.tt2 b/GroLUG/root/src/error.tt2 new file mode 100644 index 0000000..2ba47e3 --- /dev/null +++ b/GroLUG/root/src/error.tt2 @@ -0,0 +1,10 @@ +[% META title = 'Catalyst/TT Error' %] +

+ An error has occurred. We're terribly sorry about that, but it's + one of those things that happens from time to time. Let's just + hope the developers test everything properly before release... +

+

+ Here's the error message, on the off-chance that it means something + to you: [% error %] +

diff --git a/GroLUG/root/src/message.tt2 b/GroLUG/root/src/message.tt2 new file mode 100644 index 0000000..e72a468 --- /dev/null +++ b/GroLUG/root/src/message.tt2 @@ -0,0 +1,16 @@ +[% META title = 'Catalyst/TT View!' %] +

+ Yay! You're looking at a page generated by the Catalyst::View::TT + plugin module. +

+

+ We have a message for you: [% message %]. +

+

+ Why not try updating the message? Go on, it's really exciting, honest! +

+
+ + +
diff --git a/GroLUG/root/src/ttsite.css b/GroLUG/root/src/ttsite.css new file mode 100644 index 0000000..e946a43 --- /dev/null +++ b/GroLUG/root/src/ttsite.css @@ -0,0 +1,45 @@ + +html { + height: 100%; +} + +body { + background-color: [% site.col.page %]; + color: [% site.col.text %]; + margin: 0px; + padding: 0px; + height: 100%; +} + +#header { + background-color: [% site.col.head %]; + border-bottom: 1px solid [% site.col.line %]; +} + +#footer { + background-color: [% site.col.head %]; + text-align: center; + border-top: 1px solid [% site.col.line %]; + position: absolute; + bottom: 0; + left: 0px; + width: 100%; + padding: 4px; +} + +#content { + padding: 10px; +} + +h1.title { + padding: 4px; + margin: 0px; +} + +.message { + color: [% site.col.message %]; +} + +.error { + color: [% site.col.error %]; +} diff --git a/GroLUG/root/src/welcome.tt2 b/GroLUG/root/src/welcome.tt2 new file mode 100644 index 0000000..26f3d89 --- /dev/null +++ b/GroLUG/root/src/welcome.tt2 @@ -0,0 +1,9 @@ +[% META title = 'Catalyst/TT View!' %] +

+ Yay! You're looking at a page generated by the Catalyst::View::TT + plugin module. +

+

+ This is the welcome page. Why not try the equally-exciting + Message Page? +

-- cgit v1.2.3