Updated Branches: refs/heads/ui-vpc-redesign 612ce62ca -> 34d7014c8
ACL multi-edit: Fix reorder drag handle Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/34d7014c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/34d7014c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/34d7014c Branch: refs/heads/ui-vpc-redesign Commit: 34d7014c88490c5de009128086f1c273275580cb Parents: 612ce62 Author: Brian Federle <bfede...@gmail.com> Authored: Wed May 15 15:58:55 2013 -0700 Committer: Brian Federle <bfede...@gmail.com> Committed: Wed May 15 15:58:55 2013 -0700 ---------------------------------------------------------------------- ui/scripts/ui/widgets/multiEdit.js | 48 ++----------------------------- ui/scripts/vpc.js | 8 ++++- 2 files changed, 10 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34d7014c/ui/scripts/ui/widgets/multiEdit.js ---------------------------------------------------------------------- diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js index 0f1515f..14f379f 100755 --- a/ui/scripts/ui/widgets/multiEdit.js +++ b/ui/scripts/ui/widgets/multiEdit.js @@ -41,30 +41,6 @@ // Add reorder actions if (reorder) { - var sort = function($tr, action) { - var $listView = $tr.closest('.data-body'); - var viewArgs = $listView.data('view-args'); - var context = $.extend( - true, {}, - options.context - ); - var rowIndex = $tr.closest('.data-body').find('.data-item').size() - ($tr.closest('.data-item').index()); - - context[viewArgs.activeSection] = $tr.data('json-obj'); - - action.action({ - context: context, - index: rowIndex, - response: { - success: function(args) {}, - error: function(args) { - // Move back to previous position - rowActions.moveTo($tr, rowIndex); - } - } - }); - }; - $('<td>').addClass('actions reorder').appendTo($tr).append(function() { var $td = $(this); @@ -99,27 +75,6 @@ }); }); }); - - // Draggable action - var initDraggable = function($dataItem) { - var originalIndex; - - return $dataItem.sortable({ - handle: '.action.moveDrag', - start: function(event, ui) { - originalIndex = ui.item.index(); - }, - stop: function(event, ui) { - $dataItem.closest('.data-body').find('.data-item').each(function() { - sort($(this), reorder.moveDrag); - }); - } - }); - }; - - if (reorder && reorder.moveDrag) { - initDraggable($tr.closest('.data-item')); - } } @@ -872,6 +827,9 @@ $.fn.multiEdit = function(args) { if (reorder) { $('<th>').addClass('reorder').appendTo($thead); $('<td>').addClass('reorder').appendTo($inputForm); + $multi.find('.data-body').sortable({ + handle: '.action.moveDrag' + }); } $.each(args.fields, function(fieldName, field) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34d7014c/ui/scripts/vpc.js ---------------------------------------------------------------------- diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 1e3efb7..8e39314 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -27,7 +27,13 @@ return hiddenFields; // Returns fields to be hidden }, - reorder: cloudStack.api.actions.sort('updateAclRule', 'multiRule'), + reorder: { + moveDrag: { + action: function(args) { + args.response.success(); + } + } + }, fields: { 'cidrlist': { edit: true, label: 'label.cidr' }, 'protocol': {