Modify

Opened 4 years ago

Last modified 13 days ago

#12575 accepted defect

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 (0)

Change History (12)

comment:1 Changed 2 years ago by Ryan J Ollos

#13214 closed as a duplicate.

comment:2 Changed 2 years ago by Ryan J Ollos

Cc: matthewf@… added

comment:3 Changed 2 years ago by Ryan J Ollos

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

comment:4 Changed 2 years ago by Ryan J Ollos

Status: acceptednew

comment:5 Changed 10 months ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

comment:6 Changed 10 months 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 10 months 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 10 months ago by Ryan J Ollos (previous) (diff)

comment:8 Changed 10 months 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 10 months ago by Jun Omae

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

Last edited 10 months ago by Jun Omae (previous) (diff)

comment:10 Changed 9 months 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 2 weeks ago by Ryan J Ollos

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

comment:12 Changed 13 days ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Status: newaccepted

Modify Ticket

Change Properties
Set your email in Preferences
Action
as accepted The owner will remain Ryan J Ollos.

Add Comment


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

 
Note: See TracTickets for help on using tickets.