[Jifty-commit] r509 - jifty/trunk/lib/Jifty/Web/Form
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Jan 15 13:54:42 EST 2006
Author: autrijus
Date: Sun Jan 15 13:54:41 2006
New Revision: 509
Modified:
jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
jifty/trunk/lib/Jifty/Web/Form/Element.pm
jifty/trunk/lib/Jifty/Web/Form/Link.pm
Log:
* Add "tooltip" field to form elements (maps to HTML "title" attribute).
Modified: jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Clickable.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Clickable.pm Sun Jan 15 13:54:41 2006
@@ -25,10 +25,10 @@
sub accessors {
shift->SUPER::accessors,
- qw(url escape_label continuation call returns submit preserve_state);
+ qw(url escape_label tooltip continuation call returns submit preserve_state);
}
__PACKAGE__->mk_accessors(
- qw(url escape_label continuation call returns submit preserve_state)
+ qw(url escape_label tooltip continuation call returns submit preserve_state)
);
=head2 new PARAMHASH
@@ -48,10 +48,14 @@
The text on the clickable object.
+=item tooltip
+
+Additional information about the link target.
+
=item escape_label
-If set to true, HTML escapes the content of the label before
-displaying it. This is only relevant for objects that are rendered as
+If set to true, HTML escapes the content of the label and tooltip before
+displaying them. This is only relevant for objects that are rendered as
HTML links. The default is true.
=item continuation
@@ -102,6 +106,7 @@
my %args = (
url => $root,
label => 'Click me!',
+ tooltip => '',
class => '',
escape_label => 1,
continuation => Jifty->web->request->continuation,
Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Element.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Element.pm Sun Jan 15 13:54:41 2006
@@ -63,8 +63,8 @@
=cut
-sub accessors { shift->handlers, qw(class key_binding id label) }
-__PACKAGE__->mk_accessors(qw(onclick class key_binding id label ));
+sub accessors { shift->handlers, qw(class key_binding id label tooltip) }
+__PACKAGE__->mk_accessors(qw(onclick class key_binding id label tooltip));
=head2 javascript
Modified: jifty/trunk/lib/Jifty/Web/Form/Link.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Link.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Link.pm Sun Jan 15 13:54:41 2006
@@ -25,8 +25,8 @@
=cut
-sub accessors { shift->SUPER::accessors(), qw(url escape_label); }
-__PACKAGE__->mk_accessors(qw(url escape_label));
+sub accessors { shift->SUPER::accessors(), qw(url escape_label tooltip); }
+__PACKAGE__->mk_accessors(qw(url escape_label tooltip));
=head2 new PARAMHASH
@@ -39,9 +39,13 @@
The URL of the link; defaults to the current URL.
+=item tooltip
+
+Additional information about the link target.
+
=item escape_label
-HTML escape the label? Defaults to true
+HTML escape the label and tooltip? Defaults to true
=item anything from L<Jifty::Web::Form::Element>
@@ -58,6 +62,7 @@
my %args = (
url => $ENV{PATH_INFO},
label => "Click me!",
+ tooltip => undef,
escape_label => 1,
class => '',
@_
@@ -89,9 +94,14 @@
$label = Jifty->web->mason->interp->apply_escapes( $label, 'h' )
if ( $self->escape_label );
+ my $tooltip = $self->tooltip;
+ $tooltip = Jifty->web->mason->interp->apply_escapes( $tooltip, 'h' )
+ if ( $tooltip and $self->escape_label );
+
Jifty->web->out(qq(<a));
Jifty->web->out(qq( id="@{[$self->id]}")) if $self->id;
Jifty->web->out(qq( class="@{[$self->class]}")) if $self->class;
+ Jifty->web->out(qq( title="@{[$self->tooltip]}")) if $tooltip;
Jifty->web->out(qq( href="@{[$self->url]}"));
Jifty->web->out( $self->javascript() );
Jifty->web->out(qq(>@{[$label]}</a>));
More information about the Jifty-commit
mailing list