[Jifty-commit] r4124 - in jifty/trunk: lib/Jifty/Web/Form
lib/Jifty/Web/Form/Field
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Sep 17 14:27:30 EDT 2007
Author: sartak
Date: Mon Sep 17 14:27:25 2007
New Revision: 4124
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web/Form/Element.pm
jifty/trunk/lib/Jifty/Web/Form/Field.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Collection.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Combobox.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Radio.pm
jifty/trunk/lib/Jifty/Web/Form/Field/ResetButton.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Select.pm
jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm
Log:
r42755 at onn: sartak | 2007-09-17 14:26:59 -0400
Add support for "title" attribute on elements, which shows tooltips
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 Mon Sep 17 14:27:25 2007
@@ -160,11 +160,11 @@
=cut
-sub accessors { shift->handlers, qw(class key_binding key_binding_label id label tooltip continuation) }
+sub accessors { shift->handlers, qw(class title key_binding key_binding_label id label tooltip continuation) }
__PACKAGE__->mk_accessors(qw(_onclick _onchange _ondblclick _onmousedown _onmouseup _onmouseover
_onmousemove _onmouseout _onfocus _onblur _onkeypress _onkeydown
_onkeyup _onselect
- class key_binding key_binding_label id label tooltip continuation));
+ class title key_binding key_binding_label id label tooltip continuation));
=head2 new PARAMHASH OVERRIDE
@@ -562,6 +562,10 @@
Sets the CSS class that the element will display as
+=head2 title
+
+Sets the title that the element will display, e.g. for tooltips
+
=head2 key_binding
Sets the key binding associated with this element
Modified: jifty/trunk/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field.pm Mon Sep 17 14:27:25 2007
@@ -487,6 +487,7 @@
my $field = qq! <input !;
$field .= qq! type="@{[ $self->type ]}"!;
$field .= qq! name="@{[ $self->input_name ]}"! if ($self->input_name);
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! id="@{[ $self->element_id ]}"!;
$field .= qq! value="@{[Jifty->web->escape($self->current_value)]}"! if defined $self->current_value;
$field .= $self->_widget_class;
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm Mon Sep 17 14:27:25 2007
@@ -43,6 +43,7 @@
'type="submit"',
'name="' . $self->input_name . '" ',
'value="' . Jifty->web->escape(_($self->label )). '"',
+ ($self->title ? qq( title="@{[$self->title]}") : ''),
'id="'. Jifty->web->serial . '"',
($self->key_binding ? qq( accesskey="@{[$self->key_binding]}") : ''),
$self->_widget_class('button', ($self->button_as_link ? ("button_as_link") : ())),
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm Mon Sep 17 14:27:25 2007
@@ -34,6 +34,7 @@
$field .= qq!<input!;
$field .= qq! type="checkbox"!;
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! name="@{[ $self->input_name ]}"!;
$field .= qq! id="@{[ $self->element_id ]}"!;
$field .= qq! value="@{[$self->value ||1]}"!;
@@ -57,6 +58,7 @@
my $self = shift;
my $field .= qq!<input type="checkbox"!;
$field .= qq! name="@{[ $self->input_name ]}"!;
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! id="@{[ $self->element_id ]}"!;
$field .= qq! value="@{[$self->value ||1]}"!;
$field .= $self->_widget_class;
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Collection.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Collection.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Collection.pm Mon Sep 17 14:27:25 2007
@@ -51,6 +51,7 @@
$id =~ s/\s+/_/;
my $field = qq! <input type="text" !;
$field .= qq! name="@{[ $self->input_name ]}"!;
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! id="@{[ $id ]}"!;
$field .= qq! value="0"!;
$field .= $self->_widget_class;
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Combobox.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Combobox.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Combobox.pm Mon Sep 17 14:27:25 2007
@@ -19,12 +19,15 @@
sub render_widget {
my $self = shift;
+ my $title = $self->title ? qq! title="@{[ $self->title ]}"!
+ : qq! !;
my $field = <<"EOF";
<nobr>
<span id="@{[ $self->element_id ]}_Container" class="combobox">
<input name="@{[ $self->fallback_name ]}"
id="@{[ $self->element_id ]}"
+ $title
@{[ $self->_widget_class('combo-text')]}
value="@{[ $self->current_value ]}"
type="text"
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Radio.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Radio.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Radio.pm Mon Sep 17 14:27:25 2007
@@ -59,6 +59,7 @@
my $field = qq! <input type="radio" !;
$field .= qq! name="@{[ $self->input_name ]}"!;
$field .= qq! id="@{[ $id ]}"!;
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! value="@{[ $value ]}"!;
$field .= $self->_widget_class;
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/ResetButton.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/ResetButton.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/ResetButton.pm Mon Sep 17 14:27:25 2007
@@ -24,6 +24,7 @@
'<input',
'type="reset"',
'name="' . $self->input_name . '" ',
+ ($self->title ? 'title="'.$self->title.'" ' : ''),
'value="' . _($self->label ). '"',
$self->_widget_class('button', 'reset'),
$self->javascript,
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Select.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Select.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Select.pm Mon Sep 17 14:27:25 2007
@@ -22,6 +22,7 @@
my $field = qq! <select !;
$field .= qq! name="@{[ $self->input_name ]}"!;
$field .= qq! id="@{[ $self->element_id ]}"!;
+ $field .= qq! id="@{[ $self->title ]}"! if ($self->title);
$field .= $self->_widget_class;
$field .= $self->javascript;
$field .= qq! >\n!;
Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm Mon Sep 17 14:27:25 2007
@@ -34,6 +34,7 @@
$field .= qq!<textarea!;
$field .= qq! name="@{[ $self->input_name ]}"!;
$field .= qq! id="@{[ $self->element_id ]}"!;
+ $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
$field .= qq! rows="@{[$self->rows || 5 ]}"!;
$field .= qq! cols="@{[$self->cols || 60]}"!;
$field .= $self->_widget_class;
More information about the Jifty-commit
mailing list