Changes between Initial Version and Version 1 of Ticket #12609, comment 19


Ignore:
Timestamp:
Jun 24, 2016, 3:53:26 AM (8 years ago)
Author:
Ryan J Ollos
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12609, comment 19

    initial v1  
    11Replying to [comment:18 christiano@…]:
    22> I guess I didn't test well enough after setting `clear_on_hide` to false.  I have a workaround that partially works for us without having to mess with `clear_on_hide`. 
    3 >
    4 > {{{
    5 > #!diff
    6 > --- dynamicfieldsplugin/trunk/dynfields/htdocs/rules.js (revision 15591)
    7 > +++ dynamicfieldsplugin/trunk/dynfields/htdocs/rules.js (working copy)
    8 > @@ -163,9 +163,17 @@
    9 >    var target = spec.target;
    10 >
    11 >    // hide field in the header if cleared or always hidden
    12 > -  var clear_on_hide = spec.clear_on_hide.toLowerCase() == 'true';
    13 > -  var hide_always = spec.hide_always.toLowerCase() == 'true'
    14 > -  if (clear_on_hide || hide_always) {
    15 > +  //var clear_on_hide = spec.clear_on_hide.toLowerCase() == 'true';
    16 > +  var hide_always = spec.hide_always.toLowerCase() == 'true';
    17 > +  var v;
    18 > +  if (input.attr('type') == 'checkbox')
    19 > +    v = (input.is(':checked')) ? "1" : "0";
    20 > +  else
    21 > +    v = input.val();
    22 > +  var l = spec.trigger_value.split('|'); // supports list of trigger values
    23 > +  var should_hide = ( (jQuery.inArray(v, l) != -1 && spec.op == 'hide') ||
    24 > +                 (jQuery.inArray(v, l) == -1 && spec.op == 'show') )
    25 > +  if (hide_always || should_hide) {
    26 >      th = jQuery('#h_' + spec.target);
    27 >      td = th.next('td');
    28 >      td.addClass('dynfields-hide dynfields-' + trigger);
    29 > @@ -176,12 +184,6 @@
    30 >      return;
    31 >
    32 >    // process hide rule
    33 > -  var v;
    34 > -  if (input.attr('type') == 'checkbox')
    35 > -    v = (input.is(':checked')) ? "1" : "0";
    36 > -  else
    37 > -    v = input.val();
    38 > -  var l = spec.trigger_value.split('|'); // supports list of trigger values
    39 >    if ((jQuery.inArray(v, l) != -1 && spec.op == 'hide') ||
    40 >      (jQuery.inArray(v, l) == -1 && spec.op == 'show')) {
    41 > }}}
    42 >
    43 > When viewing tickets without modifying them, the yellow ticket_box displays the expected ticket properties.  There are issues with certain options, however.
    44 >
    45 > When we used the `invalid_if` option in conjunction with the `invalid_when_type` option we see the behavior of unexpectedly hiding ticket fields.  I haven't had a chance to look at why this is occurring.
    46 >
     3> [...]
    474> If a preview is generated during a ticket modification all bets are off.  That problem seems to be discussed in [[https://trac.edgewall.org/ticket/11719|th:ticket:11719]] and [[https://trac-hacks.org/ticket/11923|th:ticket:11923]]
    485>
    496
    50 [[BR]]
     7
    518Well, my little 'work around' breaks firefox.