mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-06 21:40:37 +01:00
Implement to set proper lable for dragging item on the drag helper
This commit is contained in:
parent
ffa99fcb01
commit
23c9f70dad
@ -97,6 +97,8 @@ function egwDragActionImplementation()
|
|||||||
var rows = [];
|
var rows = [];
|
||||||
// Maximum number of rows to show
|
// Maximum number of rows to show
|
||||||
var maxRows = 3;
|
var maxRows = 3;
|
||||||
|
// item label
|
||||||
|
var itemLabel = egw.lang(egw.link_get_registry(egw.app_name(),_selected.length > 1?'entries':'entry')||egw.app_name());
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for (var i = 0; i < _selected.length;i++)
|
for (var i = 0; i < _selected.length;i++)
|
||||||
@ -115,10 +117,8 @@ function egwDragActionImplementation()
|
|||||||
.addClass('et2_egw_action_ddHelper_itemsCnt')
|
.addClass('et2_egw_action_ddHelper_itemsCnt')
|
||||||
.appendTo(div);
|
.appendTo(div);
|
||||||
|
|
||||||
// TODO: get the right drag item next to the number
|
spanCnt.text(_selected.length +' '+ itemLabel);
|
||||||
var itemLabel = '';
|
// Number of not shown rows
|
||||||
spanCnt.text(_selected.length + itemLabel);
|
|
||||||
|
|
||||||
var restRows = _selected.length - maxRows;
|
var restRows = _selected.length - maxRows;
|
||||||
if (restRows)
|
if (restRows)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ function egwDragActionImplementation()
|
|||||||
|
|
||||||
// Add notice of Ctrl key, if supported
|
// Add notice of Ctrl key, if supported
|
||||||
if('draggable' in document.createElement('span') &&
|
if('draggable' in document.createElement('span') &&
|
||||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
navigator && navigator.userAgent.indexOf('Chrome') >= 0 && egw.app_name() == 'filemanager') // currently only filemanager supports drag out
|
||||||
{
|
{
|
||||||
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
||||||
text.text(egw.lang('Hold %1 to drag %2 to your computer',key, itemLabel));
|
text.text(egw.lang('Hold %1 to drag %2 to your computer',key, itemLabel));
|
||||||
@ -298,6 +298,32 @@ function egwDragActionImplementation()
|
|||||||
"start": function(e) {
|
"start": function(e) {
|
||||||
return ai.helper != null;
|
return ai.helper != null;
|
||||||
},
|
},
|
||||||
|
revert: function(valid)
|
||||||
|
{
|
||||||
|
var dTarget = this;
|
||||||
|
if (!valid)
|
||||||
|
{
|
||||||
|
// Tolerance value of pixels arround the draggable target
|
||||||
|
// to distinguish whether the action was intended for dragging or selecting content.
|
||||||
|
var tipTelorance = 10;
|
||||||
|
var helperTop = ai.helper.position().top;
|
||||||
|
|
||||||
|
if (helperTop >= dTarget.offset().top
|
||||||
|
&& helperTop <= (dTarget.height() + dTarget.offset().top) + tipTelorance)
|
||||||
|
{
|
||||||
|
var key = ["Mac68K","MacPPC","MacIntel"].indexOf(window.navigator.platform) < 0 ? 'Ctrl' : 'Command';
|
||||||
|
// Comment this out ATM till we get the ctrl and content selection functionality working
|
||||||
|
//egw.message(egw.lang('Hold %1 key to select content.', key),'info');
|
||||||
|
}
|
||||||
|
// Invalid target
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Valid target
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
// Solves problem with scroll position changing in the grid
|
// Solves problem with scroll position changing in the grid
|
||||||
// component
|
// component
|
||||||
"refreshPositions": true,
|
"refreshPositions": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user