[Jifty-commit] r1305 - in jifty/trunk: . doc/talks/npw.2006/Blog
doc/talks/npw.2006/Blog/lib/Blog
doc/talks/npw.2006/Blog/lib/Blog/Model share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jun 15 15:17:36 EDT 2006
Author: alexmv
Date: Thu Jun 15 15:17:35 2006
New Revision: 1305
Removed:
jifty/trunk/doc/talks/npw.2006/Blog/blog
Modified:
jifty/trunk/ (props changed)
jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Dispatcher.pm
jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Model/Entry.pm
jifty/trunk/lib/Jifty/Action/Record.pm
jifty/trunk/share/web/static/js/jifty.js
Log:
r13981 at zoq-fot-pik: chmrr | 2006-06-15 16:03:44 -0400
* Add moniker to CreateEntry in blog
* Perltidy Entry model
* Simplify Jifty::Action::Record (we only need to look at the
column's validator)
* We might need to ajax validate textareas, too
Modified: jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Dispatcher.pm
==============================================================================
--- jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Dispatcher.pm (original)
+++ jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Dispatcher.pm Thu Jun 15 15:17:35 2006
@@ -15,7 +15,8 @@
};
on '/new_entry' => run {
set create => Jifty->web->new_action(
- class => 'CreateEntry'
+ class => 'CreateEntry',
+ moniker => 'new_entry',
);
};
Modified: jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Model/Entry.pm
==============================================================================
--- jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Model/Entry.pm (original)
+++ jifty/trunk/doc/talks/npw.2006/Blog/lib/Blog/Model/Entry.pm Thu Jun 15 15:17:35 2006
@@ -7,37 +7,36 @@
# Your column definitions go here. See L<Jifty::DBI::Schema> for
# documentation about how to write column definitions.
-column title =>
- type is 'text',
- default is 'Untitled';
-
-column body =>
- type is 'text',
- render_as 'Textarea';
+column
+ title => type is 'text',
+ default is 'Untitled';
+
+column
+ body => type is 'text',
+ render_as 'Textarea';
package Blog::Model::Entry;
use base qw/Blog::Record/;
# Your model-specific methods go here.
- use Regexp::Common 'profanity_us';
- sub canonicalize_body {
+use Regexp::Common 'profanity_us';
+
+sub canonicalize_body {
my $self = shift;
my $body = shift;
$body =~ s/$RE{profanity}/**expletives**/gi;
return $body;
- }
+}
- sub validate_body {
+sub validate_body {
my $self = shift;
my $body = shift;
- if ( $body =~ /$RE{profanity}/i) {
- return (0, 'Would you speak like that in front of your mother? *cough*'
- )
+ if ( $body =~ /$RE{profanity}/i ) {
+ return ( 0,
+ 'Would you speak like that in front of your mother? *cough*' );
}
- return (1, "OK");
- }
-
+ return ( 1, "OK" );
+}
1;
-
Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm Thu Jun 15 15:17:35 2006
@@ -187,24 +187,14 @@
# and we're not overriding it at the action level
my $validate_method = "validate_" . $field;
- if (( $column->validator || $self->record->can($validate_method)
- )
- and not $self->can($validate_method)
- )
- {
+ if ( $column->validator and not $self->can($validate_method) ) {
$info->{ajax_validates} = 1;
$info->{validator} = sub {
my $self = shift;
my $value = shift;
- my ( $is_valid, $message );
- if ( $self->record->can($validate_method) ) {
- ( $is_valid, $message )
- = $self->record->$validate_method($value);
- } else {
- ( $is_valid, $message )
- = &{ $column->validator }( $self->record,
- $value );
- }
+ my ( $is_valid, $message )
+ = &{ $column->validator }( $self->record, $value );
+
if ($is_valid) {
return $self->validation_ok($field);
} else {
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Thu Jun 15 15:17:35 2006
@@ -352,7 +352,7 @@
// Form elements should AJAX validate if the CSS says so
Behaviour.register({
- 'input.ajaxvalidation': function(elt) {
+ '.ajaxvalidation': function(elt) {
elt.onblur = function () {
Form.Element.validate(this);
}
More information about the Jifty-commit
mailing list