[Rt-commit] rt branch, 4.0/cf-category-filter-render-type-list, updated. rt-4.0.5-83-g97fd263

? sunnavy sunnavy at bestpractical.com
Tue Mar 13 04:42:59 EDT 2012


The branch, 4.0/cf-category-filter-render-type-list has been updated
       via  97fd263dc6892726a67e841e884f3c3032afd8d7 (commit)
      from  d412ff29bcc6538c046cb6a0a5d2813bb0222f18 (commit)

Summary of changes:
 lib/RT/CustomField.pm                              |    5 -----
 .../Admin/Elements/SelectCustomFieldRenderType     |    5 -----
 share/html/Elements/EditCustomFieldSelect          |    2 ++
 share/html/NoAuth/js/cascaded.js                   |   15 +++++++++------
 4 files changed, 11 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit 97fd263dc6892726a67e841e884f3c3032afd8d7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Mar 13 16:33:17 2012 +0800

    support render type "List" with categories based on another cf

diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 91afa3e..c26432e 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -1020,11 +1020,6 @@ sub SetRenderType {
                                 $self->FriendlyType));
     }
 
-    # XXX: Remove this restriction once we support lists and cascaded selects
-    if ( $self->BasedOnObj->id and $type =~ /List/ ) {
-        return (0, $self->loc("We can't currently render as a List when basing categories on another custom field.  Please use another render type."));
-    }
-
     return $self->_Set( Field => 'RenderType', Value => $type, @_ );
 }
 
diff --git a/share/html/Admin/Elements/SelectCustomFieldRenderType b/share/html/Admin/Elements/SelectCustomFieldRenderType
index 5034c4d..521bbf5 100755
--- a/share/html/Admin/Elements/SelectCustomFieldRenderType
+++ b/share/html/Admin/Elements/SelectCustomFieldRenderType
@@ -56,11 +56,6 @@ $Default ||= $cf->DefaultRenderType($TypeComposite);
 
 my @types = $cf->RenderTypes($TypeComposite);
 
-# XXX: We currently don't support cascaded select CFs when
-# rendering as a list, so don't offer it for now.
-if ( $BasedOn ) {
-    @types = grep { not /List/ } @types;
-}
 </%INIT>
 <%ARGS>
 $Default => undef
diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 1a28742..be06334 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -88,8 +88,10 @@ jQuery(  function () {
 <fieldset class="cfedit">
 <div name="<%$id%>-Values" id="<%$id%>-Values">
 %   if ( $checktype eq 'radio' ) {
+    <div class="none">
   <input class="none" type="<% $checktype %>" name="<% $name %>" id="<% $name %>-none" value="" <% keys %default ? '' : ' checked="checked"' |n%> />
   <label for="<% $name %>-none"><&|/l&>(no value)</&></label><br />
+    </div>
 %   }
 %   my $CFVs = $CustomField->Values;
 %   while ( my $value = $CFVs->Next ) {
diff --git a/share/html/NoAuth/js/cascaded.js b/share/html/NoAuth/js/cascaded.js
index 6ce0a3d..95cfd50 100644
--- a/share/html/NoAuth/js/cascaded.js
+++ b/share/html/NoAuth/js/cascaded.js
@@ -57,14 +57,17 @@ function filter_cascade (id, val) {
         if ( val == '' && arguments.length == 3 ) {
             // no category, and the category is from a hierchical cf;
             // leave it empty
-            jQuery(element).find('input').attr('disabled', 'disabled').hide();
-        }
-        else if ( val == '' ) {
-            jQuery(element).find('div').show().find('input:disabled').attr('disabled', '');
+            jQuery(element).find('div').hide();
         }
         else {
-            jQuery(element).find('div').hide().find('input').attr('disabled', 'disabled');
-            jQuery(element).find('div[name^=' + val + ']').show().find('input').attr('disabled', '');
+            if ( val == '' ) {
+                jQuery(element).find('div').show().find('input:disabled').attr('disabled', '');
+            }
+            else {
+                jQuery(element).find('div').hide().find('input').attr('disabled', 'disabled');
+                jQuery(element).find('div[name^=' + val + ']').show().find('input').attr('disabled', '');
+            }
+            jQuery(element).find('div.none').show();
         }
     }
 }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list