POD FTW
[catagits/Reaction.git] / lib / Reaction / UI / Controller / Collection.pm
index 204edd9..e28fbdf 100644 (file)
@@ -34,7 +34,7 @@ sub _build_action_viewport_map {
   my $self = shift;
   my %map;
   $map{list} = Grid;
-  $map{view} = Object if grep {$_ eq 'view'} @{$self->default_member_actions};
+  $map{view} = Object; #if grep {$_ eq 'view'} @{$self->default_member_actions};
   return \%map;
 }
 
@@ -184,6 +184,40 @@ named as the key in the controller.  See method C<basic_page> for more info.
 
 =back
 
+=head2 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'
+
+=over 4
+
+=item B<_build_defualt_member_actions - Provided builder method, see METHODS
+
+=item B<has_default_member_actions> - Auto generated predicate
+
+=item B<clear_default_member_actions>- Auto generated clearer method
+
+=back
+
+=head2 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.
+
+=over 4
+
+=item B<_build_defualt_member_actions - Provided builder method, see METHODS
+
+=item B<has_default_member_actions> - Auto generated predicate
+
+=item B<clear_default_member_actions>- Auto generated clearer method
+
+=back
+
 =head1 METHODS
 
 =head2 get_collection $c
@@ -192,14 +226,41 @@ Returns an instance of the collection this controller uses.
 
 =head2 _build_action_viewport_map
 
-Provided builder for C<action_viewport_map>. Returns a hash with two items:
+Provided builder for C<action_viewport_map>. Returns a hash containing:
 
-    list => 'Reaction::UI::ViewPort::ListView',
+    list => 'Reaction::UI::ViewPort::Collection::Grid',
     view => 'Reaction::UI::ViewPort::Object',
 
 =head2 _build_action_viewport_args
 
-Returns an empty hashref.
+By default will reurn a hashref containing action prototypes for all default
+member and collection actions. The prototype URI generators are generated by
+C<_build_member_action_prototype> and C<_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{...} },
+          },
+        },
+      },
+    }
+
+=head2 _build_member_action_prototype $label, $action_name
+
+Creates an action prototype suitable for creating action links in
+L<Reaction::UI::ViewPort::Role::Actions>. C<$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.
+
+=head2 _build_collection_action_prototype $label, $action_name
 
 =head2 basic_page $c, \%vp_args