Changeset 1659:12fc8eddfa0f
- Timestamp:
- 08/29/13 17:55:07 (12 years ago)
- Branch:
- Ticket #1604 - widgets
- Location:
- plugins/widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/widgets/dragdrop.js
r1657 r1659 1 /* 2 # -- BEGIN LICENSE BLOCK --------------------------------------- 3 # 4 # This file is part of Dotclear 2. 5 # 6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 7 # Licensed under the GPL version 2.0 license. 8 # See LICENSE file or 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # 11 # -- END LICENSE BLOCK ----------------------------------------- 12 */ 13 1 14 $(function() { 2 15 … … 72 85 73 86 // add 74 $( "#widgets > li" ).draggable({87 $( "#widgets-ref > li" ).draggable({ 75 88 tolerance: "move", 76 89 cursor: "move", … … 79 92 revert: "invalid", 80 93 start: function( event, ui ) { 81 ui.helper.css({'width': $('#widgets > li').css('width')});94 ui.helper.css({'width': $('#widgets-ref > li').css('width')}); 82 95 } 83 96 }); -
plugins/widgets/index.php
r1657 r1659 195 195 '<h3>'.__('Available widgets').'</h3>'. 196 196 '<p>'.__('Move widgets from this list to one of the sidebars.').'</p>'. 197 '<ul id="widgets ">';197 '<ul id="widgets-ref">'; 198 198 199 199 $j = 0; … … 201 201 echo 202 202 '<li>'.form::hidden(array('w[void][0][id]'),html::escapeHTML($w->id())). 203 '<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hid den-if-drag','',0,'title="'.__('order').'"').' '.$w->name().203 '<p class="widget-name">'.form::field(array('w[void][0][order]'),2,3,0,'hide','',0,'title="'.__('order').'"').' '.$w->name(). 204 204 ($w->desc() != '' ? ' <span class="form-note">'.__($w->desc()).'</span>' : '').'</p>'. 205 '<p class=" remove-if-drag"><label class="classic">'.__('Append to:').'</label> '.205 '<p class="manual-move remove-if-drag"><label class="classic">'.__('Append to:').'</label> '. 206 206 form::combo(array('addw['.$w->id().']'),$append_combo).'</p>'. 207 207 '<div class="widgetSettings hidden-if-drag">'.$w->formSettings('w[void][0]',$j).'</div>'. -
plugins/widgets/style.css
r1657 r1659 1 #listWidgets { 2 float: left; 3 width: 46%; 4 background: #eee; 5 padding: 1.5em 1% 0; 6 margin: 0 1% 0 0; 7 } 8 #widgets > li { 9 border: 1px solid #ccc; 10 margin-bottom: .5em; 11 background: #fff; 12 min-height: 3em; 13 padding: 0 0 4px 0; 14 list-style: none; 15 } 16 #widgets .widget-name, #widgets .js-remove { 17 background: #fff; 18 margin-bottom: 0; 19 padding: 4px 8px; 20 } 21 #widgets .js-hide { 22 display: none; 23 } 24 #widgets .widget-name { 25 min-height: 3em; 26 padding-bottom: 0; 27 } 28 #listWidgets h3 { 29 color: #333; 30 } 1 /* 2 # -- BEGIN LICENSE BLOCK --------------------------------------- 3 # 4 # This file is part of Dotclear 2. 5 # 6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 7 # Licensed under the GPL version 2.0 license. 8 # See LICENSE file or 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # 11 # -- END LICENSE BLOCK ----------------------------------------- 12 */ 31 13 14 15 /* ------------------------------------------------------------- side bars */ 32 16 #sidebarsWidgets { 33 17 float: left; … … 35 19 margin: 0 0 0 1%; 36 20 padding: 0 1%; 37 }38 #sidebarsControl {39 clear: left;40 21 } 41 22 .widgets.fieldset { … … 47 28 border-bottom: 1px dashed #FF0000; 48 29 } 49 # widgets, #dndnav, #dndextra, #dndcustom {30 #dndnav, #dndextra, #dndcustom { 50 31 padding: 1em 0; 51 32 margin: 1em 0 0; … … 60 41 list-style: none; 61 42 } 62 63 .sortable-delete > li { 64 margin-bottom: 3px; 65 } 66 .sortable-delete li.sortable-delete-placeholder { 67 border: 0 none; 68 color: #666666; 69 font-size: 1rem; 70 font-weight: normal; 71 text-align: center; 72 } 73 74 #dndnav li.ui-sortable-placeholder, 75 #dndextra li.ui-sortable-placeholder, 76 #dndcustom li.ui-sortable-placeholder, 77 .sortable-delete li.ui-sortable-placeholder { 43 #dndnav > li.ui-sortable-placeholder, 44 #dndextra > li.ui-sortable-placeholder, 45 #dndcustom > li.ui-sortable-placeholder, 46 .sortable-delete > li.ui-sortable-placeholder { 78 47 border: 1px dashed #999; 79 48 height: 2rem; … … 81 50 } 82 51 83 #dndnav .form-note, #dndextra .form-note, #dndcustom .form-note {52 .sortable-delete { 84 53 display: none; 85 54 } 86 87 88 .widget-name {89 background: #eef;90 color: #000;91 padding: 4px 6px;92 margin: 0;93 font-weight: bold;94 }95 .widget-name span {96 display: block;97 font-style: normal;98 font-size: 1.1rem;99 }100 .widget-name img {101 cursor: pointer;102 margin-bottom: -1px;103 }104 .removeWidget {105 padding: 8px 6px;106 margin: 0;107 }108 109 .widgetSettings {110 border-top: 1px solid #ddd;111 padding: 8px 6px;112 background: #f5f5f5;113 }114 115 .sortable-delete {116 display: none;117 }118 119 55 .sortable-delete.if-drag { 120 56 border: 1px solid #999999; … … 129 65 display: block; 130 66 } 67 .sortable-delete > li { 68 margin-bottom: 3px; 69 } 70 .sortable-delete > li.sortable-delete-placeholder { 71 border: 0 none; 72 color: #FF0000; 73 font-size: 1rem; 74 font-weight: normal; 75 text-align: center; 76 } 131 77 132 #widgets .widgetSettings { 78 .widget-name { 79 background: #eef; 80 color: #000; 81 padding: 4px 6px; 82 margin: 0; 83 font-weight: bold; 84 } 85 .widget-name img { 86 cursor: pointer; 87 margin-bottom: -1px; 88 } 89 .widget-name a.aexpand, 90 .widget-name a.aexpand:link, 91 .widget-name a.aexpand:visited { 92 border: 0 none; 93 color: #000000; 94 text-decoration: none; 95 } 96 #dndnav .form-note, 97 #dndextra .form-note, 98 #dndcustom .form-note { 133 99 display: none; 134 100 } 135 .hideControls .widgetSettings { 136 display: none; 101 .removeWidget { 102 padding: 8px 6px; 103 margin: 0; 137 104 } 138 .hideControl { 105 .widgetSettings { 106 border-top: 1px solid #ddd; 107 padding: 8px 6px; 108 background: #f5f5f5; 109 } 110 111 #sidebarsControl { 112 clear: left; 113 } 114 115 /* ------------------------------------------------------------- list Widgets ref */ 116 #listWidgets { 117 float: left; 118 width: 46%; 119 background: #eee; 120 padding: 1.5em 1% 0; 121 margin: 0 1% 0 0; 122 } 123 #listWidgets h3 { 124 color: #333; 125 } 126 127 #widgets-ref { 128 padding: 1em 0; 129 margin: 1em 0 0; 130 } 131 #widgets-ref > li { 132 border: 1px solid #ccc; 133 margin-bottom: .5em; 134 background: #fff; 135 min-height: 3em; 136 padding: 0 0 4px 0; 137 list-style: none; 138 } 139 #widgets-ref .widget-name, 140 #widgets-ref .manual-move { 141 background: #fff; 142 margin-bottom: 0; 143 padding: 4px 8px 0; 144 } 145 #widgets-ref .widget-name { 146 min-height: 3em; 147 } 148 #widgets-ref .widget-name .form-note { 149 display: block; 150 font-style: normal; 151 font-size: 1.1rem; 152 } 153 #widgets-ref .widgetSettings { 139 154 display: none; 140 155 } 141 156 157 /* ------------------------------------------------------------- help */ 142 158 #widgets-tpl dt { 143 159 margin: 1em 0 0 0; -
plugins/widgets/widgets.js
r1651 r1659 1 /* 2 # -- BEGIN LICENSE BLOCK --------------------------------------- 3 # 4 # This file is part of Dotclear 2. 5 # 6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 7 # Licensed under the GPL version 2.0 license. 8 # See LICENSE file or 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 10 # 11 # -- END LICENSE BLOCK ----------------------------------------- 12 */ 13 1 14 dotclear.postExpander = function(line) { 2 15 var title = $(line).find('.widget-name'); 16 title.find('.form-note').remove(); 17 order = title.find('input[name*=order]'); 18 link = $('<a href="#" alt="expand" class="aexpand"/>').append(title.text()); 19 title.empty().append(order).append(link); 3 20 4 21 var img = document.createElement('img'); … … 7 24 img.className = 'expand'; 8 25 $(img).css('cursor','pointer'); 9 img.line = line; 10 img.onclick = function() { dotclear.viewPostContent(this.line); }; 26 img.onclick = function() { dotclear.viewPostContent($(this).parents('li')); }; 27 link.click(function(e) { 28 e.preventDefault(); 29 dotclear.viewPostContent($(this).parents('li')); 30 }); 11 31 12 32 title.prepend(img); … … 15 35 dotclear.viewPostContent = function(line,action) { 16 36 var action = action || 'toogle'; 17 var img = $(line).find('.expand');37 var img = line.find('.expand'); 18 38 var isopen = img.attr('alt') == dotclear.img_plus_alt; 19 39 20 40 if( action == 'close' || ( action == 'toogle' && !isopen ) ) { 21 $(line).find('.widgetSettings').hide();41 line.find('.widgetSettings').hide(); 22 42 img.attr('src', dotclear.img_plus_src); 23 43 img.attr('alt', dotclear.img_plus_alt); 24 44 } else if ( action == 'open' || ( action == 'toogle' && isopen ) ) { 25 $(line).find('.widgetSettings').show();45 line.find('.widgetSettings').show(); 26 46 img.attr('src', dotclear.img_minus_src); 27 47 img.attr('alt', dotclear.img_minus_alt); … … 39 59 $('#dndnav > li, #dndextra > li, #dndcustom > li').each(function() { 40 60 dotclear.postExpander(this); 41 dotclear.viewPostContent( this, 'close');61 dotclear.viewPostContent($(this), 'close'); 42 62 }); 43 63
Note: See TracChangeset
for help on using the changeset viewer.