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
Reaction::UI::ViewPort::Role::Actions(3) User Contributed Perl Documentation Reaction::UI::ViewPort::Role::Actions(3)

Reaction::UI::ViewPort::Role::Actions

A role to ease attaching actions to Reaction::InterfaceModel::Objects

Read-only, lazy-building ArrayRef of URI objects pointing to actions.

A HashRef of prototypes for building the Action links. The prototypes should be composed like these:

    my %action_prototypes = (
      example_action => { label => 'Example Action', uri => $uri_obj },
    );

    #or you can get fancy and do something like what is below:
    sub make_label{
      my($im, $ctx) =  @_; #InterfaceModel::Object/Collection, Catalyst Context
      return 'label_text';
    }
    sub make_uri{
      my($im, $ctx) =  @_; #InterfaceModel::Object/Collection, Catalyst Context
      return return $ctx->uri_for('some_action');
    }
    my %action_prototypes = (
      example_action => { label => \&make_label, uri => \&make_uri },
    );

User-provided ArrayRef with how the actions should be ordered eg

     action_order => [qw/view edit delete/]

Read-only lazy-building ARRAY ref. The final computed action order. This may differ from the "action_order" provided if you any actions were not included in that list.

Cycle through the "computed_action_order" and create a new ViewPort::URI object for each action using the provided prototypes.

Compute the final action ordering by using the provided "action_order" as a spec to order all the present actions (the keys of "action_prototypes")

Action prototypes are simply hashrefs that must contain a "uri" key and may contain a "label" key. The label can be anything that the display attribute of ViewPort::URI will accept, usually a scalar or a ViewPort. The value for "uri" may be either a scalar, a URI object (or anything that "ISA URI").

Additionally, both "label" and "uri" can be CODE refs. In this case, the code will be executed at "_build_actions" time and will recieve two arguments, the value returned by "model" and the value returned by "ctx" in that order. Both of these methods should be implemented in the consuming class. By convention, model refers to the target of the action, an "InterfaceModel::Object" in the case of a member action and an "InterfaceModel::Collection" in the case of a Collection action. "ctx" should be the current Catalyst context.

See Reaction::Class for authors.

See Reaction::Class for the license.
2010-10-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.