Modify

Opened 9 years ago

Closed 5 years ago

#12575 closed defect (fixed)

Fields not hidden in header during preview

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Component: DynamicFieldsPlugin
Severity: normal Keywords:
Cc: matthewf@… Trac Release:

Description

The hidden fields are still visible in the #ticket during preview.

Attachments (2)

dynamicfieldsplugin-v2.diff (12.5 KB) - added by Ryan J Ollos 5 years ago.
dynamicfieldsplugin-v3.diff (11.1 KB) - added by Ryan J Ollos 5 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 7 years ago by Ryan J Ollos

#13214 closed as a duplicate.

comment:2 Changed 7 years ago by Ryan J Ollos

Cc: matthewf@… added

comment:3 Changed 7 years ago by Ryan J Ollos

Owner: changed from Rob Guttman to Ryan J Ollos
Status: newaccepted

comment:4 Changed 7 years ago by Ryan J Ollos

Status: acceptednew

comment:5 Changed 6 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

comment:6 Changed 6 years ago by Jun Omae

Workaround:

  • dynfields/htdocs/dynfields.js

    diff --git a/dynfields/htdocs/dynfields.js b/dynfields/htdocs/dynfields.js
    index 28f1df4d8..84109ca64 100755
    a b jQuery(function ($) { 
    7474      $(this).change(apply_rules).change();
    7575    });
    7676
     77    // apply rules on preview
     78    $(document).ajaxComplete(function(event, xhr, settings) {
     79      if (settings.url === location.pathname) {
     80        $.each(inputs, function() { $(this).change() });
     81      }
     82    });
    7783  }
    7884});

comment:7 Changed 6 years ago by Ryan J Ollos

Thanks for the patch. I tested with Trac 1.0.18dev. There is a minor issue. Using the following config:

[ticket-custom]
parents = text
parents.label = Parent Tickets
parents.hide_when_milestone =

Starting with an empty milestone, change milestone to milestone1. Parents Tickets appears in #properties, but does not appear in #ticket, during explicit preview, auto-preview and after submit. It seems Parent Tickets is always hidden in #ticket.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:8 Changed 6 years ago by Jun Omae

It seems that the wrong layout in #ticket is introduced in [15095].

  • dynfields/htdocs/rules.js

     
    168168  // hide field in the header if cleared or always hidden
    169169  var clear_on_hide = spec.clear_on_hide.toLowerCase() == 'true';
    170170  var hide_always = spec.hide_always.toLowerCase() == 'true'
    171   if (clear_on_hide || hide_always) {
    172     th = jQuery('#h_' + spec.target);
    173     td = th.next('td');
    174     td.addClass('dynfields-hide dynfields-' + trigger);
    175     th.addClass('dynfields-hide dynfields-' + trigger);
    176   }
    177171
    178172  if (input.attr('id').slice(6) !== spec.trigger)
    179173    return;
     
    199193    th.addClass(cls);
    200194
    201195    // let's also clear out the field's value to avoid confusion
    202     if (spec.clear_on_hide.toLowerCase() == 'true' &&
     196    if (clear_on_hide &&
    203197      field.val() && field.val().length) { // Chrome fix - see #8654
    204198      if (field.attr('type') == 'checkbox') {
    205199        if (field.is(':checked')) {
     
    213207          field.change(); // cascade rules
    214208      }
    215209    }
     210    if (clear_on_hide || hide_always) {
     211      th = jQuery('#h_' + spec.target);
     212      td = th.next('td');
     213      td.addClass('dynfields-hide dynfields-' + trigger);
     214      th.addClass('dynfields-hide dynfields-' + trigger);
     215    }
    216216  }
    217217};
    218218

comment:9 Changed 6 years ago by Jun Omae

See also posted patch (dynamicfieldsplugin-v2.diff) in gmessage:trac-users:Bn3rGvLfRVc/aq_aeJWnAQAJ.

Last edited 6 years ago by Jun Omae (previous) (diff)

comment:10 Changed 6 years ago by Ryan J Ollos

Sorry for delay, I had intended to test and commit, but not sure I will get it done soon. Please feel free to commit the changes, and those in #9606 as well.

comment:11 Changed 5 years ago by Ryan J Ollos

I unintentionally committed the comment:6 change in r17397, but probably is a needed change anyway.

comment:12 Changed 5 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Status: newaccepted

comment:13 Changed 5 years ago by Ryan J Ollos

In 17434:

TracDynamicFields 2.3.0dev: Fix regression in r15095

Patch by Jun Omae.

Refs #12575.

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

Changed 5 years ago by Ryan J Ollos

Attachment: dynamicfieldsplugin-v2.diff added

Changed 5 years ago by Ryan J Ollos

Attachment: dynamicfieldsplugin-v3.diff added

comment:14 in reply to:  9 Changed 5 years ago by Ryan J Ollos

Replying to Jun Omae:

See also posted patch (dynamicfieldsplugin-v2.diff) in gmessage:trac-users:Bn3rGvLfRVc/aq_aeJWnAQAJ.

Rebased the patch: dynamicfieldsplugin-v3.diff. Will do more testing.

comment:15 Changed 5 years ago by Ryan J Ollos

In 17522:

TracDynamicFields 2.3.0dev: Fix fields not hidden in header during preview

Patch by Jun Omae.

Refs #12575, #9606.

comment:16 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.