From 0872435c91754f5361c6b8836b41705546ede7b8 Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 18 Jul 2013 09:52:38 +0000 Subject: [PATCH] add drag & drop to clip list in grid view --- static/js/editPanel.js | 11 ++++++++++- static/js/utils.js | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/static/js/editPanel.js b/static/js/editPanel.js index 94983d241..5016fc44b 100644 --- a/static/js/editPanel.js +++ b/static/js/editPanel.js @@ -20,6 +20,13 @@ pandora.ui.editPanel = function() { return 'editPoints.' + ui.edit.replace(/\./g, '\\.') + '.' + key; } + function enableDragAndDrop() { + pandora.enableDragAndDrop( + Ox.UI.elements[that.find('.OxIconList').data('oxid')], + edit.editable + ); + } + function getSmallTimelineURL() { var fps = 25, width = Math.floor(edit.duration * fps), @@ -48,6 +55,7 @@ pandora.ui.editPanel = function() { clip.position = edit.duration; edit.duration += clip.duration; }); + updateSmallTimelineURL(); pandora.$ui.mainPanel.replaceElement(1, that = pandora.$ui.editPanel = Ox.VideoEditPanel({ clips: Ox.clone(edit.clips), @@ -255,6 +263,7 @@ pandora.ui.editPanel = function() { }, view: function(data) { pandora.UI.set({clipView: data.view}); + data.view == 'grid' && enableDragAndDrop(); }, volume: function(data) { pandora.UI.set({videoVolume: data.volume}); @@ -270,7 +279,7 @@ pandora.ui.editPanel = function() { } }) ); - updateSmallTimelineURL(); + ui.clipView == 'grid' && enableDragAndDrop(); }); } diff --git a/static/js/utils.js b/static/js/utils.js index 077297174..3cb8de82c 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -539,9 +539,12 @@ pandora.enableDragAndDrop = function($list, canMove, section) { [targetName.singular, Ox.encodeHTMLEntities(drag.target.name)] ) : Ox._( - 'to ' + (section == 'items' - ? (pandora.user.ui._list ? 'another' : 'a') + ' ' + targetName.singular - : 'an ' + targetName.singular) + 'to ' + ( + (section == 'items' && pandora.user.ui._list) + || (section == 'edits' && pandora.user.ui.section == 'edits') + ? 'another' : (section == 'items' ? 'a' : 'an') + ) + ' {0}', + [targetName.singular] ) ); }