GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Jifty::Action::Record::Execute(3) User Contributed Perl Documentation Jifty::Action::Record::Execute(3)

Jifty::Action::Record::Execute - Simple abstract based for record actions

  use strict;
  use warnings;

  package MyApp::Action::StartEncabulator;
  use base qw/ MyApp::Action::ExecuteEncabulator /;

  use Jifty::Param::Schema;
  use Jifty::Action schema {
      param cardinal_grammeter_mode =>
          type is 'text',
          valid_values are qw/
              magneto-reluctance
              capacitive-duractance
              sinusoidal-depleneration
          /,
          is mandatory,
          ;
  }; 

  sub take_action {
      my $self = shift;

      my $mode = $self->argument_value('cardinal_grammeter_mode');
      $self->record->start($mode);

      $self->result->success('Deluxe Encabulator has started!');
  }

  # Later in your templates:
  my $encabulator = MyApp::Model::Encabulator->new;
  $encabulator->load($id);

  my $startup = Jifty->web->new_action( 
      class  => 'StartEncabulator',
      record => $encabulator,
  );

  Jifty->web->form->start;

  Jifty->web->out( $startup->form_field('cardinal_grammeter_mode') );

  Jifty->web->form->submit(
      label  => _('Start'),
      submit => $startup,
  );

  Jifty->web->form->end;

This action class is a good generic basis for creating custom action classes. It expects a record object to be associated and is (in this way) very similar to Jifty::Action::Record::Delete.

You can use Jifty::Param::Schema to add additional form fields to the action and such.

This is customized so that it expects the "record" argument of all Jifty::Action::Record actions, but also allows for overrides using Jifty::Param::Schema.

This overrides the definition in Jifty::Action::Record so that it does absolutely nothing rather than complain. You will probably want to implement your own version that actually does something.

Jifty::Action, Jifty::Action::Record, Jifty::Record

Jifty is Copyright 2005-2010 Best Practical Solutions, LLC. Jifty is distributed under the same terms as Perl itself.
2013-01-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.