[Rt-commit] [rtir] 01/01: Update the logic about displaying Checkboxes vs Radio Buttons.

Kevin Falcone falcone at bestpractical.com
Thu Jun 20 16:40:21 EDT 2013


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 2.9/incident-children
in repository rtir.

commit abaf75a3c7470b490ab39c57a7bde1bfc8505a31
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Jun 20 16:37:28 2013 -0400

    Update the logic about displaying Checkboxes vs Radio Buttons.
    
    SelectIncident displays a box to enter an Incident ID if you can choose more
    than one Incident (Multiple) or if it is passed any Incidents to display.  This
    conflicts with Radio Buttons.  If there are valid reasons for the Radio Button
    display, then we need to rename that Other box, but I'm not sure why we use
    Radio Buttons in this UI.  See the logic table below.
    
        Singular/Multiple - Can choose only one or more than one Incident?
        Required/Optionsl - Do we need to provide an Incident?
        One/Many - SelectIncident receive a list of 0, 1 or more Incidents
                   to display. In the 0 case, it always just shows a text input.
    
        1 | Multiple | Required | One  |  Checkboxes
        2 | Multiple | Required | Many |  Checkboxes
        3 | Multiple | Optional | One  |  Checkboxes
        4 | Multiple | Optional | Many |  Checkboxes
        5 | Singular | Required | One  |  Hidden input
        6 | Singular | Required | Many |  Radio (needs Other if list is incomplete)
        7 | Singular | Optional | One  |  Checkboxes
        8 | Singular | Optional | Many |  Radio with the unselectable option?
    
    I haven't found a live use of SelectIncident that allows only one
    Incident, but is passed multiple incidents to render. That's the only
    place I can see rendering a Radio button.  I've even tried to force it in the
    RTIR UI by changing to non-standard RT configurations.
    
    Rewriting the If/elseif logic to use this table passes all tests, but no tests
    appear to have been changed when SelectIncident was updated with
    RTIR_IncidentChildren support, so this needs more testing.
---
 html/RTIR/Elements/SelectIncident | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/html/RTIR/Elements/SelectIncident b/html/RTIR/Elements/SelectIncident
index 24d00f2..bbd638b 100644
--- a/html/RTIR/Elements/SelectIncident
+++ b/html/RTIR/Elements/SelectIncident
@@ -102,15 +102,11 @@ my $query = RT::IR->Query(
 );
 my $format = RT->Config->Get('RTIRSearchResultFormats')->{'LinkIncident'};
 my ($dformat, $hide);
-if ( $config->{'Multiple'} ||
-     ( @potential == 1 && !$config->{'Required'} ) ) {
-    $dformat = "'__CheckBox.{$Name}__', $format";
-} elsif ( @potential > 1 || !$config->{'Required'} ) {
-# Do we actually use this case, except when you have multiple incidents but are configured for single?
-# You would need to have triggered one of the 2.[46] bugs allowing multiple Incident parents or changed your config.
-# Removing this would allow the removal of the uncheckable jQuery plugin.
+if ( !$config->{'Multiple'} && @potential > 1 ) {
     $dformat = "'__RadioButton.{$Name}__', $format";
-} else {
+} elsif ( !$config->{'Multiple'} && $config->{'Required'} && @potential == 1 ) {
     ($dformat, $hide) = ($format, 1);
+} else {
+    $dformat = "'__CheckBox.{$Name}__', $format";
 }
 </%INIT>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Rt-commit mailing list