move public list to the top
This commit is contained in:
parent
61fff0a8d7
commit
9c393cdd56
4 changed files with 42 additions and 10 deletions
|
|
@ -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'});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue