]> Dogcows Code - chaz/chatty/commitdiff
adding a basic template to build off of
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 13 Oct 2011 03:49:19 +0000 (21:49 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Thu, 13 Oct 2011 03:49:19 +0000 (21:49 -0600)
lib/Chatty/Controller/Root.pm
lib/Chatty/View/HTML.pm [new file with mode: 0644]
root/static/css/common.css [new file with mode: 0644]
root/tt/index.tt [new file with mode: 0644]
root/tt/wrapper.tt [new file with mode: 0644]
t/view_HTML.t [new file with mode: 0644]

index 4d4c979715ba050274f51ccdec317023ff7d0d3a..644a861a2d074191130835ef6296a4a3b4d1d7ac 100644 (file)
@@ -16,7 +16,7 @@ Chatty::Controller::Root - Root Controller for Chatty
 
 =head1 DESCRIPTION
 
-[enter your description here]
+Implements all actions for this simple chat application.
 
 =head1 METHODS
 
@@ -27,10 +27,7 @@ The root page (/)
 =cut
 
 sub index :Path :Args(0) {
-    my ( $self, $c ) = @_;
-
-    # Hello World
-    $c->response->body( $c->welcome_message );
+       my ( $self, $c ) = @_;
 }
 
 =head2 default
@@ -40,9 +37,9 @@ Standard 404 error page
 =cut
 
 sub default :Path {
-    my ( $self, $c ) = @_;
-    $c->response->body( 'Page not found' );
-    $c->response->status(404);
+       my ( $self, $c ) = @_;
+       $c->response->body( 'Page not found' );
+       $c->response->status(404);
 }
 
 =head2 end
diff --git a/lib/Chatty/View/HTML.pm b/lib/Chatty/View/HTML.pm
new file mode 100644 (file)
index 0000000..02877fb
--- /dev/null
@@ -0,0 +1,42 @@
+package Chatty::View::HTML;
+
+use strict;
+use warnings;
+
+use base 'Catalyst::View::TT';
+
+__PACKAGE__->config(
+       TEMPLATE_EXTENSION => '.tt',
+       INCLUDE_PATH => [
+               Chatty->path_to('root', 'tt'),
+       ],
+       WRAPPER => 'wrapper.tt',
+       render_die => 1,
+       COMPILE_DIR => '/tmp/tt_cache',
+);
+
+
+=head1 NAME
+
+Chatty::View::HTML - TT View for Chatty
+
+=head1 DESCRIPTION
+
+TT View for Chatty.
+
+=head1 SEE ALSO
+
+L<Chatty>
+
+=head1 AUTHOR
+
+Charles McGarvey
+
+=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/root/static/css/common.css b/root/static/css/common.css
new file mode 100644 (file)
index 0000000..2e378b5
--- /dev/null
@@ -0,0 +1,49 @@
+
+body {
+       font: 100 14px Verdana, Helvetica, Arial;
+       margin: 10px;
+       background: #ccf;
+}
+
+img {
+       border: 0;
+}
+
+a {
+       text-decoration: none;
+}
+
+a:hover {
+       border-bottom: 1px dotted blue;
+}
+
+
+.left {
+       float: left;
+       margin: 0 5px 5px 0;
+}
+
+.right {
+       float: right;
+       margin: 0 0 5px 5px;
+}
+
+
+#outer {
+       margin: 0 auto 0 auto;
+       width: 640px;
+       border: 2px solid black;
+       background: #99c;
+}
+
+#inner {
+       margin: 5px;
+       padding: 10px;
+       border: 2px solid black;
+       background: white;
+}
+
+#inner h1 {
+       font-size: 1.3em;
+}
+
diff --git a/root/tt/index.tt b/root/tt/index.tt
new file mode 100644 (file)
index 0000000..51e8ea5
--- /dev/null
@@ -0,0 +1 @@
+<h1>Chatty - Toy chat app written in Perl/Catalyst</h1>
diff --git a/root/tt/wrapper.tt b/root/tt/wrapper.tt
new file mode 100644 (file)
index 0000000..cfcaf5b
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <meta name="author" content="Charles McGarvey">
+               <meta name="description" content="This is a chat application in Catalyst!">
+               <link rel="stylesheet" type="text/css" href="[% c.uri_for('static/css/common.css') %]">
+               <title>Chatty - [% template.title or 'Toy chat application written in Perl/Catalyst' %]</title>
+       </head>
+       <body>
+               <div id="outer">
+                       <div id="inner">
+[% content %]
+                       </div>
+               </div>
+               <script type="text/javascript" src="[% static('js/jquery.tools-1.2.6.min.js') %]"></script>
+       </body>
+</html>
diff --git a/t/view_HTML.t b/t/view_HTML.t
new file mode 100644 (file)
index 0000000..0b1a753
--- /dev/null
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+use Test::More;
+
+
+BEGIN { use_ok 'Chatty::View::HTML' }
+
+done_testing();
This page took 0.025759 seconds and 4 git commands to generate.