From 0158eb959e255a1c39577dd79ded2f519f5e4d67 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Fri, 4 Apr 2008 11:58:56 +0000 Subject: [PATCH] Mit Verlagen angefangen --- lib/FrBr/Books/Controller/Verlag.pm | 97 +++++++++++++++++++++++++++++ root/src/books/book_form.tt2 | 9 ++- root/src/verlag/index.tt2 | 45 +++++++++++++ root/src/verlag/styles.css | 10 +++ t/controller_Verlag.t | 10 +++ 5 files changed, 169 insertions(+), 2 deletions(-) create mode 100644 lib/FrBr/Books/Controller/Verlag.pm create mode 100644 root/src/verlag/index.tt2 create mode 100644 root/src/verlag/styles.css create mode 100644 t/controller_Verlag.t diff --git a/lib/FrBr/Books/Controller/Verlag.pm b/lib/FrBr/Books/Controller/Verlag.pm new file mode 100644 index 0000000..4788632 --- /dev/null +++ b/lib/FrBr/Books/Controller/Verlag.pm @@ -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; diff --git a/root/src/books/book_form.tt2 b/root/src/books/book_form.tt2 index 4691379..f08907f 100644 --- a/root/src/books/book_form.tt2 +++ b/root/src/books/book_form.tt2 @@ -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; +} + //]]>
@@ -63,7 +68,7 @@ function goto_new_author() {   +   Kategorie(n): @@ -129,7 +134,7 @@ function goto_new_author() { +     diff --git a/root/src/verlag/index.tt2 b/root/src/verlag/index.tt2 new file mode 100644 index 0000000..4889e9e --- /dev/null +++ b/root/src/verlag/index.tt2 @@ -0,0 +1,45 @@ +[%# + + index.tt2 - Index-Template (Menue) fuer Verlags-Dinge + + #$Id$ + #$URL$ + +-%] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/root/src/verlag/styles.css b/root/src/verlag/styles.css new file mode 100644 index 0000000..e80cbb2 --- /dev/null +++ b/root/src/verlag/styles.css @@ -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 index 0000000..6deb5be --- /dev/null +++ b/t/controller_Verlag.t @@ -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' ); + + -- 2.39.5