Changeset 1649:938f932de901
- Timestamp:
- 08/26/13 21:39:59 (12 years ago)
- Branch:
- Ticket #1604
- Location:
- plugins/widgets
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/widgets/dragdrop.js
r1648 r1649 7 7 8 8 // move 9 $( ".connected" ).sortable({ 9 $( ".connected, .sortable-delete" ).sortable({ 10 tolerance: "move", 11 cursor: "move", 10 12 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 } //, 22 50 //change: function( event, ui ) { 23 51 //ui.helper.css('height', $('#dndnav .widget-name').css('height')); … … 27 55 // add 28 56 $( "#widgets > li" ).draggable({ 57 tolerance: "move", 58 cursor: "move", 29 59 connectToSortable: ".connected", 30 60 helper: "clone", 31 61 revert: "invalid", 32 cursor: "move",33 62 start: function( event, ui ) { 34 63 ui.helper.css({'width': $('#widgets > li').css('width')}); … … 36 65 //ui.helper.find('.form-note').hide(); 37 66 //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 } 42 68 }); 43 69 44 $( "#widgets, .connected" ).disableSelection();70 //$( "#widgets, .connected, .sortable-delete" ).disableSelection(); 45 71 46 72 }); -
plugins/widgets/index.php
r1648 r1649 221 221 '<div id="sidebarNav" class="widgets fieldset">'. 222 222 sidebarWidgets('dndnav',__('Navigation sidebar'),$widgets_nav,'nav',$__default_widgets['nav'],$j). 223 '<ul class="sortable-delete"></ul>'. 223 224 '</div>'; 224 225 … … 227 228 '<div id="sidebarExtra" class="widgets fieldset">'. 228 229 sidebarWidgets('dndextra',__('Extra sidebar'),$widgets_extra,'extra',$__default_widgets['extra'],$j). 230 '<ul class="sortable-delete"></ul>'. 229 231 '</div>'; 230 232 … … 233 235 '<div id="sidebarCustom" class="widgets fieldset">'. 234 236 sidebarWidgets('dndcustom',__('Custom sidebar'),$widgets_custom,'custom',$__default_widgets['custom'],$j). 237 '<ul class="sortable-delete"></ul>'. 235 238 '</div>'; 236 239 … … 333 336 334 337 $res .= 335 '<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id()) ).338 '<li>'.form::hidden(array($iname.'[id]'),html::escapeHTML($w->id()), 'blop'). 336 339 '<p class="widget-name">'.form::field(array($iname.'[order]'),2,3,(string) $i,'js-hide','',0,'title="'.__('order').'"').' '. 337 340 $w->name().($w->desc() != '' ? ' <!-- <span class="form-note">'.__($w->desc()).'</span> -->' : '').'</p>'. -
plugins/widgets/style.css
r1648 r1649 42 42 padding: 1em 0; 43 43 } 44 #dndnav > li, #dndextra > li, #dndcustom > li { 44 #dndnav > li, 45 #dndextra > li, 46 #dndcustom > li, 47 .sortable-delete > li { 45 48 padding: O; 46 49 border: 1px solid #999; … … 48 51 list-style: none; 49 52 } 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 50 67 #dndnav .form-note, #dndextra .form-note, #dndcustom .form-note { 51 68 display: none; … … 79 96 background: #f5f5f5; 80 97 } 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 81 110 #widgets .widgetSettings { 82 111 display: none;
Note: See TracChangeset
for help on using the changeset viewer.