display featured edits on home screen
This commit is contained in:
parent
9c4b31c453
commit
47f59c26ae
2 changed files with 50 additions and 34 deletions
|
@ -314,24 +314,25 @@ pandora.ui.home = function() {
|
||||||
keys: ['description', 'modified', 'name', 'user'],
|
keys: ['description', 'modified', 'name', 'user'],
|
||||||
sort: [{key: 'position', operator: '+'}]
|
sort: [{key: 'position', operator: '+'}]
|
||||||
},
|
},
|
||||||
items, lists, texts;
|
items, lists, edits, texts;
|
||||||
pandora.api.findLists(find, function(result) {
|
pandora.api.findLists(find, function(result) {
|
||||||
lists = result.data.items.length;
|
lists = result.data.items.length;
|
||||||
items = result.data.items.map(function(item) {
|
items = result.data.items.map(function(item) {
|
||||||
return Ox.extend(item, {type: 'list'});
|
return Ox.extend(item, {type: 'list'});
|
||||||
});
|
});
|
||||||
pandora.api.findTexts(find, function(result) {
|
pandora.api.findEdits(find, function(result) {
|
||||||
texts = result.data.items.length
|
edits = result.data.items.length;
|
||||||
items = items.concat(result.data.items.map(function(item) {
|
items = items.concat(result.data.items.map(function(item) {
|
||||||
return Ox.extend(item, {type: 'text'});
|
return Ox.extend(item, {type: 'edit'});
|
||||||
}));
|
}));
|
||||||
$features.empty();
|
pandora.api.findTexts(find, function(result) {
|
||||||
show();
|
texts = result.data.items.length;
|
||||||
return;
|
items = items.concat(result.data.items.map(function(item) {
|
||||||
if (featured.lists.length) {
|
return Ox.extend(item, {type: 'text'});
|
||||||
top += 24;
|
}));
|
||||||
}
|
$features.empty();
|
||||||
show('texts');
|
show();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
function show() {
|
function show() {
|
||||||
|
@ -347,11 +348,16 @@ pandora.ui.home = function() {
|
||||||
$label = Ox.Label({
|
$label = Ox.Label({
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
title: '<b>' + Ox._('Featured ' + (
|
title: '<b>' + Ox._('Featured ' + (
|
||||||
lists == 1 && texts == 0 ? 'List'
|
lists == 1 && edits == 0 && texts == 0 ? 'List'
|
||||||
: lists == 0 && texts == 1 ? 'Text'
|
: lists == 0 && edits == 1 && texts == 0 ? 'Edit'
|
||||||
: texts == 0 ? 'Lists'
|
: lists == 0 && edits == 0 && texts == 1 ? 'Text'
|
||||||
: lists == 0 ? 'Texts'
|
: edits == 0 && texts == 0 ? 'Lists'
|
||||||
: 'Lists and Texts'
|
: lists == 0 && texts == 0 ? 'Edits'
|
||||||
|
: lists == 0 && edits == 0 ? 'Texts'
|
||||||
|
: texts == 0 ? 'Lists and Edits'
|
||||||
|
: edits == 0 ? 'Lists and Texts'
|
||||||
|
: lists == 0 ? 'Edits and Texts'
|
||||||
|
: 'Lists, Edits and Texts'
|
||||||
)) + '</b>',
|
)) + '</b>',
|
||||||
width: 512
|
width: 512
|
||||||
})
|
})
|
||||||
|
@ -602,7 +608,7 @@ pandora.ui.home = function() {
|
||||||
function openItem(i) {
|
function openItem(i) {
|
||||||
that.fadeOutScreen();
|
that.fadeOutScreen();
|
||||||
pandora.UI.set(Ox.extend({
|
pandora.UI.set(Ox.extend({
|
||||||
section: items[i].type == 'list' ? 'items' : 'texts',
|
section: items[i].type == 'list' ? 'items' : items[i].type + 's',
|
||||||
page: ''
|
page: ''
|
||||||
}, items[i].type == 'list' ? {
|
}, items[i].type == 'list' ? {
|
||||||
find: {
|
find: {
|
||||||
|
@ -614,6 +620,8 @@ pandora.ui.home = function() {
|
||||||
}],
|
}],
|
||||||
operator: '&'
|
operator: '&'
|
||||||
}
|
}
|
||||||
|
} : items[i].type == 'edit' ? {
|
||||||
|
edit: items[i].user + ':' + items[i].name
|
||||||
} : {
|
} : {
|
||||||
text: items[i].user + ':' + items[i].name
|
text: items[i].user + ':' + items[i].name
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -286,24 +286,25 @@ pandora.ui.home = function() {
|
||||||
keys: ['description', 'modified', 'name', 'user'],
|
keys: ['description', 'modified', 'name', 'user'],
|
||||||
sort: [{key: 'position', operator: '+'}]
|
sort: [{key: 'position', operator: '+'}]
|
||||||
},
|
},
|
||||||
items, lists, texts;
|
items, lists, edits, texts;
|
||||||
pandora.api.findLists(find, function(result) {
|
pandora.api.findLists(find, function(result) {
|
||||||
lists = result.data.items.length;
|
lists = result.data.items.length;
|
||||||
items = result.data.items.map(function(item) {
|
items = result.data.items.map(function(item) {
|
||||||
return Ox.extend(item, {type: 'list'});
|
return Ox.extend(item, {type: 'list'});
|
||||||
});
|
});
|
||||||
pandora.api.findTexts(find, function(result) {
|
pandora.api.findEdits(find, function(result) {
|
||||||
texts = result.data.items.length
|
edits = result.data.items.length;
|
||||||
items = items.concat(result.data.items.map(function(item) {
|
items = items.concat(result.data.items.map(function(item) {
|
||||||
return Ox.extend(item, {type: 'text'});
|
return Ox.extend(item, {type: 'edit'});
|
||||||
}));
|
}));
|
||||||
$features.empty();
|
pandora.api.findTexts(find, function(result) {
|
||||||
show();
|
texts = result.data.items.length;
|
||||||
return;
|
items = items.concat(result.data.items.map(function(item) {
|
||||||
if (featured.lists.length) {
|
return Ox.extend(item, {type: 'text'});
|
||||||
top += 24;
|
}));
|
||||||
}
|
$features.empty();
|
||||||
show('texts');
|
show();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
function show() {
|
function show() {
|
||||||
|
@ -319,11 +320,16 @@ pandora.ui.home = function() {
|
||||||
$label = Ox.Label({
|
$label = Ox.Label({
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
title: '<b>' + Ox._('Featured ' + (
|
title: '<b>' + Ox._('Featured ' + (
|
||||||
lists == 1 && texts == 0 ? 'List'
|
lists == 1 && edits == 0 && texts == 0 ? 'List'
|
||||||
: lists == 0 && texts == 1 ? 'Text'
|
: lists == 0 && edits == 1 && texts == 0 ? 'Edit'
|
||||||
: texts == 0 ? 'Lists'
|
: lists == 0 && edits == 0 && texts == 1 ? 'Text'
|
||||||
: lists == 0 ? 'Texts'
|
: edits == 0 && texts == 0 ? 'Lists'
|
||||||
: 'Lists and Texts'
|
: lists == 0 && texts == 0 ? 'Edits'
|
||||||
|
: lists == 0 && edits == 0 ? 'Texts'
|
||||||
|
: texts == 0 ? 'Lists and Edits'
|
||||||
|
: edits == 0 ? 'Lists and Texts'
|
||||||
|
: lists == 0 ? 'Edits and Texts'
|
||||||
|
: 'Lists, Edits and Texts'
|
||||||
)) + '</b>',
|
)) + '</b>',
|
||||||
width: 512
|
width: 512
|
||||||
})
|
})
|
||||||
|
@ -574,7 +580,7 @@ pandora.ui.home = function() {
|
||||||
function openItem(i) {
|
function openItem(i) {
|
||||||
that.fadeOutScreen();
|
that.fadeOutScreen();
|
||||||
pandora.UI.set(Ox.extend({
|
pandora.UI.set(Ox.extend({
|
||||||
section: items[i].type == 'list' ? 'items' : 'texts',
|
section: items[i].type == 'list' ? 'items' : items[i].type + 's',
|
||||||
page: ''
|
page: ''
|
||||||
}, items[i].type == 'list' ? {
|
}, items[i].type == 'list' ? {
|
||||||
find: {
|
find: {
|
||||||
|
@ -586,6 +592,8 @@ pandora.ui.home = function() {
|
||||||
}],
|
}],
|
||||||
operator: '&'
|
operator: '&'
|
||||||
}
|
}
|
||||||
|
} : items[i].type == 'edit' ? {
|
||||||
|
edit: items[i].user + ':' + items[i].name
|
||||||
} : {
|
} : {
|
||||||
text: items[i].user + ':' + items[i].name
|
text: items[i].user + ':' + items[i].name
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue