[Jifty-commit] r3496 - in jifty/trunk: lib/Jifty/View/Declare
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jun 14 20:18:16 EDT 2007
Author: jesse
Date: Thu Jun 14 20:18:13 2007
New Revision: 3496
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
Log:
r58374 at pinglin: jesse | 2007-06-14 20:17:33 -0400
* Full doc for the existing CRUD templates
Modified: jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/CRUD.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/CRUD.pm Thu Jun 14 20:18:13 2007
@@ -18,6 +18,11 @@
=cut
+
+=head2 mount_view MODELCASS VIEWCLASS /path
+
+=cut
+
sub mount_view {
my ($class, $model, $vclass, $path) = @_;
my $caller = caller(0);
@@ -33,11 +38,21 @@
*{$vclass."::object_type"} = sub { $model };
}
+
+=head2 object_type
+
+=cut
+
sub object_type {
my $self = shift;
return $self->package_variable('object_type') || get('object_type');
}
+
+=head2 fragment_for
+
+=cut
+
sub fragment_for {
my $self = shift;
my $fragment = shift;
@@ -50,11 +65,19 @@
|| $self->fragment_base_path . "/" . $fragment;
}
+=sub fragment_base_path
+
+=cut
+
sub fragment_base_path {
my $self = shift;
return $self->package_variable('base_path') || '/crud';
}
+=sub get_record
+
+=cut
+
sub get_record {
my ( $self, $id ) = @_;
@@ -65,6 +88,19 @@
return $record;
}
+=head2 display_columns
+
+Returns a list of all the columns that this REST view should display
+
+=cut
+
+sub display_columns {
+ my $self = shift;
+ my $action = shift;
+ return grep { !( m/_confirm/ || lc $action->arguments->{$_}{render_as} eq 'password' ) } $action->argument_names;
+}
+
+
=head1 TEMPLATES
=head2 search
@@ -98,11 +134,6 @@
}
};
-sub display_columns {
- my $self = shift;
- my $action = shift;
- return grep { !( m/_confirm/ || lc $action->arguments->{$_}{render_as} eq 'password' ) } $action->argument_names;
-}
=head2 view
@@ -227,6 +258,13 @@
};
+
+=head2 search_region
+
+This I<private> template renders a region to show an expandable region for a search widget.
+
+=cut
+
private template 'search_region' => sub {
my $self = shift;
my $object_type = $self->object_type;
@@ -250,6 +288,13 @@
outs( $search_region->render );
};
+=head2 new_item_region
+
+This I<private> template renders a region to show a the C<new_item> template.
+
+=cut
+
+
private template 'new_item_region' => sub {
my $self = shift;
my $fragment_for_new_item = shift;
@@ -264,6 +309,15 @@
}
};
+
+=head2 list_items $collection $item_path
+
+Renders a div of class list with a region per item.
+
+
+
+=cut
+
private template 'list_items' => sub {
my $self = shift;
my $collection = shift;
@@ -286,6 +340,14 @@
};
+
+=head2 paging_top $collection $page_number
+
+Paging for your list, rendered at the top of the list
+
+=cut
+
+
private template 'paging_top' => sub {
my $self = shift;
my $collection = shift;
@@ -301,6 +363,12 @@
};
+=head2 paging_bottom $collection $page_number
+
+Paging for your list, rendered at the bottom of the list
+
+=cut
+
private template paging_bottom => sub {
my $self = shift;
my $collection = shift;
@@ -332,6 +400,15 @@
};
+
+=head2 edit_item $action
+
+Renders the action $Action, handing it the array ref returned by L</display_columns>.
+
+=cut
+
+
+
private template 'edit_item' => sub {
my $self = shift;
my $action = shift;
More information about the Jifty-commit
mailing list