NAME

Reaction::UI::Controller

DESCRIPTION

Controller class used to make displaying collections easier. Inherits from Reaction::UI::Controller.

ATTRIBUTES

model_name

The name of the model this controller will use as it's data source. Should be a name that can be passed to $C->model

collection_name

The name of the collection whithin the model that this Controller will be utilizing.

action_viewport_map

_build_action_viewport_map - Provided builder method, see METHODS
has_action_viewport_map - Auto generated predicate
clear_action_viewport_map- Auto generated clearer method

Read-write lazy building hashref. The keys should match action names in the Controller and the value should be the ViewPort class that this action should use. See method basic_page for more info.

action_viewport_args

Read-write lazy building hashref. Additional ViewPort arguments for the action named as the key in the controller. See method basic_page for more info.

_build_action_viewport_args - Provided builder method, see METHODS
has_action_viewport_args - Auto generated predicate
clear_action_viewport_args- Auto generated clearer method

default_member_actions

Read-write lazy building arrayref. The names of the member actions (the actions that apply to each member of the collection and typically have an object as a target e.g. update,delete) to be enabled by default. By default, this is only 'view'

_build_default_member_actions - Provided builder method, see METHODS
has_default_member_actions - Auto generated predicate
clear_default_member_actions- Auto generated clearer method

default_collection_actions

Read-write lazy building arrayref. The names of the collection actions (the actions that apply to the entire collection and typically have a collection as a target e.g. create, delete_all) to be enabled by default. By default, this is only empty.

_build_default_member_actions - Provided builder method, see METHODS
has_default_member_actions - Auto generated predicate
clear_default_member_actions- Auto generated clearer method

METHODS

get_collection $c

Returns an instance of the collection this controller uses.

_build_action_viewport_map

Provided builder for action_viewport_map. Returns a hash containing:

list => 'Reaction::UI::ViewPort::Collection::Grid',
view => 'Reaction::UI::ViewPort::Object',

_build_action_viewport_args

By default will reurn a hashref containing action prototypes for all default member and collection actions. The prototype URI generators are generated by _build_member_action_prototype and _build_collection_action_prototype respectively and labels are the result of replacing underscores in the name with spaces and capitalizing the first letter. If you plan to use custom actions that are not supported by this scheme or you would like to customize the values it is suggested you wrap / override this method.

Default output for a controller having only 'view' enabled:

{ list => {
    action_prototypes => {},
    Member => {
      action_prototypes => {
        view => {label => 'View', uri => sub{...} },
      },
    },
  },
}

_build_member_action_prototype $label, $action_name

Creates an action prototype suitable for creating action links in Reaction::UI::ViewPort::Role::Actions. $action_name should be the name of a Catalyst action in this controller.The prototype will generate a URI based on the action, current captures.

_build_collection_action_prototype $label, $action_name

basic_page $c, \%vp_args

Accepts two arguments, context, and a hashref of viewport arguments. It will automatically determine the action name using the catalyst stack and call push_viewport with the ViewPort class name contained in the action_viewport_map with a set of options determined by merging $vp_args and the arguments contained in action_viewport_args, if any.

ACTIONS

base

Chain link, no-op.

list

Chain link, chained to base. list fetches the collection for the model and calls basic_page with a single argument, collection.

The default ViewPort for this action is Reaction::UI::ViewPort::ListView and can be changed by altering the action_viewport_map attribute hash.

object

Chain link, chained to base, captures one argument, 'id'. Attempts to find a single object by searching for a member of the current collection which has a Primary Key or Unique constraint matching that argument. If the object is found it is stored in the stash under the object key.

view

Chain link, chained to object. Calls basic page with one argument, model, which contains an instance of the object fetched by the object action link.

The default ViewPort for this action is Reaction::UI::ViewPort::Object and can be changed by altering the action_viewport_map attribute hash.

SEE ALSO

Reaction::UI::Controller

AUTHORS

See Reaction::Class for authors.

LICENSE

See Reaction::Class for the license.