]> Frank Brehm's Git Trees - books.git/commitdiff
Hauptmenü fertig, Statuszeile fertig
authorFrank Brehm <frank@brehm-online.com>
Thu, 20 Mar 2008 07:20:11 +0000 (07:20 +0000)
committerFrank Brehm <frank@brehm-online.com>
Thu, 20 Mar 2008 07:20:11 +0000 (07:20 +0000)
lib/FrBr/Books.pm
lib/FrBr/Books/Controller/Books.pm
lib/FrBr/Books/Controller/Login.pm [new file with mode: 0644]
lib/FrBr/Books/Controller/Root.pm
root/lib/site/statusbar.tt2
root/lib/site/styles.css
root/src/books/index.tt2 [new file with mode: 0644]
root/src/index.tt2 [new file with mode: 0644]
t/controller_Login.t [new file with mode: 0644]

index 550fe5024c2ab801e2e6d7c457118e8ef9736cd3..c1a16aa9034255438386f401c2cf846b1eb6d17f 100644 (file)
@@ -76,6 +76,14 @@ sub auto : Private {
     my $storage = $c->model('Schema')->storage;
     $c->stash->{'storage'} = $storage;
 
+    $c->stash->{'site_title'} = "Franks Büchersammlung";
+
+    $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->uri_for("/"),
+        'name' => "Startseite"
+    };
+
     $c->config->{'debug_level'} = 0 unless defined $c->config->{'debug_level'};
     $c->log->debug( get_output_string( $K, "Aktuelle Konfiguration: ", $c->config ) ) if $c->config->{'debug_level'} >= 3;
 
@@ -107,9 +115,6 @@ sub auto : Private {
         $c->session->{'cur_path'}  = $req_path;
     }
 
-    $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
-    push @{ $c->stash->{'menu_path'} }, { 'path' => $c->uri_for("/"), 'name' => "Home" };
-
     # Request-URI in Sitzung einpflegen
     $c->session->{'request'}           = {};
     $c->session->{'request'}{'uri'}    = $c->req->uri();
@@ -134,6 +139,8 @@ sub auto : Private {
     #$c->stash->{'lang_to_use'} = $lang;
     #$c->log->debug( $K . "Neue Sprache: '" . $lang . "' (" . $LangsToUseInDates{$lang} . ")." ) if $c->stash->{'debug_level'} >= 2;
 
+    $c->stash->{'login_action'} = 'login';
+
     1;
 
 } ## end sub auto :
index 1aa08a5a7c9be2bb3c46e673eaae0a3fbf07766e..7f952ac2b079c0c320be75ede650c7c9da845b82 100644 (file)
@@ -58,7 +58,8 @@ sub auto : Private {
 sub index : Private {
     my ( $self, $c ) = @_;
 
-    $c->response->body('Matched FrBr::Books::Controller::Books in Books.');
+    $c->stash->{'template'} = 'books/index.tt2';
+
 }
 
 #-------------------------------------------------------
@@ -96,6 +97,11 @@ sub list : Local {
     my $K = __PACKAGE__ . "::list(): ";
     $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
 
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->uri_for("/books/list"),
+        'name' => "Liste"
+    };
+
     my $buchliste = get_booklist( $c );
     $c->log->debug( get_output_string( $K, "Erhaltene Buchliste: ", $buchliste ) ) if $c->stash->{'debug_level'} >= 2;
     $c->stash->{'books'} = $buchliste;
diff --git a/lib/FrBr/Books/Controller/Login.pm b/lib/FrBr/Books/Controller/Login.pm
new file mode 100644 (file)
index 0000000..eaa72aa
--- /dev/null
@@ -0,0 +1,52 @@
+package FrBr::Books::Controller::Login;
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+use FrBr::Common;
+
+=head1 NAME
+
+FrBr::Books::Controller::Login - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index 
+
+=cut
+
+sub index : Private {
+    my ( $self, $c ) = @_;
+
+    $c->stash->{'template'}   = 'not_implemented.tt2';
+
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->uri_for("/login"),
+        'name' => "Anmeldung"
+    };
+
+}
+
+
+=head1 AUTHOR
+
+Frank Brehm
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
index 9ae0e9f345c430ae7085d63a86a1b83fe4a55965..0caeb5d8037cd2d922341de36441ab3f185b439f 100644 (file)
@@ -6,6 +6,7 @@ package FrBr::Books::Controller::Root;
 use strict;
 use warnings;
 use base 'Catalyst::Controller';
+use FrBr::Common;
 
 #
 # Sets the actions in this controller to be registered with no prefix
@@ -25,6 +26,8 @@ FrBr::Books::Controller::Root - Root Controller for FrBr::Books
 
 =cut
 
+#---------------------------------------------------------------------------
+
 =head2 default
 
 =cut
@@ -34,21 +37,31 @@ sub default : Private {
     my ( $self, $c ) = @_;
 
     #$c->stash->{'site_title'} = sprintf( $c->localize( "%s's Cookbook" ) , 'Frank Brehm' );
-    $c->stash->{'site_title'} = "Franks Bucharchiv";
+    $c->stash->{'site_title'} = "Willkommen in Franks Büchersammlung";
     $c->stash->{'message'}    = 'Willkommen!';
-    $c->stash->{'template'} = 'welcome.tt2';
+    $c->stash->{'template'} = 'index.tt2';
 
     # Hello World
     #$c->response->body( $c->welcome_message );
 }
 
+#---------------------------------------------------------------------------
+
 =head2 end
 
 Attempt to render a view, if needed.
 
 =cut 
 
-sub end : ActionClass('RenderView') {}
+sub end : ActionClass('RenderView') {
+
+    my ( $self, $c ) = @_;
+    my $K = __PACKAGE__ . "::end(): ";
+
+    pop @{ $c->stash->{'menu_path'} };
+    $c->log->debug( get_output_string( $K, "Menue-Pfad: ", $c->stash->{'menu_path'} ) ) if $c->stash->{'debug_level'};
+
+}
 
 =head1 AUTHOR
 
index 4c326b96ea2e827858365a223fd834dceb684a4b..50fcf30ec396942467a9c78c1552ea5a9f0972d0 100644 (file)
@@ -6,4 +6,27 @@
    $URL$
 
 -%]
-&nbsp;
+<table cellpadding="0" cellspacing="0" width="100%" class="statusbar">
+  <tr>
+    <td style="text-align: left;">
+[%- IF login_action == 'none' -%]
+    &nbsp;
+[%- ELSE -%]
+    [% tt_menu = [ ]; tt_menu.push( "<a href=\"${item.path}\">${item.name}</a>" ) FOREACH item IN menu_path %][% tt_menu.join('&nbsp;&raquo;&nbsp;') %]
+[%- END -%]
+    </td>
+    <td style="text-align: right;">
+[%- IF login_action == 'none' -%]
+    &nbsp;
+[%- ELSE -%]
+    [%- IF login_action == 'login' -%]
+    <span class="login"><a href="[% Catalyst.uri_for("/login") %]">Anmelden</a></span>
+    [%- ELSE -%]
+    Angemeldet als: <span class="login">[% current_user %] -
+    <a href="[% Catalyst.uri_for("/logout") %]">Abmelden</a></span>
+    [%- END -%]
+[%- END -%]
+    </td>
+  </tr>
+</table>
+<!-- END site/statusbar -->
index 86a540149e70f746f4bb170234e7843d38aa955c..4773c67abd3ab3fcb7b44cd2e9ba355c32d0f599 100644 (file)
@@ -166,6 +166,49 @@ DIV#copyright {
     color:              [% site.col.error %];
 }
 
+TABLE.menu {
+    font-size:          14pt;
+    margin-left:        auto;
+    margin-right:       auto;
+    margin-top:         20px;
+    margin-bottom:      20px;
+    border-spacing:     0;
+    padding:            2px;
+}
+
+TABLE.menu TH {
+    background-color:   [% site.col.head %];
+    border:             1px solid [% site.col.line %];
+    margin:             0;
+    padding:            5px;
+}
+
+TABLE.menu TD {
+    text-align:         left;
+}
+
+TABLE.menu TD.empty {
+    margin:             0;
+    padding:            0;
+    font-size:          6pt;
+}
+
+TABLE.menu TD.button {
+    background-color:   [% site.col.head %];
+    border:             1px solid [% site.col.line %];
+    margin:             0;
+    padding:            5px;
+}
+
+
+TABLE.menu TD.item {
+    background-color:   [% site.col.statusbarbg %];
+    border:             1px solid [% site.col.line %];
+    margin:             0;
+    padding:            5px;
+}
+
+
 [%- FOREACH cssfile IN cssfiles %]
 /* --- [% cssfile %] ----------------- */
   [% PROCESS $cssfile -%]
diff --git a/root/src/books/index.tt2 b/root/src/books/index.tt2
new file mode 100644 (file)
index 0000000..0d58760
--- /dev/null
@@ -0,0 +1,45 @@
+[%#
+
+    message.tt2 - Universal-Template
+
+   #$Id$
+   #$URL$
+
+-%]
+<div style="text-align: center">
+<table class="menu" cellspacing="0">
+  <tr>
+    <th colspan="2">Menü</th>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% Catalyst.uri_for('/books/search') %]">Suchmaske</a></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% Catalyst.uri_for('/books/list') %]">Bücherliste</a></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% Catalyst.uri_for('/') %]">Zurück zum Hauptmenü</a></td>
+  </tr>
+</table>
+</div>
diff --git a/root/src/index.tt2 b/root/src/index.tt2
new file mode 100644 (file)
index 0000000..dea2373
--- /dev/null
@@ -0,0 +1,27 @@
+[%#
+
+    message.tt2 - Universal-Template
+
+   #$Id$
+   #$URL$
+
+-%]
+[%- META title = 'Willkommen in Franks Büchersammlung' -%]
+
+<div style="text-align: center">
+<table class="menu" cellspacing="0">
+  <tr>
+    <th colspan="2">Menü</th>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% Catalyst.uri_for('/books') %]">Bücher suchen</a></td>
+  </tr>
+</table>
+</div>
diff --git a/t/controller_Login.t b/t/controller_Login.t
new file mode 100644 (file)
index 0000000..a083eb3
--- /dev/null
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'FrBr::Books' }
+BEGIN { use_ok 'FrBr::Books::Controller::Login' }
+
+ok( request('/login')->is_success, 'Request should succeed' );
+
+