diff --git a/oml/user/api.py b/oml/user/api.py index 76525a9..d4bf89a 100644 --- a/oml/user/api.py +++ b/oml/user/api.py @@ -349,7 +349,7 @@ def sortLists(data): ''' n = 0 logger.debug('sortLists %s', data) - lists = [] + lists = ['Public'] for id in data['ids']: l = models.List.get(id) l.index_ = n diff --git a/static/js/folderList.js b/static/js/folderList.js index e4d77cc..44d5a57 100644 --- a/static/js/folderList.js +++ b/static/js/folderList.js @@ -7,12 +7,13 @@ oml.ui.folderList = function(options) { that = Ox.TableList({ columns: [ { - format: function(value) { + format: function(value, data) { return $('') .attr({ src: Ox.UI.getImageURL( value == 'libraries' ? 'symbolData' : value == 'library' ? 'symbolUser' + : data.name == 'Public' ? 'symbolPublish' : value == 'static' ? 'symbolClick' : 'symbolFind' ) diff --git a/static/js/folders.js b/static/js/folders.js index 256bbb8..e65dc36 100644 --- a/static/js/folders.js +++ b/static/js/folders.js @@ -42,6 +42,7 @@ oml.ui.folders = function() { }).indexOf(list.user) : null; return list.id == '' ? oml.$ui.librariesList : Ox.endsWith(list.id, ':') ? oml.$ui.libraryList[index] + : Ox.endsWith(list.id, ':Public') ? oml.$ui.publicList[index] : oml.$ui.folderList[index]; } @@ -61,7 +62,11 @@ oml.ui.folders = function() { index = userIndex[split[0]], list = split[1], $selectedList = !ui._list ? oml.$ui.librariesList - : !list ? oml.$ui[!list ? 'libraryList' : 'folderList'][index] + : !list ? oml.$ui[ + !list ? 'libraryList' + : 'folderList' + ][index] + : list == 'Public' ? oml.$ui.publicList[index] : oml.$ui.folderList[index]; $lists.forEach(function($list) { if ($list == $selectedList) { @@ -82,6 +87,7 @@ oml.ui.folders = function() { oml.$ui.folder = []; oml.$ui.libraryList = []; oml.$ui.folderList = []; + oml.$ui.publicList = []; getUsersAndLists(function(users, lists) { @@ -114,9 +120,10 @@ oml.ui.folders = function() { var $content, items = lists.filter(function(list) { return list.user === user.name - && list.type != 'library'; + && list.type != 'library' && list.name != 'Public'; }), - libraryId = user.name + ':'; + libraryId = user.name + ':', + publicId = user.name + ':Public'; userIndex[user.name] = index; @@ -168,7 +175,7 @@ oml.ui.folders = function() { $content = oml.$ui.folder[index].$content .css({ - height: (1 + items.length) * 16 + 'px' + height: (2 + items.length) * 16 + 'px' }); $lists.push( @@ -186,7 +193,7 @@ oml.ui.folders = function() { oml.UI.set({find: getFind(data.ids[0])}); }, selectnext: function() { - oml.UI.set({find: getFind(items[0].id)}); + oml.UI.set({find: getFind(publicId)}); }, selectprevious: function() { // FIXME: ugly @@ -210,6 +217,27 @@ oml.ui.folders = function() { .appendTo($content) ); + $lists.push( + oml.$ui.publicList[index] = oml.ui.folderList({ + items: lists.filter(function(list) { + return list.user == user.name && list.name == 'Public'; + }) + }) + .bindEvent({ + select: function(data) { + oml.UI.set({find: getFind(data.ids[0])}); + }, + selectnext: function() { + oml.UI.set({find: getFind(items[0].id)}); + }, + selectprevious: function() { + oml.UI.set({find: getFind(libraryId)}); + } + }) + .appendTo($content) + ); + oml.$ui.publicList[index].$body.css({top: '16px'}); + $lists.push( oml.$ui.folderList[index] = oml.ui.folderList({ draggable: !!index, @@ -262,14 +290,14 @@ oml.ui.folders = function() { } }, selectprevious: function() { - oml.UI.set({find: getFind(libraryId)}); + oml.UI.set({find: getFind(publicId)}); } }) .css({height: items.length * 16 + 'px'}) .appendTo($content) ); - oml.$ui.folderList[index].$body.css({top: '16px'}); + oml.$ui.folderList[index].$body.css({top: '32px'}); }); diff --git a/static/js/utils.js b/static/js/utils.js index d61736f..f64412a 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -316,7 +316,7 @@ oml.enableDragAndDrop = function($list, canMove) { $list.bindEvent({ draganddropstart: function(data) { - var $lists = oml.$ui.libraryList.concat(oml.$ui.folderList); + var $lists = oml.$ui.libraryList.concat(oml.$ui.publicList).concat(oml.$ui.folderList); drag.action = 'copy'; drag.ids = $list.options('selected'); drag.item = drag.ids.length == 1 @@ -992,6 +992,9 @@ oml.resizeListFolders = function() { oml.$ui.libraryList[index] .css({width: width + 'px'}) .resizeColumn('name', columnWidth); + oml.$ui.publicList[index] + .css({width: width + 'px'}) + .resizeColumn('name', columnWidth); oml.$ui.folderList[index] .css({width: width + 'px'}) .resizeColumn('name', columnWidth);