Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#11361 closed enhancement (fixed)

Hide batch modify form when there are no query results

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: ticket system Version: 1.0-stable
Severity: normal Keywords: batch-modify
Cc: Branch:
Release Notes:

The Batch Modify section on the Query page is hidden when there are no query results.

API Changes:
Internal Changes:


The batch modify form is shown when there are no query results, however the Action fieldset is empty and the form can't serve any function.

The proposed change will hide the #batchmod_form when there are no query results.

  • trac/ticket/templates/query.html

    diff --git a/trac/ticket/templates/query.html b/trac/ticket/templates/query.html
    index 4f8e682..6de55dd 100644
    a b  
    223223      </form>
    225225      <xi:include href="query_results.html" />
    226       <xi:include py:if="batch_modify" href="batch_modify.html" />
     226      <xi:include py:if="tickets and batch_modify" href="batch_modify.html" />
    228228      <div id="trac-report-buttons" class="buttons"
    229229           py:with="edit = report_resource and 'REPORT_MODIFY' in perm(report_resource);

Attachments (1)

NoTickets.png (27.4 KB ) - added by Ryan J Ollos 7 years ago.

Download all attachments as: .zip

Change History (4)

by Ryan J Ollos, 7 years ago

Attachment: NoTickets.png added

comment:1 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

I was hoping to write a functional test for this, but since we can't test JavaScript with Twill, and after #11014 the Batch Modification section is hidden when JavaScript is disabled, it doesn't seem to be possible.

Committed to 1.0-stable in [12245] and merged to trunk in [12246].

comment:2 by Ryan J Ollos, 7 years ago

Proposed further refinement: only add the group toggle checkbox if there are entries in the table:

  • trac/htdocs/js/query.js

    index 3631344..eb8dd07 100644
    a b  
    394394    // Add a checkbox at the top of the column
    395395    // to select every ticket in the group.
    396     $("table.listing tr th.id").each(function() {
    397       $(this).before(
    398         $('<th class="batchmod_selector sel">').append(
    399           $('<input type="checkbox" name="batchmod_toggleGroup" />').attr({
    400             title: _("Toggle selection of all tickets shown in this group")
    401           })));
    402     });
     396    if ($("table.listing tr td.id").length) {
     397        $("table.listing tr th.id").each(function() {
     398          $(this).before(
     399            $('<th class="batchmod_selector sel">').append(
     400              $('<input type="checkbox" name="batchmod_toggleGroup" />').attr({
     401                title: _("Toggle selection of all tickets shown in this group")
     402              })));
     403        });
     404    }
    404406    // Add the click behavior for the group toggle.
    405407    $("input[name='batchmod_toggleGroup']").click(function() {

comment:3 by Ryan J Ollos, 7 years ago

Patch in comment:2 committed to 1.0-stable in [12332] and merged to trunk in [12333].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.