From 03ed4e74f6e28cbb7a7a9b2584817cd49f10731c Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 6 Nov 2011 18:36:22 +0000 Subject: [PATCH] add the 'All Movies' list --- static/js/pandora/folderList.js | 1 + static/js/pandora/folders.js | 4 +++- static/js/pandora/listDialog.js | 8 +++++++- static/js/pandora/utils.js | 21 +++++++++++++++------ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/static/js/pandora/folderList.js b/static/js/pandora/folderList.js index 9556f8eb..ea941b3f 100644 --- a/static/js/pandora/folderList.js +++ b/static/js/pandora/folderList.js @@ -301,6 +301,7 @@ pandora.ui.folderList = function(id) { } else if (data.key == 'status') { var status = that.value(data.id, data.key) == 'private' ? 'public' : 'private'; pandora.changeListStatus(data.id, status, function(result) { + Ox.print('cLS', result.data); that.value(result.data.id, 'status', result.data.status); }); } else if (data.key == 'path') { diff --git a/static/js/pandora/folders.js b/static/js/pandora/folders.js index 2fa7175c..41664695 100644 --- a/static/js/pandora/folders.js +++ b/static/js/pandora/folders.js @@ -2,13 +2,15 @@ 'use strict'; pandora.ui.folders = function() { var ui = pandora.user.ui, + counter = 0, that = Ox.Element() .css({overflowX: 'hidden', overflowY: 'auto'}) .bindEvent({ resize: pandora.resizeFolders, }); - var counter = 0; //var $sections = []; + + pandora.$ui.allItems = pandora.ui.allItems().appendTo(that); pandora.$ui.folder = []; pandora.$ui.folderBrowser = {}; pandora.$ui.folderList = {}; diff --git a/static/js/pandora/listDialog.js b/static/js/pandora/listDialog.js index 35824f8e..d158e243 100644 --- a/static/js/pandora/listDialog.js +++ b/static/js/pandora/listDialog.js @@ -23,7 +23,7 @@ pandora.ui.listDialog = function(section) { } else if (id == 'icon') { return pandora.ui.listIconPanel(listData); } else if (id == 'query') { - return pandora.$ui.filter = pandora.ui.filter(listData); + return pandora.$ui.filterForm = pandora.ui.filterForm(listData); } }, tabs: tabs @@ -244,8 +244,14 @@ pandora.ui.listGeneralPanel = function(listData) { } function editStatus(data) { var status = data.selected[0].id; + $statusSelect.value(status == 'private' ? 'public' : 'private'); pandora.changeListStatus(listData.id, status, function(result) { listData.status = result.data.status; + if (result.data.status == 'private') { + subscribers = 0; + $subscribersInput.options({value: 0}); + } + $statusSelect.value(result.data.status); $subscribersInput[getSubscribersAction()](); $descriptionInput .options({height: getDescriptionHeight()}) diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index d90bae4b..d6c4f9e0 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -140,12 +140,20 @@ pandora.changeListStatus = function(id, status, callback) { if (status == 'private') { pandora.api.findLists({ query: {conditions: [{key: 'id', value: id, operator: '=='}]}, - keys: ['subscribers'] + keys: ['name', 'subscribers'] }, function(result) { - var subscribers = result.data.items[0].subscribers; + var name = result.data.items[0].name, + subscribers = result.data.items[0].subscribers; if (subscribers) { - pandora.ui.makeListPrivateDialog(subscribers, function(makePrivate) { - makePrivate && changeListStatus(); + pandora.ui.makeListPrivateDialog(name, subscribers, function(makePrivate) { + if (makePrivate) { + changeListStatus(); + } else { + callback({data: { + id: id, + status: 'public' + }}); + } }).open(); } else { changeListStatus(); @@ -156,7 +164,7 @@ pandora.changeListStatus = function(id, status, callback) { } function changeListStatus() { pandora.api.editList({ - id: is, + id: id, status: status }, callback); } @@ -505,7 +513,7 @@ pandora.getFoldersWidth = function() { Ox.Log('', 'FOLDERS HEIGHT', pandora.getFoldersHeight(), 'INFO HEIGHT', pandora.getInfoHeight()) if ( pandora.$ui.appPanel - && pandora.getFoldersHeight() > window.innerHeight - 20 - 24 - 1 - pandora.getInfoHeight() + && pandora.getFoldersHeight() > window.innerHeight - 20 - 24 -16 - 1 - pandora.getInfoHeight() ) { width -= Ox.UI.SCROLLBAR_SIZE; } @@ -809,6 +817,7 @@ pandora.resizeFolders = function() { columnWidth.name = (width - 96) - columnWidth.user; } Ox.Log('', 'RESIZE FOLDERS', width); + pandora.$ui.allItems.resizeElement(width - 104); Ox.forEach(pandora.$ui.folderList, function($list, id) { var pos = Ox.getPositionById(pandora.site.sectionFolders[pandora.user.ui.section], id); pandora.$ui.folder[pos].css({width: width + 'px'});