]> Frank Brehm's Git Trees - books.git/commitdiff
Mit Verlagen angefangen
authorFrank Brehm <frank@brehm-online.com>
Fri, 4 Apr 2008 11:58:56 +0000 (11:58 +0000)
committerFrank Brehm <frank@brehm-online.com>
Fri, 4 Apr 2008 11:58:56 +0000 (11:58 +0000)
lib/FrBr/Books/Controller/Verlag.pm [new file with mode: 0644]
root/src/books/book_form.tt2
root/src/verlag/index.tt2 [new file with mode: 0644]
root/src/verlag/styles.css [new file with mode: 0644]
t/controller_Verlag.t [new file with mode: 0644]

diff --git a/lib/FrBr/Books/Controller/Verlag.pm b/lib/FrBr/Books/Controller/Verlag.pm
new file mode 100644 (file)
index 0000000..4788632
--- /dev/null
@@ -0,0 +1,97 @@
+package FrBr::Books::Controller::Verlag;
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+use FrBr::Common;
+use FrBr::Books::Util::Verlag;
+
+=head1 NAME
+
+FrBr::Books::Controller::Verlag - Catalyst Controller fuer alles rund um verlage
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+#-------------------------------------------------------
+
+=head2 auto
+
+=cut
+
+sub auto : Private {
+
+    my ( $self, $c ) = @_;
+    my $K = __PACKAGE__ . "::auto(): ";
+
+    $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+
+    $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->web_path("/verlag"),
+        'name' => "Verlag"
+    };
+
+    $c->stash->{'cssfiles'} = [] unless $c->stash->{'cssfiles'};
+    push @{$c->stash->{'cssfiles'}}, 'verlag/styles.css';
+
+    1;
+
+} ## end sub auto :
+
+#-------------------------------------------------------
+
+=head2 index 
+
+=cut
+
+sub index : Private {
+    my ( $self, $c ) = @_;
+
+    $c->stash->{'template'} = 'verlag/index.tt2';
+}
+
+#-------------------------------------------------------
+
+=head2 default
+
+=cut
+
+sub default : Private {
+
+    my ( $self, $c ) = @_;
+    my $K = __PACKAGE__ . "::default(): ";
+
+    $c->stash->{'template'}   = 'not_implemented.tt2';
+
+    push @{ $c->stash->{'menu_path'} }, {
+        'path' => $c->web_path("/verlag/default"),
+        'name' => "Nicht Implementiert"
+    };
+
+} ## end sub default :
+
+
+#-------------------------------------------------------
+
+=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 4691379341bc13f05024fd170521b1d105c40144..f08907fc94330a535ebcd2fa99e078d28d03fa70 100644 (file)
@@ -15,6 +15,11 @@ function goto_new_author() {
     window.location.href = target;
 }
 
+function goto_new_verlag() {
+    var target = '[% Catalyst.web_path( '/verlag/new', { 'return_target_form' => self_url } ) %]';
+    window.location.href = target;
+}
+
 //]]></script>
 
 <form method="post" name="book_form" action="[% self_url %]">
@@ -63,7 +68,7 @@ function goto_new_author() {
       <td><select name="verlags_id" size="1">
             <option value="">-- Verlag auswählen --</option>[% FOR verlagsid IN verlags_ids %]
             <option value="[% verlagsid %]"[% IF book_edit.verlags_id == verlagsid %] selected[% END %]>[% verlagsliste.$verlagsid %]</option>[% END %]
-          </select>&nbsp;<input type="button" name="neuer_verlag" value="*" class="shift_button" title="Neuer Verlag" /></td>
+          </select>&nbsp;<input type="button" name="neuer_verlag" value="*" class="shift_button" title="Neuer Verlag" onclick="goto_new_verlag();" /></td>
     </tr><tr>
       <th>Kategorie(n):</th>
       <td>
@@ -129,7 +134,7 @@ function goto_new_author() {
           <select name="waehrungs_id" size="1">
             <option value="">-- Währung auswählen --</option>[% FOR waehrungsid IN waehrungs_ids %]
             <option value="[% waehrungsid %]"[% IF book_edit.waehrungs_id == waehrungsid %] selected[% END %]>[% waehrungsliste.$waehrungsid.kuerzel %]</option>[% END %]
-          </select></td>
+          </select>&nbsp;<input type="button" name="neue_waehrung" value="*" class="shift_button" title="Neue Währung" /></td>
     </tr><tr>
       <td colspan="2">&nbsp;</td>
     </tr><tr>
diff --git a/root/src/verlag/index.tt2 b/root/src/verlag/index.tt2
new file mode 100644 (file)
index 0000000..4889e9e
--- /dev/null
@@ -0,0 +1,45 @@
+[%#
+
+    index.tt2 - Index-Template (Menue) fuer Verlags-Dinge
+
+   #$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="[% path('/verlag/list') %]">Liste der Verlage</a></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% path('/verlag/new') %]">Neuer Verlag</a></td>
+  </tr>
+  <tr>
+    <td colspan="2" class="empty">
+      &nbsp;</td>
+  </tr>
+  <tr>
+    <td class="button">
+      &nbsp;</td>
+    <td class="item">
+      <a href="[% path('/') %]">Zurück zum Hauptmenü</a></td>
+  </tr>
+</table>
+</div>
diff --git a/root/src/verlag/styles.css b/root/src/verlag/styles.css
new file mode 100644 (file)
index 0000000..e80cbb2
--- /dev/null
@@ -0,0 +1,10 @@
+/* [%#
+   # Template fuer Stylesheets Verlage
+   #
+   # $Id$
+   # $URL$
+   #
+-%]
+Stylesheets Verlage */
+
+
diff --git a/t/controller_Verlag.t b/t/controller_Verlag.t
new file mode 100644 (file)
index 0000000..6deb5be
--- /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::Verlag' }
+
+ok( request('/verlag')->is_success, 'Request should succeed' );
+
+