its an inbox

This commit is contained in:
j 2019-01-28 15:39:00 +05:30
commit aac3e66f7b
8 changed files with 58 additions and 54 deletions

View file

@ -42,7 +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]
: Ox.endsWith(list.id, ':Inbox') ? oml.$ui.inboxList[index]
: oml.$ui.folderList[index];
}
@ -66,7 +66,7 @@ oml.ui.folders = function() {
!list ? 'libraryList'
: 'folderList'
][index]
: list == 'Public' ? oml.$ui.publicList[index]
: list == 'Inbox' ? oml.$ui.inboxList[index]
: oml.$ui.folderList[index];
$lists.forEach(function($list) {
if ($list == $selectedList) {
@ -87,7 +87,7 @@ oml.ui.folders = function() {
oml.$ui.folder = [];
oml.$ui.libraryList = [];
oml.$ui.folderList = [];
oml.$ui.publicList = [];
oml.$ui.inboxList = [];
getUsersAndLists(function(users, lists) {
@ -120,10 +120,11 @@ oml.ui.folders = function() {
var $content,
items = lists.filter(function(list) {
return list.user === user.name
&& list.type != 'library' && list.name != 'Public';
&& list.type != 'library' && list.name != 'Inbox';
}),
libraryId = user.name + ':',
publicId = user.name + ':Public';
inboxId = user.name + ':Inbox',
offset = 16;
userIndex[user.name] = index;
@ -193,7 +194,7 @@ oml.ui.folders = function() {
oml.UI.set({find: getFind(data.ids[0])});
},
selectnext: function() {
oml.UI.set({find: getFind(publicId)});
oml.UI.set({find: getFind(inboxId)});
},
selectprevious: function() {
// FIXME: ugly
@ -216,27 +217,29 @@ 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';
if (user.name == '') {
$lists.push(
oml.$ui.inboxList[index] = oml.ui.folderList({
items: lists.filter(function(list) {
return list.user == user.name && list.name == 'Inbox';
})
})
})
.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'});
.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.inboxList[index].$body.css({top: offset + 'px'});
offset += 16;
}
$lists.push(
oml.$ui.folderList[index] = oml.ui.folderList({
@ -258,7 +261,7 @@ oml.ui.folders = function() {
}
},
'delete': function(data) {
!index && !Ox.contains(data.ids, ':Public') && oml.ui.deleteListDialog().open();
!index && !Ox.contains(data.ids, ':Inbox') && oml.ui.deleteListDialog().open();
},
key_control_d: function() {
oml.addList(ui._list);
@ -275,7 +278,7 @@ oml.ui.folders = function() {
});
},
open: function(data) {
!index && !Ox.contains(data.ids, ':Public') && oml.ui.listDialog().open();
!index && !Ox.contains(data.ids, ':Inbox') && oml.ui.listDialog().open();
},
select: function(data) {
oml.UI.set({find: getFind(data.ids[0])});
@ -290,14 +293,14 @@ oml.ui.folders = function() {
}
},
selectprevious: function() {
oml.UI.set({find: getFind(publicId)});
oml.UI.set({find: getFind(inboxId)});
}
})
.css({height: items.length * 16 + 'px'})
.appendTo($content)
);
oml.$ui.folderList[index].$body.css({top: '32px'});
oml.$ui.folderList[index].$body.css({top: offset + 'px'});
});
@ -353,7 +356,7 @@ oml.ui.folders = function() {
oml.$ui.folder[index].options({title: Ox.encodeHTMLEntities(name)});
oml.getLists(function(lists) {
var items = lists.filter(function(list) {
return list.user == name && list.type != 'library' && list.name != 'Public';
return list.user == name && list.type != 'library' && list.name != 'Inbox';
}),
library = lists.filter(function(list) {
return list.user == name && list.type == 'library';