Dotclear

Changeset 1649:938f932de901


Ignore:
Timestamp:
08/26/13 21:39:59 (12 years ago)
Author:
Lepeltier kévin
Branch:
Ticket #1604
Message:

Ticket #1604 progression

Location:
plugins/widgets
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • plugins/widgets/dragdrop.js

    r1648 r1649  
    77      
    88     // move 
    9      $( ".connected" ).sortable({ 
     9     $( ".connected, .sortable-delete" ).sortable({ 
     10          tolerance: "move", 
     11          cursor: "move", 
    1012          axis: "y", 
    11           connectWith: ".connected", 
    12           cursor: "move", 
    13           stop: function( event, ui ) { 
    14                $('.connected').each(function(){ 
    15                     if( $(this).find('li').length == 0 ) { 
    16                          $(this).parents('.widgets').find('.empty-widgets').show(); 
    17                     } else { 
    18                          $(this).parents('.widgets').find('.empty-widgets').hide(); 
    19                     } 
    20                }); 
    21           }//, 
     13          dropOnEmpty: true, 
     14          handle: ".widget-name", 
     15          placeholder: "ui-sortable-placeholder", 
     16          connectWith: ".connected, .sortable-delete", 
     17          start: function( event, ui ) { 
     18               ui.item.css('left', ui.item.position().left + 30); 
     19          }, 
     20          update: function(event, ui) { 
     21                
     22               // mes a zéro le décalage 
     23               ui.item.css('left', 'auto'); 
     24                
     25               if( $(this).find('li').length == 0 ) { 
     26                    $(this).parents('.widgets').find('.empty-widgets').show(); 
     27               } else { 
     28                    $(this).parents('.widgets').find('.empty-widgets').hide(); 
     29               } 
     30                
     31               // réordonne 
     32               if( $(this).attr('id') ) { 
     33                    $(this).find('input[title=ordre]').each(function(i){ 
     34                         tab = $(this).val(i); 
     35                    }); 
     36               } 
     37                
     38               // switch 
     39               if( $(this).attr('id') != ui.item.parents('ul').attr('id') ) { 
     40                    //oldname = $(this).attr('id').split('dnd').join(''); 
     41                    var name = ui.item.parents('ul').attr('id').split('dnd').join(''); 
     42                    ui.item.find('*[name^=w]').each(function(){ 
     43                         tab = $(this).attr('name').split(']['); 
     44                         tab[0] = "w["+name; 
     45                         $(this).attr('name', tab.join('][')); 
     46                    }); 
     47               } 
     48                
     49          } //, 
    2250          //change: function( event, ui ) { 
    2351               //ui.helper.css('height', $('#dndnav .widget-name').css('height')); 
     
    2755     // add 
    2856     $( "#widgets > li" ).draggable({ 
     57          tolerance: "move", 
     58          cursor: "move", 
    2959          connectToSortable: ".connected", 
    3060          helper: "clone", 
    3161          revert: "invalid", 
    32           cursor: "move", 
    3362          start: function( event, ui ) { 
    3463               ui.helper.css({'width': $('#widgets > li').css('width')}); 
     
    3665               //ui.helper.find('.form-note').hide(); 
    3766               //ui.helper.find('.widget-name').css({'min-height': $('#dndnav .widget-name').css('height')}); 
    38           }/*, 
    39           stop: function( event, ui ) { 
    40                $('.empty-widgets').css('display', 'none'); 
    41           }*/ 
     67          } 
    4268     }); 
    4369      
    44      $( "#widgets, .connected" ).disableSelection(); 
     70     //$( "#widgets, .connected, .sortable-delete" ).disableSelection(); 
    4571      
    4672}); 
  • plugins/widgets/index.php

    r1648 r1649  
    221221'<div id="sidebarNav" class="widgets fieldset">'. 
    222222sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j). 
     223'<ul class="sortable-delete"></ul>'. 
    223224'</div>'; 
    224225 
     
    227228'<div id="sidebarExtra" class="widgets fieldset">'. 
    228229sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j). 
     230'<ul class="sortable-delete"></ul>'. 
    229231'</div>'; 
    230232 
     
    233235'<div id="sidebarCustom" class="widgets fieldset">'. 
    234236sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j). 
     237'<ul class="sortable-delete"></ul>'. 
    235238'</div>'; 
    236239 
     
    333336           
    334337          $res .= 
    335           '<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id())). 
     338          '<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id()), 'blop'). 
    336339          '<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'js-hide','',0,'title="'.__('order').'"').' '. 
    337340          $w->name().($w->desc() != '' ? ' <!-- <span class="form-note">'.__($w->desc()).'</span> -->' : '').'</p>'. 
  • plugins/widgets/style.css

    r1648 r1649  
    4242     padding: 1em 0; 
    4343} 
    44 #dndnav > li, #dndextra > li, #dndcustom > li { 
     44#dndnav > li, 
     45#dndextra > li, 
     46#dndcustom > li, 
     47.sortable-delete > li { 
    4548     padding: O; 
    4649     border: 1px solid #999; 
     
    4851     list-style: none; 
    4952} 
     53 
     54.sortable-delete > li { 
     55     margin-bottom: 3px; 
     56} 
     57 
     58#dndnav li.ui-sortable-placeholder, 
     59#dndextra li.ui-sortable-placeholder, 
     60#dndcustom li.ui-sortable-placeholder, 
     61.sortable-delete li.ui-sortable-placeholder { 
     62     border: 1px dashed #999; 
     63     height: 2rem; 
     64     padding: 4px 6px; 
     65} 
     66 
    5067#dndnav .form-note, #dndextra .form-note, #dndcustom .form-note { 
    5168     display: none; 
     
    7996     background: #f5f5f5; 
    8097} 
     98 
     99.sortable-delete { 
     100    background: url("index.php?pf=pages/icon.png") no-repeat 6px 8px #FFBABA; 
     101    border: 1px solid #999999; 
     102    color: #000000; 
     103    font-weight: bold; 
     104    list-style: none outside none; 
     105    margin: 0 0 1em; 
     106    min-height: 25px; 
     107    padding: 4px 4px 0 24px; 
     108} 
     109 
    81110#widgets .widgetSettings { 
    82111     display: none; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map