]> ruin.nu Git - ndwebbie.git/commitdiff
Added model and renamed submodule
authorMichael Andreen <harv@ruin.nu>
Thu, 12 Jun 2008 21:41:11 +0000 (23:41 +0200)
committerMichael Andreen <harv@ruin.nu>
Tue, 17 Jun 2008 21:14:36 +0000 (23:14 +0200)
.gitmodules
ND [deleted submodule]
lib/ND [new submodule]
lib/NDWeb/Controller/Root.pm
lib/NDWeb/Model/Model.pm [new file with mode: 0644]
root/lib/config/main.tt2
root/lib/site/html.tt2
root/lib/site/leftbar.tt2
root/src/index.tt2
t/model_Model.t [new file with mode: 0644]

index 9fcfba2852db3e6711e152734648f4351f426b5e..b1886ab89e699e05a692840a22ca7b6ad989857a 100644 (file)
@@ -1,3 +1,3 @@
-[submodule "ND"]
-       path = ND
+[submodule "lib/ND"]
+       path = lib/ND
        url = whale@ruin.nu:git/ND.git
diff --git a/ND b/ND
deleted file mode 160000 (submodule)
index 193d9ed..0000000
--- a/ND
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 193d9ed10fea0563da8da5f54ec42f3068547dd4
diff --git a/lib/ND b/lib/ND
new file mode 160000 (submodule)
index 0000000..193d9ed
--- /dev/null
+++ b/lib/ND
@@ -0,0 +1 @@
+Subproject commit 193d9ed10fea0563da8da5f54ec42f3068547dd4
index 4657f7ad8bb0d0cc6cd0b9dd77adcb20339523b4..0a41059c7bc3e7188202c6caf050c12cdb61d464 100644 (file)
@@ -29,17 +29,26 @@ NDWeb::Controller::Root - Root Controller for NDWeb
 sub index : Local Path Args(0) {
     my ( $self, $c ) = @_;
 
-    # Hello World
-       #$c->response->body( $c->welcome_message );
+       $c->stash(abc => $c->req->base);
 }
 
 sub default : Path {
     my ( $self, $c ) = @_;
-    $c->response->body( 'Page not found' );
+       $c->res->body( 'Page not found' );
     $c->response->status(404);
     
 }
 
+sub auto : Private {
+       my ($self, $c) = @_;
+
+       my $dbh = $c ->model;
+       $c->stash(dbh => $dbh);
+
+       $c->stash->{game}->{tick} = $dbh->selectrow_array('SELECT tick()',undef);
+
+}
+
 =head2 end
 
 Attempt to render a view, if needed.
diff --git a/lib/NDWeb/Model/Model.pm b/lib/NDWeb/Model/Model.pm
new file mode 100644 (file)
index 0000000..c696778
--- /dev/null
@@ -0,0 +1,11 @@
+package NDWeb::Model::Model;
+use strict;
+use warnings;
+use base 'Catalyst::Model::Factory::PerRequest';
+
+__PACKAGE__->config( 
+    class       => 'ND::DB',
+    constructor => 'DB',
+);
+
+1;
index fe70a5e7ab877084eb97e00b90e55ec8e7c8ac54..2e9bcfde325026d8f0c0cbc1e099985eaccfd61f 100644 (file)
@@ -16,6 +16,8 @@
      copyright => '2008 harv',
    };
 
+   USE DBI ( dbh = dbh);
+
    # load up any other configuration items 
    PROCESS config/url.tt2;
 
index f7236e7b5a8e8e15c05d89b73cec955ecd7e42d6..8cccb3f53f58b5f26e335ca37721b18bac904171 100644 (file)
@@ -3,7 +3,7 @@
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-       <title>[% template.title or site.title %]</title>
+       <title>[% site.title %]: [% template.title %]</title>
        <meta http-equiv="Content-Type" content="application/xhtml+xml;charset=UTF-8"/>
        <link rel="stylesheet" type="text/css" href="/static/default.css"/>
        <link rel="stylesheet" type="text/css" href="/static/css/[% user.css or "black" %].css"/>
index a5bfb758141909a8776d11f17c3c8f53c0497308..371428510805976e22f915feb7f44ab57e9201c2 100644 (file)
@@ -1,5 +1,5 @@
 <ul class="linkbar">
-       <li><a href="/main">Main page</a></li>
+       <li><a href="/index">Main page</a></li>
        <li><a href="/settings">Settings</a></li>
        <li><a href="/forum">Forum</a></li>
 [% IF user %]
index c3831a0066e8d65d3af8ba3c4371a3dbe1207e5c..ccab9a84bbcceba17681695125322a504ce02fe7 100644 (file)
@@ -1,8 +1,5 @@
-[% META title = 'Catalyst/TT View!' %]
+[% META title = 'Main' %]
 <p>
-  Yay!  You're looking at a page generated by the Catalyst::View::TT
-  plugin module.
-</p>
-<p>
-  This is the welcome page.  Why not try the equally-exciting 
+Hello [% user.name %]
 </p>
+
diff --git a/t/model_Model.t b/t/model_Model.t
new file mode 100644 (file)
index 0000000..62c444b
--- /dev/null
@@ -0,0 +1,6 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'NDWeb::Model::Model' }
+