during drag clip to edit, left panel section != ui.section, so pass section to utility functions (resizeFolders, getFoldersWidth, getFoldersHeight, getInfoHeight, getAllItemsTitle)

This commit is contained in:
rolux 2013-07-18 10:42:16 +00:00
parent 0872435c91
commit 197c5ca9ff
3 changed files with 38 additions and 28 deletions

View file

@ -1,6 +1,7 @@
'use strict'; 'use strict';
pandora.ui.allItems = function(section) { pandora.ui.allItems = function(section) {
section = section || pandora.user.ui.section; section = section || pandora.user.ui.section;
var canAddItems = !pandora.site.itemRequiresVideo && pandora.site.capabilities.canAddItems[pandora.user.level], var canAddItems = !pandora.site.itemRequiresVideo && pandora.site.capabilities.canAddItems[pandora.user.level],
@ -41,7 +42,7 @@ pandora.ui.allItems = function(section) {
overflow: 'hidden', overflow: 'hidden',
whiteSpace: 'nowrap' whiteSpace: 'nowrap'
}) })
.html(pandora.getAllItemsTitle()) .html(pandora.getAllItemsTitle(section))
.appendTo(that), .appendTo(that),
$items; $items;
@ -83,6 +84,7 @@ pandora.ui.allItems = function(section) {
}, function(result) { }, function(result) {
that.update(result.data.items); that.update(result.data.items);
}); });
} else if (section == 'edits') {
} else if (section == 'texts') { } else if (section == 'texts') {
Ox.Button({ Ox.Button({
style: 'symbol', style: 'symbol',

View file

@ -11,8 +11,6 @@ pandora.ui.folders = function(section) {
}), }),
folderItems = section == 'items' ? 'Lists' : Ox.toTitleCase(section), folderItems = section == 'items' ? 'Lists' : Ox.toTitleCase(section),
folderItem = folderItems.slice(0, -1); folderItem = folderItems.slice(0, -1);
//var $sections = [];
pandora.$ui.allItems = pandora.ui.allItems(section).appendTo(that); pandora.$ui.allItems = pandora.ui.allItems(section).appendTo(that);
pandora.$ui.folder = []; pandora.$ui.folder = [];
pandora.$ui.folderBrowser = {}; pandora.$ui.folderBrowser = {};
@ -317,7 +315,6 @@ pandora.ui.folders = function(section) {
pandora.resizeFolders(); pandora.resizeFolders();
} }
}); });
//$sections.push(pandora.$section[i]);
pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id, section) pandora.$ui.folderList[folder.id] = pandora.ui.folderList(folder.id, section)
.bindEvent({ .bindEvent({
selectnext: function() { selectnext: function() {
@ -333,7 +330,7 @@ pandora.ui.folders = function(section) {
pandora.$ui.folder.forEach(function($folder) { pandora.$ui.folder.forEach(function($folder) {
that.append($folder); that.append($folder);
}); });
pandora.resizeFolders(); pandora.resizeFolders(section);
pandora.selectList(); pandora.selectList();
} }
} }

View file

@ -297,8 +297,11 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
$list.bindEvent({ $list.bindEvent({
draganddropstart: function(data) { draganddropstart: function(data) {
pandora.user.ui.section != section && pandora.$ui.mainPanel.replaceElement(0, if (section != pandora.user.ui.section) {
pandora.$ui.leftPanel = pandora.ui.leftPanel(section)); pandora.$ui.mainPanel.replaceElement(0,
pandora.$ui.leftPanel = pandora.ui.leftPanel(section)
);
}
drag.action = 'copy'; drag.action = 'copy';
drag.ids = $list.options('selected'), drag.ids = $list.options('selected'),
drag.item = drag.ids.length == 1 drag.item = drag.ids.length == 1
@ -326,7 +329,7 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
} }
}); });
}); });
}, pandora.user.ui.section != section ? 2000 : 0); }, section != pandora.user.ui.section ? 2000 : 0);
$tooltip.options({title: getTitle()}).show(data.event); $tooltip.options({title: getTitle()}).show(data.event);
canMove && Ox.UI.$window.on({ canMove && Ox.UI.$window.on({
keydown: keydown, keydown: keydown,
@ -471,7 +474,7 @@ pandora.enableDragAndDrop = function($list, canMove, section) {
$('.OxDroppable').removeClass('OxDroppable'); $('.OxDroppable').removeClass('OxDroppable');
$('.OxDrop').removeClass('OxDrop'); $('.OxDrop').removeClass('OxDrop');
$tooltip.hide(); $tooltip.hide();
pandora.user.ui.section != section && setTimeout(function() { section != pandora.user.ui.section && setTimeout(function() {
pandora.$ui.mainPanel.replaceElement(0, pandora.$ui.mainPanel.replaceElement(0,
pandora.$ui.leftPanel = pandora.ui.leftPanel()); pandora.$ui.leftPanel = pandora.ui.leftPanel());
}, 500); }, 500);
@ -630,10 +633,11 @@ pandora.exitFullscreen = function() {
pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE); pandora.user.ui.showBrowser && pandora.$ui.contentPanel.size(0, 112 + Ox.UI.SCROLLBAR_SIZE);
}; };
pandora.getAllItemsTitle = function() { pandora.getAllItemsTitle = function(section) {
return pandora.user.ui.section == 'items' section = section || pandora.user.ui.section;
return section == 'items'
? Ox._('All {0}', [Ox._(pandora.site.itemName.plural)]) ? Ox._('All {0}', [Ox._(pandora.site.itemName.plural)])
: Ox._('{0} ' + Ox.toTitleCase(pandora.user.ui.section), [pandora.site.site.name]); : Ox._('{0} ' + Ox.toTitleCase(section), [pandora.site.site.name]);
}; };
pandora.getClipsItems = function(width) { pandora.getClipsItems = function(width) {
@ -746,22 +750,24 @@ pandora.getFilterSizes = function() {
); );
}; };
pandora.getFoldersHeight = function() { pandora.getFoldersHeight = function(section) {
section = section || pandora.user.ui.section;
var height = 0; var height = 0;
pandora.site.sectionFolders[pandora.user.ui.section].forEach(function(folder, i) { pandora.site.sectionFolders[section].forEach(function(folder, i) {
height += 16 + pandora.user.ui.showFolder[pandora.user.ui.section][folder.id] * ( height += 16 + pandora.user.ui.showFolder[section][folder.id] * (
!!folder.showBrowser * 40 + folder.items * 16 !!folder.showBrowser * 40 + folder.items * 16
); );
}); });
return height; return height;
}; };
pandora.getFoldersWidth = function() { pandora.getFoldersWidth = function(section) {
section = section || pandora.user.ui.section;
var width = pandora.user.ui.sidebarSize; var width = pandora.user.ui.sidebarSize;
Ox.Log('', 'FOLDERS HEIGHT', pandora.getFoldersHeight(), 'INFO HEIGHT', pandora.getInfoHeight())
if ( if (
pandora.$ui.appPanel pandora.$ui.appPanel
&& pandora.getFoldersHeight() > window.innerHeight - 20 - 24 -16 - 1 - pandora.getInfoHeight() && pandora.getFoldersHeight(section)
> window.innerHeight - 20 - 24 -16 - 1 - pandora.getInfoHeight(section)
) { ) {
width -= Ox.UI.SCROLLBAR_SIZE; width -= Ox.UI.SCROLLBAR_SIZE;
} }
@ -819,11 +825,17 @@ pandora.getHash = function(state, callback) {
callback(); callback();
}; };
pandora.getInfoHeight = function(includeHidden) { pandora.getInfoHeight = function(section, includeHidden) {
// Note: Either argument can be ommitted
// fixme: new, check if it can be used more // fixme: new, check if it can be used more
section = section || pandora.user.ui.section;
if (arguments.length == 1 && Ox.isBoolean(arguments[0])) {
section = pandora.user.ui.section;
includeHidden = arguments[0];
}
var height = 0, isVideoPreview; var height = 0, isVideoPreview;
if (pandora.user.ui.showInfo || includeHidden) { if (pandora.user.ui.showInfo || includeHidden) {
isVideoPreview = pandora.user.ui.section == 'items' && ( isVideoPreview = section == 'items' && (
pandora.user.ui.item || ( pandora.user.ui.item || (
pandora.user.ui.listSelection.length && !pandora.isClipView() pandora.user.ui.listSelection.length && !pandora.isClipView()
) )
@ -1605,19 +1617,18 @@ pandora.resizeFilters = function(width) {
}); });
}; };
pandora.resizeFolders = function() { pandora.resizeFolders = function(section) {
var width = pandora.getFoldersWidth(), section = section || pandora.user.ui.section;
columnWidth = width - ( var width = pandora.getFoldersWidth(section),
pandora.user.ui.section == 'items' ? 96 : 48 columnWidth = width - (section == 'items' ? 96 : 48),
),
userColumnWidth = Math.round(columnWidth * 0.4), userColumnWidth = Math.round(columnWidth * 0.4),
nameColumnWidth = columnWidth - userColumnWidth; nameColumnWidth = columnWidth - userColumnWidth;
pandora.$ui.allItems && pandora.$ui.allItems.resizeElement(columnWidth - 8); pandora.$ui.allItems && pandora.$ui.allItems.resizeElement(columnWidth - 8);
Ox.forEach(pandora.$ui.folderList, function($list, id) { Ox.forEach(pandora.$ui.folderList, function($list, id) {
var pos = Ox.getIndexById(pandora.site.sectionFolders[pandora.user.ui.section], id); var pos = Ox.getIndexById(pandora.site.sectionFolders[section], id);
pandora.$ui.folder[pos].css({width: width + 'px'}); pandora.$ui.folder[pos].css({width: width + 'px'});
$list.css({width: width + 'px'}); $list.css({width: width + 'px'});
if (pandora.site.sectionFolders[pandora.user.ui.section][pos].showBrowser) { if (pandora.site.sectionFolders[section][pos].showBrowser) {
pandora.$ui.findListInput[id].options({ pandora.$ui.findListInput[id].options({
width: width - 24 width: width - 24
}); });
@ -1626,7 +1637,7 @@ pandora.resizeFolders = function() {
} else { } else {
$list.resizeColumn(id == 'favorite' ? 'id' : 'name', columnWidth); $list.resizeColumn(id == 'favorite' ? 'id' : 'name', columnWidth);
} }
if (!pandora.user.ui.showFolder[pandora.user.ui.section][id]) { if (!pandora.user.ui.showFolder[section][id]) {
pandora.$ui.folder[pos].updatePanel(); pandora.$ui.folder[pos].updatePanel();
} }
}); });