[Rt-commit] rt branch, 4.4/widget-improvements, created. rt-4.4.1-3-g30996a8
Shawn Moore
shawn at bestpractical.com
Tue Aug 15 12:21:18 EDT 2017
The branch, 4.4/widget-improvements has been created
at 30996a8036e66f8f1787754ebf17ef9d1e662b7c (commit)
- Log -----------------------------------------------------------------
commit 39fe096ddf4e45005bd6261f484afd0ce4747a8b
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Aug 15 16:01:59 2017 +0000
Allow specifying size for Integer and String widgets
diff --git a/share/html/Widgets/Form/Integer b/share/html/Widgets/Form/Integer
index 7fc75e0..ba0cc78 100644
--- a/share/html/Widgets/Form/Integer
+++ b/share/html/Widgets/Form/Integer
@@ -74,10 +74,11 @@ $DefaultLabel => undef
</%ARGS>
<%METHOD InputOnly>
-<input type="text" name="<% $Name %>" value="<% $CurrentValue %>" />\
+<input type="text" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue %>" />\
<%ARGS>
$Name
$CurrentValue => '',
+$Size => 20
</%ARGS>
<%INIT>
$CurrentValue = '' unless defined $CurrentValue;
diff --git a/share/html/Widgets/Form/String b/share/html/Widgets/Form/String
index ce60231..7a542b8 100644
--- a/share/html/Widgets/Form/String
+++ b/share/html/Widgets/Form/String
@@ -70,11 +70,12 @@ $DefaultLabel => loc( 'Default: [_1]', $DefaultValue ),
</%ARGS>
<%METHOD InputOnly>
-<input type="<% $Type %>" name="<% $Name %>" value="<% $CurrentValue || '' %>" />\
+<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue || '' %>" />\
<%ARGS>
$Name
$CurrentValue => '',
$Type => 'text'
+$Size => 20
</%ARGS>
</%METHOD>
commit 8dac5bc7a941d5aba0b8b104893c37c186d4e859
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Aug 15 16:02:18 2017 +0000
Allow String widget to have a value of "0"
Using $CurrentValue || '' means that 0 gets canonicalized to the empty
string, which means you can't have a default of 0.
This is necessary for RT::Extension::ConfigInDatabase's input field for
$SetOutgoingMailFrom, which is a string that takes an email address or
the special case value of "0".
diff --git a/share/html/Widgets/Form/String b/share/html/Widgets/Form/String
index 7a542b8..771a86d 100644
--- a/share/html/Widgets/Form/String
+++ b/share/html/Widgets/Form/String
@@ -70,7 +70,7 @@ $DefaultLabel => loc( 'Default: [_1]', $DefaultValue ),
</%ARGS>
<%METHOD InputOnly>
-<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue || '' %>" />\
+<input type="<% $Type %>" name="<% $Name %>" size="<% $Size %>" value="<% $CurrentValue // '' %>" />\
<%ARGS>
$Name
$CurrentValue => '',
commit 30996a8036e66f8f1787754ebf17ef9d1e662b7c
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Aug 15 16:07:59 2017 +0000
Add RadioStyle option to Boolean widget
If you use a Boolean widget with no Default, then the Yes/No/(Default)
radio widget gets automatically downgraded to a checkbox. Instead, allow
RadioStyle => 1 to present a Yes/No radio widget
diff --git a/share/html/Widgets/Form/Boolean b/share/html/Widgets/Form/Boolean
index aade98e..86120bf 100644
--- a/share/html/Widgets/Form/Boolean
+++ b/share/html/Widgets/Form/Boolean
@@ -66,10 +66,11 @@ $Name => undef,
$Default => 0,
$DefaultValue => 0,
$DefaultLabel => loc( 'Use default ([_1])', $DefaultValue? loc('Yes'): loc('No') ),
+$RadioStyle => 0
$CurrentValue => undef,
</%ARGS>
-% unless ( $Default ) {
+% if ( !$Default && !$RadioStyle ) {
<input type="hidden" name="<% $Name %>" value="0" />\
<input type="checkbox" name="<% $Name %>" value="1" <% $CurrentValue? ' checked="checked"': '' |n %> />\
% } else {
@@ -81,11 +82,13 @@ $CurrentValue => undef,
<input type="radio" name="<% $Name %>" value="0" <% defined $CurrentValue && !$CurrentValue? ' checked="checked"': '' |n %> />\
<% loc('No') %>
</label>
+% if ($Default) {
<label>
<input type="radio" name="<% $Name %>" value="__empty_value__" <% !defined $CurrentValue? ' checked="checked"': '' |n %> />\
<% $DefaultLabel %>
</label>
% }
+% }
</%METHOD>
<%METHOD Process>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list