move public list to the top
This commit is contained in:
parent
61fff0a8d7
commit
9c393cdd56
4 changed files with 42 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -7,12 +7,13 @@ oml.ui.folderList = function(options) {
|
|||
that = Ox.TableList({
|
||||
columns: [
|
||||
{
|
||||
format: function(value) {
|
||||
format: function(value, data) {
|
||||
return $('<img>')
|
||||
.attr({
|
||||
src: Ox.UI.getImageURL(
|
||||
value == 'libraries' ? 'symbolData'
|
||||
: value == 'library' ? 'symbolUser'
|
||||
: data.name == 'Public' ? 'symbolPublish'
|
||||
: value == 'static' ? 'symbolClick'
|
||||
: 'symbolFind'
|
||||
)
|
||||
|
|
|
@ -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'});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue