* Finish task #53831.
This commit is contained in:
@@ -20,3 +20,21 @@ span.dotted-line+a {display: block;}
|
||||
.tree li.has-list.open:before {content: unset;}
|
||||
#modules i.icon-file-text {color: #D0D2D6; font-size: 14px;}
|
||||
.tree li>a {max-width: 80%;}
|
||||
|
||||
.sortable-sorting .module-name > a {cursor: move;}
|
||||
.sortable-sorting li >.tree-group {opacity: .5;}
|
||||
.sortable-sorting .drop-here .tree-group {background-color: #fff3e0;}
|
||||
.sortable-sorting .drop-here .tree-group > * {opacity: .1;}
|
||||
.sortable-sorting .drag-shadow .tree-group {opacity: 1!important;}
|
||||
.sortable-sorting .drag-shadow .tree-actions {visibility: hidden;}
|
||||
.is-sorting > li > .tree-group {opacity: 1; border-radius: 4px;}
|
||||
.is-sorting > li ul {display: none!important;}
|
||||
|
||||
.tree-group {position: relative;}
|
||||
.tree-group > .module-name {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; display: block;}
|
||||
.tree-group .tree-actions {display: none; position: absolute; right: 0; top: 0; background-color: #fff; white-space: nowrap;}
|
||||
.tree-group:hover > .module-name {width: calc(100% - 20px);}
|
||||
.tree-group:hover .tree-actions {display: block}
|
||||
.tree li.has-list.open:before {left: 6px;}
|
||||
.sortDoc>.tail-info{right: 20px;}
|
||||
.sortDoc>.tree-actions{position: absolute; right: 0px; background: #fff;}
|
||||
|
||||
@@ -18,4 +18,81 @@ $(function()
|
||||
})
|
||||
|
||||
$('.menu-actions > a').blur(function() {$(this).css('background', 'none');})
|
||||
|
||||
/* Make modules tree sortable. */
|
||||
$('#modules').sortable(
|
||||
{
|
||||
trigger: '.module-name>a.sort-module, .tree-actions>.sortModule>.icon-move, .module-name>a.sortDoc, .tree-actions>.sortDoc>.icon-move',
|
||||
dropToClass: 'sort-to',
|
||||
stopPropagation: true,
|
||||
nested: true,
|
||||
selector: 'li',
|
||||
dragCssClass: 'drop-here',
|
||||
canMoveHere: function($ele, $target)
|
||||
{
|
||||
var maxTop = $('.side-col > .cell > ul').height() - $ele.height();
|
||||
if(parseFloat($('.drag-shadow').css('top')) < 0) $('.drag-shadow').css('top', '0');
|
||||
if(parseFloat($('.drag-shadow').css('left')) != 0) $('.drag-shadow').css('left', '0');
|
||||
if(parseFloat($('.drag-shadow').css('top')) > maxTop) $('.drag-shadow').css('top', maxTop + 'px');
|
||||
return true;
|
||||
},
|
||||
targetSelector: function($ele, $root)
|
||||
{
|
||||
var $ul = $ele.closest('ul');
|
||||
setTimeout(function()
|
||||
{
|
||||
if($('#modules').hasClass('sortable-sorting')) $ul.addClass('is-sorting');
|
||||
}, 100);
|
||||
|
||||
if($ele.hasClass('sortDoc'))
|
||||
{
|
||||
return $ul.children('li.sortDoc');
|
||||
}
|
||||
else
|
||||
{
|
||||
return $ul.children('li.catalog');
|
||||
}
|
||||
},
|
||||
always: function()
|
||||
{
|
||||
$('#modules,#modules .is-sorting').removeClass('is-sorting');
|
||||
},
|
||||
finish: function(e)
|
||||
{
|
||||
if(!e.changed) return;
|
||||
|
||||
var orders = {};
|
||||
var link = '';
|
||||
var elementClass = e.list.context.className;
|
||||
if(elementClass.indexOf('sortDoc') >= 0)
|
||||
{
|
||||
$('#modules').find('li.sortDoc').each(function()
|
||||
{
|
||||
var $li = $(this);
|
||||
|
||||
var item = $li.data();
|
||||
orders['orders[' + item.id + ']'] = $li.attr('data-order') || item.order;
|
||||
});
|
||||
|
||||
link = createLink('doc', 'updateOrder');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#modules').find('li.can-sort').each(function()
|
||||
{
|
||||
var $li = $(this);
|
||||
|
||||
var item = $li.data();
|
||||
'<?php echo $type;?>' == 'book' ? orders['sort[' + item.id + ']'] = $li.attr('data-order') || item.order : orders['orders[' + item.id + ']'] = $li.attr('data-order') || item.order;
|
||||
});
|
||||
|
||||
link = createLink('tree', 'updateOrder');
|
||||
}
|
||||
|
||||
$.post(link, orders, function(data){}).error(function()
|
||||
{
|
||||
bootbox.alert(lang.timeout);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
+19
-6
@@ -2486,7 +2486,13 @@ EOT;
|
||||
|
||||
if($currentMethod == 'tablecontents')
|
||||
{
|
||||
$treeMenu[$module->id] .= '<span class="tail-info">' . zget($users, $doc->editedBy) . ' ' . $doc->editedDate . '</span>';
|
||||
$treeMenu[$module->id] .= '<div class="tree-group"><span class="tail-info">' . zget($users, $doc->editedBy) . ' ' . $doc->editedDate . '</span>';
|
||||
if(common::hasPriv('doc', 'updateOrder'))
|
||||
{
|
||||
$treeMenu[$module->id] .= "<div class='tree-actions'>";
|
||||
$treeMenu[$module->id] .= html::a('javascript:;', "<i class='icon icon-move sortDoc'></i>", '', "title='{$this->lang->doc->updateOrder}' class='sortDoc'");
|
||||
$treeMenu[$module->id] .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if($currentMethod == 'objectlibs')
|
||||
@@ -2504,7 +2510,9 @@ EOT;
|
||||
}
|
||||
elseif($currentMethod == 'tablecontents')
|
||||
{
|
||||
$treeMenu[$module->id] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title' title='{$doc->title}'");
|
||||
$class = common::hasPriv('doc', 'updateOrder') ? 'sortDoc' : '';
|
||||
$treeMenu[$module->id] .= html::a(inlink('objectLibs', "type=$type&objectID=$objectID&libID=$libID&docID={$doc->id}"), "<i class='icon icon-file-text text-muted'></i> " . $doc->title, '', "data-app='{$this->app->tab}' class='doc-title $class' title='{$doc->title}'");
|
||||
$treeMenu[$module->id] .= '</div>';
|
||||
}
|
||||
|
||||
$treeMenu[$module->id] .= '</li>';
|
||||
@@ -2518,14 +2526,19 @@ EOT;
|
||||
}
|
||||
else
|
||||
{
|
||||
$li = "<div class='tree-group'><span class='module-name'><a class='sort-module' title='{$module->name}'>" . $module->name . '</a></span>';
|
||||
if($currentMethod == 'tablecontents')
|
||||
{
|
||||
$li = "<a title='{$module->name}'>" . $module->name . '</a>';
|
||||
if(common::hasPriv('tree', 'updateOrder'))
|
||||
{
|
||||
$li .= "<div class='tree-actions'>";
|
||||
$li .= html::a('javascript:;', "<i class='icon icon-move sortModule'></i>", '', "title='{$this->lang->doc->updateOrder}' class='sortModule'");
|
||||
$li .= '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$li = "<div class='tree-group'><span class='module-name'><a class='sort-module' title='{$module->name}'>" . $module->name . '</a></span>';
|
||||
if(common::hasPriv('tree', 'edit') or common::hasPriv('tree', 'browse') or common::hasPriv('tree', 'updateOrder'))
|
||||
if(common::hasPriv('tree', 'edit') or common::hasPriv('tree', 'browse') or common::hasPriv('tree', 'browse') or common::hasPriv('tree', 'updateOrder'))
|
||||
{
|
||||
$li .= "<div class='tree-actions'>";
|
||||
if(common::hasPriv('tree', 'edit')) $li .= html::a(helper::createLink('tree', 'edit', "module=$module->id&type=doc"), "<i class='icon icon-edit'></i>", '', "data-toggle='modal' title='{$this->lang->doc->editType}'");
|
||||
@@ -2533,8 +2546,8 @@ EOT;
|
||||
if(common::hasPriv('tree', 'updateOrder')) $li .= html::a('javascript:;', "<i class='icon icon-move sortModule'></i>", '', "title='{$this->lang->doc->updateOrder}' class='sortModule'");
|
||||
$li .= '</div>';
|
||||
}
|
||||
$li .= '</div>';
|
||||
}
|
||||
$li .= '</div>';
|
||||
}
|
||||
if($treeMenu[$module->id])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user