Dotclear

Changeset 1639:0c068f3e0f8e


Ignore:
Timestamp:
08/20/13 00:10:33 (11 years ago)
Author:
Lepeltier kévin
Branch:
Ticket #1550
Message:

Ticket #1550 : fléche Plier/déplier général impose son état aux autres lignes.
Et inversement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_posts_list.js

    r1034 r1639  
    2828 
    2929dotclear.viewPostsContent = function(img,lines) { 
    30      lines.each(function() { 
    31           var td = this.firstChild; 
    32           td.firstChild.click(); 
    33      }); 
     30      
     31     action = 'toggle'; 
    3432 
    3533     if (img.alt == dotclear.img_plus_alt) { 
    3634          img.src = dotclear.img_minus_src; 
    3735          img.alt = dotclear.img_minus_alt; 
     36          action = 'open'; 
    3837     } else { 
    3938          img.src = dotclear.img_plus_src; 
    4039          img.alt = dotclear.img_plus_alt; 
     40          action = 'close'; 
    4141     } 
     42      
     43     lines.each(function() { 
     44          var td = this.firstChild; 
     45          dotclear.viewPostContent(td.firstChild,td.firstChild.line,action); 
     46     }); 
    4247}; 
    4348 
    44 dotclear.viewPostContent = function(img,line) { 
     49dotclear.viewPostContent = function(img,line,action) { 
     50      
     51     var action = action || 'toggle'; 
    4552     var postId = line.id.substr(1); 
    4653     var tr = document.getElementById('pe'+postId); 
    4754      
    48      if (!tr) { 
     55     if ( !tr && ( action == 'toggle' || action == 'open' ) ) { 
    4956          tr = document.createElement('tr'); 
    5057          tr.id = 'pe'+postId; 
     
    7885          }); 
    7986           
    80           $(line).toggleClass('expand'); 
     87          $(line).addClass('expand'); 
    8188          line.parentNode.insertBefore(tr,line.nextSibling); 
    8289     } 
    83      else if (tr.style.display == 'none') 
     90     else if (tr.style.display == 'none' && ( action == 'toggle' || action == 'open' ) ) 
    8491     { 
    85           $(tr).toggle(); 
    86           $(line).toggleClass('expand'); 
     92          $(tr).css('display', 'table-row'); 
     93          $(line).addClass('expand'); 
    8794          img.src = dotclear.img_minus_src; 
    8895          img.alt = dotclear.img_minus_alt; 
    8996     } 
    90      else 
     97     else if (tr.style.display != 'none' && ( action == 'toggle' || action == 'close' ) ) 
    9198     { 
    92           $(tr).toggle(); 
    93           $(line).toggleClass('expand'); 
     99          $(tr).css('display', 'none'); 
     100          $(line).removeClass('expand'); 
    94101          img.src = dotclear.img_plus_src; 
    95102          img.alt = dotclear.img_plus_alt; 
    96103     } 
     104      
     105     parentTable = $(line).parents('table'); 
     106     if( parentTable.find('tr.expand').length == parentTable.find('tr.line').length ) { 
     107          img = parentTable.find('tr:not(.line) th:first img'); 
     108          img.attr('src',dotclear.img_minus_src); 
     109          img.attr('alt',dotclear.img_minus_alt); 
     110     } 
     111      
     112     if( parentTable.find('tr.expand').length == 0 ) { 
     113          img = parentTable.find('tr:not(.line) th:first img'); 
     114          img.attr('src',dotclear.img_plus_src); 
     115          img.attr('alt',dotclear.img_plus_alt); 
     116     } 
     117      
    97118}; 
    98119 
Note: See TracChangeset for help on using the changeset viewer.

Sites map