As I work on polishing http://trac.edgewall.org/ticket/10983 for Trac
1.0.1, I find that radio button attributes are not handled correctly.
What I believe I'm seeing is that stock Trac 1.0.1 shows a radio-type
filter with checkboxes.

Looking at trac/htdocs/js/query.js, I find

         if (property.type == "radio") {
           for (var i = 0; i < property.options.length; i++) {
             var option = property.options[i];
             var control = createCheckbox(propertyName, option,

and

         } else if (property.type == "checkbox") {
            focusElement = createRadio(propertyName, "1", propertyName + "_on");

Huh?  If the property is a radio button display a checkbox (and vice
versa)?  So, I patched query.js:

---------
@@ -168,7 +168,7 @@
         if (property.type == "radio") {
           for (var i = 0; i < property.options.length; i++) {
             var option = property.options[i];
-            var control = createCheckbox(propertyName, option,
+            var control = createRadio(propertyName, option,
                                          propertyName + "_" + option);
             if (i == 0)
               focusElement = control;
@@ -177,11 +177,11 @@
                                   propertyName + "_" + option)).append(" ");
           }
         } else if (property.type == "checkbox") {
-          focusElement = createRadio(propertyName, "1", propertyName + "_on");
+          focusElement = createCheckbox(propertyName, "1", propertyName + "_on"
           td.append(focusElement)
             .append(" ").append(createLabel(_("yes"), propertyName + "_on"))
             .append(" ")
-            .append(createRadio(propertyName, "0", propertyName + "_off"))
+            .append(createCheckbox(propertyName, "0", propertyName + "_off"))
             .append(" ").append(createLabel(_("no"), propertyName + "_off"));
         } else if (property.type == "time") {
           focusElement = createText(propertyName, 14).datepicker();
@@ -305,11 +305,11 @@
           }
           break;
         case 'checkbox':
-          focusElement = createRadio(inputName, "1", inputName + "_on");
+          focusElement = createCheckbox(inputName, "1", inputName + "_on");
           td.append(focusElement)
             .append(" ").append(createLabel(_("yes"), inputName + "_on"))
             .append(" ")
-            .append(createRadio(inputName, "0", inputName + "_off"))
+            .append(createCheckbox(inputName, "0", inputName + "_off"))
             .append(" ").append(createLabel(_("no"), inputName + "_off"));
           break;
         case 'text':
---------

And now my initial display of a radio option is correct but when I
click Update, it's refreshed wrong.  Looking further, I find
trac/ticket/templates/query.html seems to have the same reversal.  But
when I fix it there:

--------
@@ -101,7 +101,7 @@

                         <py:when test="field.type == 'radio'">
                           <py:for each="option in field.options">
-                            <input type="checkbox" id="_${n_field_name}_$option
+                            <input type="radio" id="_${n_field_name}_$option" n
                               value="$option"
                               checked="${((constraint['mode'] == '') == (option
                             <label for="_${n_field_name}_$option" class="contro
@@ -109,10 +109,10 @@
                         </py:when>

                         <py:when test="field.type == 'checkbox'">
-                          <input type="radio" id="_${n_field_name}_on" name="$n
+                          <input type="checkbox" id="_${n_field_name}_on" name=
                                  checked="${constraint.mode != '!' or constrain
                           <label for="_${n_field_name}_on" class="control">yes<
-                          <input type="radio" id="_${n_field_name}_off" name="$
+                          <input type="checkbox" id="_${n_field_name}_off" name
                                  checked="${constraint.mode == '!' or constrain
                           <label for="_${n_field_name}_off" class="control">no<
                         </py:when>
--------

filtering by status is initially displayed with radio buttons.
Perhaps that fix is overzealous but it certainly seems correct by code
inspection.

I reviewed all tickets for the query system[1] and didn't see anything
like this.  I guess there are no standard filters that use radio
buttons but how it's not clear to me how status works with the code as
it is.

Any thoughts?

                                                                          Chris

[1] 
http://trac.edgewall.org/query?status=assigned&status=closed&status=new&status=reopened&component=query+system&order=priority
-- 
A: Top-posting.
Q: What is the most annoying thing in e-mail?

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to