[Jifty-commit] r2242 - jifty/trunk/lib/Jifty/Manual
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Dec 1 00:56:33 EST 2006
Author: agentz
Date: Fri Dec 1 00:56:32 2006
New Revision: 2242
Modified:
jifty/trunk/lib/Jifty/Manual/Cookbook.pod
Log:
[Manual/Cookbook.pod]
- typo fixes
- code cleanup
Modified: jifty/trunk/lib/Jifty/Manual/Cookbook.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Cookbook.pod (original)
+++ jifty/trunk/lib/Jifty/Manual/Cookbook.pod Fri Dec 1 00:56:32 2006
@@ -38,12 +38,12 @@
$feed_entry->link( Jifty->web->url . "/posts/" . $post->id );
$feed_entry->issued( $post->created_on );
$feed_entry->summary( $post->body );
- $feed->add_entry($feed_entry);
+ $feed->add_entry( $feed_entry );
}
</%init>
- <% $feed->as_xml |n%>
+ <% $feed->as_xml |n %>
-And add this in C<MyApp/Dispatcher.pm> to make URI look prettier:
+And add this in F<MyApp/Dispatcher.pm> to make URI look prettier:
on qr{^/feed/(atom|rss|rss2)}, run {
set type => $1;
@@ -99,7 +99,7 @@
the easiest one.
If you're using the newly recommeded C<JIfty::DBI::Record schema {}>
-to declare schema, you might find this trick not working at the moment.
+to declare schemas, you might find this trick not working at the moment.
Please override model's C<before_create> method instead:
sub before_create {
@@ -138,9 +138,9 @@
=head2 Run my Jifty app as fascgi in Apache/Lighttpd ?
Jifty provides a really simple way to run the application as a fastcgi
-server. The complete instruction and example is in C<'jifty help
-fastcgi'> for both Apache server and Lighttpd server. (Please cd to
-your app dir before run this command.)
+server. The complete instructions and examples are in C<'jifty help
+fastcgi'> for both Apache servers and Lighttpd servers. (Please C<cd> to
+your app dir before running this command.)
You'll have to install C<CGI::Fast> and C<FCGI> module for this.
@@ -160,7 +160,7 @@
=head2 Pass HTML form input directly to components
-Sometimes, you don't want to take an action based on input from HTML
+Sometimes you don't want to take an action based on input from HTML
forms, but just want to change how the page is displayed, or do
something similarly transient.
@@ -180,38 +180,38 @@
jifty schema --setup
-Jifty would inspect current database and perform proper actions.
-You could give a C<--print> option to see the actual SQL statement:
+Jifty would inspect the current database and perform proper actions.
+You could give a C<--print> option to see the actual SQL statements:
jifty schema --setup --print
=head2 Use different table names than the ones Jifty automatically creates
-In YourApp::Record define a _guess_table_name sub that doesn't
-pluralises or pluralises differently.
+In YourApp::Record, define a C<_guess_table_name> sub that doesn't
+pluralise or pluralises differently.
=head2 How do I perform ajax canonicalization on a given field ?
Asking user to input something in a form is really common in a web
app. For some certain form fields you want them to have a certain
-normalized/canonicalized form in database, and you could do an ajax
-canonicalization in Jifty very easily. Lets say your User model need a
+normalized/canonicalized form in the database, and you could do an ajax
+canonicalization in Jifty very easily. Let's say your User model needs a
canonicalized C<username> field to make sure those names are in
lowercase. All you have to do is to define a method named
-C<canonicalize_username> your Model class, like this:
+C<canonicalize_username> in your Model class, like this:
package MyApp::Model::User;
use base qw(MyApp::Record);
sub canonicalize_username {
my $class = shift;
- my $value = shift
+ my $value = shift;
return lc($value);
}
-If the form is generated by a C<Jifty::Action::Record> -based action
+If the form is generated by a C<Jifty::Action::Record>-based action
(all those autogenerated CRUD actions), then this is all you need to
do. And that is probably 90% of the case. C<Jifty::Action::Record>
would check if there is a method named like C<canonicalize_fieldname>
@@ -220,6 +220,7 @@
it for you.
The ajax canonicalization happens when the input focus leaves that
-field. You would see the effect a bit latter that the value in the
+field. You would see the effect a bit later than the value in the
field is changed.
+Of course, you can apply the same trick to your own Action classes.
More information about the Jifty-commit
mailing list