From: Michael Andreen Date: Thu, 12 Jun 2008 21:41:11 +0000 (+0200) Subject: Added model and renamed submodule X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=commitdiff_plain;h=8250eb360c341a4eeaa76e5e3fc0f57cf0014a60 Added model and renamed submodule --- diff --git a/.gitmodules b/.gitmodules index 9fcfba2..b1886ab 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 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 index 0000000..193d9ed --- /dev/null +++ b/lib/ND @@ -0,0 +1 @@ +Subproject commit 193d9ed10fea0563da8da5f54ec42f3068547dd4 diff --git a/lib/NDWeb/Controller/Root.pm b/lib/NDWeb/Controller/Root.pm index 4657f7a..0a41059 100644 --- a/lib/NDWeb/Controller/Root.pm +++ b/lib/NDWeb/Controller/Root.pm @@ -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 index 0000000..c696778 --- /dev/null +++ b/lib/NDWeb/Model/Model.pm @@ -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; diff --git a/root/lib/config/main.tt2 b/root/lib/config/main.tt2 index fe70a5e..2e9bcfd 100644 --- a/root/lib/config/main.tt2 +++ b/root/lib/config/main.tt2 @@ -16,6 +16,8 @@ copyright => '2008 harv', }; + USE DBI ( dbh = dbh); + # load up any other configuration items PROCESS config/url.tt2; diff --git a/root/lib/site/html.tt2 b/root/lib/site/html.tt2 index f7236e7..8cccb3f 100644 --- a/root/lib/site/html.tt2 +++ b/root/lib/site/html.tt2 @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - [% template.title or site.title %] + [% site.title %]: [% template.title %] diff --git a/root/lib/site/leftbar.tt2 b/root/lib/site/leftbar.tt2 index a5bfb75..3714285 100644 --- a/root/lib/site/leftbar.tt2 +++ b/root/lib/site/leftbar.tt2 @@ -1,5 +1,5 @@