https://github.com/throughnothing/dancer-plugin-datafu
Dancer HTML Form and Grid/Table engine with Input Validation
https://github.com/throughnothing/dancer-plugin-datafu
Last synced: 10 months ago
JSON representation
Dancer HTML Form and Grid/Table engine with Input Validation
- Host: GitHub
- URL: https://github.com/throughnothing/dancer-plugin-datafu
- Owner: throughnothing
- Created: 2011-10-25T18:22:19.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-11-03T18:36:20.000Z (over 15 years ago)
- Last Synced: 2025-03-29T22:28:51.055Z (about 1 year ago)
- Language: Perl
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
Dancer-Plugin-DataFu - Dancer HTML Form and Grid/Table engine with Input Validation
use Dancer qw/:syntax/;
use Dancer::Plugin::DataFu;
# form rendering and validation
get 'login' => sub {
return form->render('form_name', '/action', 'profile.field', 'profile.field');
# return form->render('login', '/submit_login', 'user.login', 'user.password');
};
post 'login' => sub {
my $input = form;
return redirect '/dashboard' if $input->validate('user.login', 'user.password');
redirect '/login';
};
# grid rendering
# Important Note! The order arguments are received by the render function
# has now changed. Please examine.
get '/user_list' => sub {
return grid->render('table_name', 'profile_name', $dataset);
# $dataset is an array of hashes
};
# grid rendering with Dancer::Plugin::DBIC
get '/user_list' => sub {
my $rs = schema->resultset('Foo');
$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
return grid->render('table_name', 'profile_name', [$rs->all]);
};
To install this module using code from CPAN,
run the following commands
cpan Dancer::Plugin::DataFu
or
perl Makefile.PL
make
make test
make install
To install this module using code from the git repository,
run the following commands (Dist::Zilla required):
dzil build
cd Dancer-Plugin-DataFu-#.##
cpan .
REPOSITORY
http://github.com/alnewkirk/Dancer-Plugin-DataFu/
COPYRIGHT AND LICENCE
Copyright (C) 2010 Al Newkirk
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.