[Jifty-commit] r3482 - in jifty/trunk: lib/Jifty lib/Jifty/View
lib/Jifty/View/Declare
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jun 14 10:49:09 EDT 2007
Author: sterling
Date: Thu Jun 14 10:49:08 2007
New Revision: 3482
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/View.pm
jifty/trunk/lib/Jifty/View/Declare.pm
jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm
jifty/trunk/lib/Jifty/View/Declare/CRUD.pm
Log:
r7618 at dynpc145: andrew | 2007-06-14 09:42:56 -0500
Cleaning up and improving some of the view documentation.
Modified: jifty/trunk/lib/Jifty/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View.pm (original)
+++ jifty/trunk/lib/Jifty/View.pm Thu Jun 14 10:49:08 2007
@@ -2,6 +2,16 @@
use strict;
use warnings;
+=head1 NAME
+
+Jifty::View - Base class for view modules
+
+=head1 DESCRIPTION
+
+This is the base class for L<Jifty::View::Declare> and L<Jifty::View::Mason::Handler>, which are the two view plugins shipped with Jifty. Other view plugins can be built by extending this class.
+
+=head1 METHODS
+
=head2 auto_send_headers
Doesn't send headers if this is a subrequest (according to the current
@@ -42,5 +52,17 @@
}
}
+=head1 SEE ALSO
+
+L<Jifty::View::Declare>, L<Jifty::View::Declare::BaseClass>, L<Jifty::View::Mason::Handler>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
+
+=cut
+
+
1;
Modified: jifty/trunk/lib/Jifty/View/Declare.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare.pm Thu Jun 14 10:49:08 2007
@@ -5,6 +5,10 @@
use warnings;
use constant BaseClass => 'Jifty::View::Declare::BaseClass';
+=head1 NAME
+
+Jifty::View::Declare - Build views using Template::Declare
+
=head1 SYNOPSIS
package MyApp::View;
@@ -15,6 +19,19 @@
b { "The Index" };
};
+=head1 DESCRIPTION
+
+L<Template::Declare> is a templating system using a declarative syntax built on top of Perl. This provides a templating language built in a similar style to the dispatcher language in L<Jifty::Dispatcher>, the model language in L<Jifty::DBI::Schema>, and the action language in L<Jifty::Param::Schema>.
+
+To use this view system, you must declare a class named C<MyApp::View> (where I<MyApp> is the name of your Jifyt application). Use this library class to bring in all the details needed to make it work:
+
+ package MyApp::View;
+ use Jifty::View::Declare -base;
+
+ # Your code...
+
+For more details on how to write the individual templates, see L<Template::Declare> and also L<Jifty::View::Declare::Helpers> for Jifty specific details.
+
=cut
sub import {
@@ -29,4 +46,15 @@
goto &{BaseClass()->can('import')};
}
+=head1 SEE ALSO
+
+L<Jifty::View::Declare::Helpers>, L<Template::Declare>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distrib uted under the same terms as Perl itself.
+
+=cut
+
1;
Modified: jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm Thu Jun 14 10:49:08 2007
@@ -12,6 +12,21 @@
our @EXPORT = ( @Jifty::View::Declare::Helpers::EXPORT);
+=head1 NAME
+
+Jifty::View::Declare::BaseClass - Base class for Template::Declare views
+
+=head1 DESCRIPTION
+
+This class provides a base class for your L<Template::Declare> derived view classes.
+
+=head1 METHODS
+
+=head2 use_mason_wrapper
+
+Call this function in your view class to use your mason wrapper for L<Template::Declare> templates.
+
+=cut
sub use_mason_wrapper {
my $class = shift;
@@ -39,33 +54,20 @@
}
}
-=cut
-
-
-
-1;
-__DATA__
-
-=head1 NAME
-
-Jifty::View::Declare::BaseClass
-
-=head1 DESCRIPTION
-
-This class provides a baseclass for your C<Template::Declare> derived view classes.
-
-=head1 METHODS
-
-=head2 use_mason_wrapper
+=head2 show templatename arguments
-Call this function in your viewclass to use your mason wrapper for TD templates.
+Render a C<Template::Declare> template.
+=head1 SEE ALSO
-=head2 show templatename arguments
+L<Template::Declare>, L<Jifty::View::Declare::Helpers>, L<Jifty::View::Declare>
-Render a C<Template::Declare> template.
+=head1 LICENSE
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl itself.
=cut
+1;
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 10:49:08 2007
@@ -6,6 +6,18 @@
use base 'Exporter';
our @EXPORT = qw(object_type fragment_for get_record current_collection);
+=head1 NAME
+
+Jifty::View::Declare::CRUD - Provides typical CRUD views to a model
+
+=head1 DESCRIPTION
+
+This class provides a set of views that may be used by a model to display Create/Read/Update/Delete views using the L<Template::Declare> templating langauge.
+
+=head1 METHODS
+
+=cut
+
sub mount_view {
my ($class, $model, $vclass, $path) = @_;
my $caller = caller(0);
@@ -53,6 +65,14 @@
return $record;
}
+=head1 TEMPLATES
+
+=head2 search
+
+The search view displays a search screen connected to the search action of the module. See L<Jifty::Action::Record::Search>.
+
+=cut
+
template 'search' => sub {
my $self = shift;
my ($object_type) = ( $self->object_type );
@@ -84,6 +104,11 @@
return grep { !( m/_confirm/ || lc $action->arguments->{$_}{render_as} eq 'password' ) } $action->argument_names;
}
+=head2 view
+
+This template displays the data held by a single model record.
+
+=cut
template 'view' => sub {
my $self = shift;
@@ -112,6 +137,12 @@
};
+=head2 update
+
+The update template displays a form for editing the data held within a single model record. See L<Jifty::Action::Record::Update>.
+
+=cut
+
template 'update' => sub {
my $self = shift;
my ( $object_type, $id ) = ( $self->object_type, get('id') );
@@ -174,6 +205,12 @@
return $collection;
}
+=head2 list
+
+The list template provides an interactive list for showing a list of records in the record collection, adding new records, deleting records, and updating records.
+
+=cut
+
template 'list' => sub {
my $self = shift;
@@ -212,6 +249,7 @@
outs( $search_region->render );
};
+
private template 'new_item_region' => sub {
my $self = shift;
my $fragment_for_new_item = shift;
@@ -300,6 +338,11 @@
render_action($action, [$self->display_columns($action)]);
};
+=head1 new_item
+
+The new_item template provides a form for creating new model records. See L<Jifty::Action::Record::Create>.
+
+=cut
template 'new_item' => sub {
my $self = shift;
@@ -333,5 +376,16 @@
}
};
+=head1 SEE ALSO
+
+L<Jifty::Action::Record::Create>, L<Jifty::Action::Record::Search>, L<Jifty::Action::Record::Update>, L<Jifty::Action::Record::Delete>, L<Template::Declare>, L<Jifty::View::Declare::Helpers>, L<Jifty::View::Declare>
+
+=head1 LICENSE
+
+Jifty is Copyright 2005-2007 Best Practical Solutions, LLC.
+Jifty is distributed under the same terms as Perl tiself.
+
+=cut
+
1;
More information about the Jifty-commit
mailing list