r74339 - in /trunk/libhtml-formfu-perl: Changes META.yml Makefile.PL debian/changelog lib/HTML/FormFu.pm lib/HTML/FormFu/Constraint.pm lib/HTML/FormFu/Deploy.pm lib/HTML/FormFu/Manual/Cookbook.pod lib/HTML/FormFu/Model/HashRef.pm lib/HTML/FormFu/Plugin.pm
ansgar at users.alioth.debian.org
ansgar at users.alioth.debian.org
Fri May 13 18:21:04 UTC 2011
Author: ansgar
Date: Fri May 13 18:20:48 2011
New Revision: 74339
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74339
Log:
New upstream release.
Modified:
trunk/libhtml-formfu-perl/Changes
trunk/libhtml-formfu-perl/META.yml
trunk/libhtml-formfu-perl/Makefile.PL
trunk/libhtml-formfu-perl/debian/changelog
trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Deploy.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Manual/Cookbook.pod
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
trunk/libhtml-formfu-perl/lib/HTML/FormFu/Plugin.pm
Modified: trunk/libhtml-formfu-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/Changes?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/Changes (original)
+++ trunk/libhtml-formfu-perl/Changes Fri May 13 18:20:48 2011
@@ -1,3 +1,7 @@
+0.09003 2011-05-10
+
+ - fixed regression in Model::HashRef introduced in 0.09000
+
0.09002 2011-03-21
- Hopefully fix IO::Interactive dependency properly
Modified: trunk/libhtml-formfu-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/META.yml?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/META.yml (original)
+++ trunk/libhtml-formfu-perl/META.yml Fri May 13 18:20:48 2011
@@ -50,6 +50,7 @@
Locale::Maketext: 0
Module::Pluggable: 0
Moose: 1.00
+ Moose::Meta::Attribute::Custom::Trait::Chained: 0
MooseX::Aliases: 0
MooseX::ChainedAccessors::Accessor: 0.02
MooseX::SetOnce: 0
@@ -64,4 +65,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: git://github.com/fireartist/HTML-FormFu.git
-version: 0.09002
+version: 0.09003
Modified: trunk/libhtml-formfu-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/Makefile.PL?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/Makefile.PL (original)
+++ trunk/libhtml-formfu-perl/Makefile.PL Fri May 13 18:20:48 2011
@@ -102,6 +102,7 @@
requires 'Locale::Maketext';
requires 'Module::Pluggable';
requires 'Moose' => '1.00'; # Reasonable default until we get test results
+requires 'Moose::Meta::Attribute::Custom::Trait::Chained';
requires 'MooseX::Aliases';
requires 'MooseX::ChainedAccessors::Accessor' => '0.02'; # for more recent Moose
requires 'MooseX::SetOnce';
@@ -130,7 +131,7 @@
# This fixes the problem of tar files having world-writable files,
# which causes PAUSE to choke
eval {
- use_ptar() if author_context && $^O =~/win/i;
+ use_ptar() if author_context && $^O =~/(?:ms|cyg)win/i;
};
if ($@) {
die "Module::Install::PerlTar must be installed when Makefile.PL is run by an author on MS Windows\n";
Modified: trunk/libhtml-formfu-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/changelog?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/changelog (original)
+++ trunk/libhtml-formfu-perl/debian/changelog Fri May 13 18:20:48 2011
@@ -1,3 +1,9 @@
+libhtml-formfu-perl (0.09003-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at debian.org> Fri, 13 May 2011 20:20:34 +0200
+
libhtml-formfu-perl (0.09002-1) unstable; urgency=low
* New upstream release.
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm Fri May 13 18:20:48 2011
@@ -141,7 +141,7 @@
*plugins = \&plugin;
*add_plugins = \&add_plugin;
-our $VERSION = '0.09002';
+our $VERSION = '0.09003';
$VERSION = eval $VERSION;
sub BUILD {
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint.pm?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint.pm Fri May 13 18:20:48 2011
@@ -2,7 +2,6 @@
use strict;
use base 'HTML::FormFu::Processor';
-use Class::C3;
use Moose;
extends 'HTML::FormFu::Processor';
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Deploy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Deploy.pm?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Deploy.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Deploy.pm Fri May 13 18:20:48 2011
@@ -105,6 +105,5 @@
return;
}
-__PACKAGE__->meta->make_immutable;
1;
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Manual/Cookbook.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Manual/Cookbook.pod?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Manual/Cookbook.pod (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Manual/Cookbook.pod Fri May 13 18:20:48 2011
@@ -412,6 +412,97 @@
If you would like the field to contain the filtered value, use
L<HTML::FormFu/render_processed_value>.
+=head2 Multiple forms using Catalyst::Controller::HTML::FormFu
+
+Sometimes you need to display multiple forms on a single page. If you
+try to use FormConfig on several actions in a chain, or similar, they
+all use C<< $c->stash->{form} >> to store the form, hence you only get the last
+form.
+
+One way to work around such problems is to do a little of the work yourself:
+
+In this example we have a login_form that we want on every page
+
+ # root/forms/login.yml:
+ ---
+ indicator: username
+ elements:
+ -
+ type: Text
+ name: username
+ constraints:
+ - Required
+ ...
+
+We also have an edit-form
+
+ # root/forms/foo/edit.yml
+ ---
+ indicator: foo
+ elements:
+ -
+ type: Text
+ name: foo
+ constraints:
+ - Required
+ ...
+
+In this example, we want the login form to appear on every page, so
+we load this in the top-most auto action:
+
+ package MyApp::Controller::Root;
+
+ BEGIN { extends 'Catalyst::Controller::HTML::FormFu'; }
+
+ sub auto : Private {
+ my ($self, $c) = @_;
+
+ # We want to utilize alot of the magic that the controller
+ # gives us, so therefore we call $self->form like this
+
+ my $login_form = $self->form;
+ $login_form->load_config_file('login.yml');
+
+ # Notice how we put it into another stash var, not 'form'
+ $c->stash->{login_form} = $login_form;
+ unless ($c->user_exists) {
+
+ $login_form->process();
+
+ if ($login_form->submitted_and_valid) {
+
+ # Since we set indicator, we should only end up here if we
+ # have a username in the form
+ $c->authenticate({
+ username => $login_form->param_value('username'),
+ password => $login_form->param_value('password'),
+ });
+ }
+
+ }
+ }
+
+
+Any other page that wants to load another form, can now do so freely:
+
+ package MyApp::Controller::Foo;
+
+ sub edit : Local FormConfig {
+ my ( $self, $c ) = @_;
+
+ my $form = $c->stash->{form};
+ if ($form->submitted_and_valid) {
+ # Do whatever you want with it :p
+ }
+ }
+
+In the view we now have two stash-variables:
+
+In F<root/foo/edit.tt>:
+ [% login_form %]
+ <h2>edit</h2>
+ [% form %]
+
=head1 ADVANCED CUSTOMISATION
=head2 Installing the TT templates
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm Fri May 13 18:20:48 2011
@@ -168,6 +168,7 @@
sub _escape_hash {
my $hash = shift;
my $method = shift || \&_escape_name;
+ return $hash unless(ref $hash);
foreach my $k (keys %$hash) {
my $v = delete $hash->{$k};
if(ref $v eq 'HASH') {
@@ -297,8 +298,6 @@
__PACKAGE__->meta->make_immutable;
-1;
-
__END__
=head1 NAME
Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Plugin.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Plugin.pm?rev=74339&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Plugin.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Plugin.pm Fri May 13 18:20:48 2011
@@ -58,6 +58,13 @@
For field plugins, is called during the field's C<process> call.
+=head2 pre_process
+
+For form plugins, is called immediately after C<pre_process>
+is run on the elements.
+
+For element plugins, is called before C<pre_process> is run on form plugins.
+
=head2 post_process
For form plugins, is called immediately before L<HTML::FormFu/process>
More information about the Pkg-perl-cvs-commits
mailing list