[Jifty-commit] r6748 - jifty/trunk/lib/Jifty/Action/Record
Jifty commits
jifty-commit at lists.jifty.org
Thu Apr 9 18:37:59 EDT 2009
Author: alexmv
Date: Thu Apr 9 18:37:58 2009
New Revision: 6748
Modified:
jifty/trunk/lib/Jifty/Action/Record/Bulk.pm
Log:
Document Jifty::Action::Record::Bulk
Modified: jifty/trunk/lib/Jifty/Action/Record/Bulk.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Bulk.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record/Bulk.pm Thu Apr 9 18:37:58 2009
@@ -18,8 +18,6 @@
__PACKAGE__->add_action('MyApp::Action::DeleteFoo' => { trigger => 'delete', final => 1 });
__PACKAGE__->add_action('MyApp::Action::UpdateFoo');
-=head1 DESCRIPTION
-
=cut
use base qw/Jifty::Action::Record Class::Data::Inheritable/;
@@ -29,6 +27,31 @@
use constant ids_name => 'ids';
+=head1 METHODS
+
+=head2 add_action CLASS [, OPTIONS]
+
+Merges the given action class into this one. Will C<die> if the
+L<Jifty::Action::Record/action_class> of the given C<CLASS> doesn't
+match previously added classes.
+
+OPTIONS should be a hash reference of additional options. The
+existing options are:
+
+=over
+
+=item trigger
+
+Only run if this argument is provided
+
+=item final
+
+If this action runs, run B<only> this action.
+
+=back
+
+=cut
+
sub add_action {
my ($class, $name, $param) = @_;
push @{$class->actions}, [ $name, $param ];
@@ -42,6 +65,14 @@
}
}
+=head2 arguments
+
+Merges together arguments from all of the actions added with
+L</add_action>. The record IDs to act on are stored (comma-separated)
+in an argument named C<ids>, by default.
+
+=cut
+
sub arguments {
my $self = shift;
my $arguments = { $self->ids_name => { render_as => 'text', sort_order => -999 } };
@@ -63,6 +94,13 @@
return $arguments;
}
+=head2 perform_action CLASS, IDS
+
+Performs the given action C<CLASS> on the given record C<ID>s, which
+should be an array reference.
+
+=cut
+
sub perform_action {
my ($self, $action_class, $ids) = @_;
$self->result->content('detailed_messages', {})
@@ -83,6 +121,12 @@
# allow bulk action to define if they allow individual action to fail
}
+=head2 take_action
+
+Completes the actions on all of the IDs given.
+
+=cut
+
sub take_action {
my $self = shift;
my $ids = $self->argument_value('ids');
@@ -102,6 +146,12 @@
}
}
+=head2 report_success
+
+Reports C<Bulk update successful>.
+
+=cut
+
sub report_success {
my $self = shift;
$self->result->message(_("Bulk update successful"));
More information about the Jifty-commit
mailing list