some collection info

This commit is contained in:
j 2017-01-26 18:47:24 +01:00
parent 8c6d27cf39
commit 3a9c269b5e

View file

@ -13,14 +13,14 @@ pandora.ui.info = function() {
toggle: function(data) { toggle: function(data) {
pandora.UI.set({showInfo: !data.collapsed}); pandora.UI.set({showInfo: !data.collapsed});
}, },
pandora_documentlist: function() { pandora_edit: updateInfo,
if (pandora.user.ui._collection != pandora.UI.getPrevious('_collection')) { pandora_find: function() {
if (ui._list != pandora.UI.getPrevious('_list')) {
updateInfo(); updateInfo();
} }
}, },
pandora_edit: updateInfo, pandora_finddocuments: function() {
pandora_find: function() { if (ui._collection != pandora.UI.getPrevious('_collection')) {
if (pandora.user.ui._list != pandora.UI.getPrevious('_list')) {
updateInfo(); updateInfo();
} }
}, },
@ -54,6 +54,13 @@ pandora.ui.info = function() {
} }
function getId() { function getId() {
if (ui.section == 'documents') {
return ui[folderItem.toLowerCase()] || (
ui.collectionSelection.length
? ui.collectionSelection[0]
: null
);
}
return ui[folderItem.toLowerCase()] || ( return ui[folderItem.toLowerCase()] || (
ui.listSelection.length ui.listSelection.length
? ui.listSelection[0] ? ui.listSelection[0]
@ -62,13 +69,17 @@ pandora.ui.info = function() {
} }
function getView() { function getView() {
return ui.section == 'items' if (ui.section == 'items') {
? !getId() return !getId()
? 'list' ? 'list'
: !ui.item && pandora.isClipView() : !ui.item && pandora.isClipView()
? 'poster' ? 'poster'
: 'video' : 'video';
: folderItem.toLowerCase(); } else if (ui.section == 'documents') {
return !getId() ? 'collection' : 'document';
} else {
return folderItem.toLowerCase();
}
} }
function resizeInfo() { function resizeInfo() {
@ -82,7 +93,7 @@ pandora.ui.info = function() {
var id = getId(), var id = getId(),
previousView = view; previousView = view;
view = getView(); view = getView();
if (view == 'list' || view == 'edit' || view == 'text') { if (view == 'list' || view == 'edit' || view == 'collection') {
emptyInfo(); emptyInfo();
that.append(pandora.$ui.listInfo = pandora.ui.listInfo()); that.append(pandora.$ui.listInfo = pandora.ui.listInfo());
previousView == 'video' && resizeInfo(); previousView == 'video' && resizeInfo();
@ -96,6 +107,12 @@ pandora.ui.info = function() {
); );
previousView == 'video' && resizeInfo(); previousView == 'video' && resizeInfo();
}); });
} else if (view == 'document') {
//FIXME: document info
emptyInfo();
if(!pandora.user.ui.document) {
that.append(pandora.$ui.listInfo = pandora.ui.listInfo());
}
} else if (view == 'video') { } else if (view == 'video') {
pandora.api.get({ pandora.api.get({
id: id, id: id,
@ -193,7 +210,11 @@ pandora.ui.listInfo = function() {
var ui = pandora.user.ui, var ui = pandora.user.ui,
folderItems = pandora.getFolderItems(ui.section), folderItems = pandora.getFolderItems(ui.section),
folderItem = folderItems.slice(0, -1), folderItem = folderItems.slice(0, -1),
list = pandora.user.ui.section == 'items' ? pandora.user.ui._list : ui[folderItem.toLowerCase()], list = pandora.user.ui.section == 'items'
? pandora.user.ui._list
: pandora.user.ui.section == 'documents'
? pandora.user.ui._collection
: ui[folderItem.toLowerCase()],
canEditFeaturedLists = pandora.site.capabilities['canEditFeatured' + folderItems][pandora.user.level], canEditFeaturedLists = pandora.site.capabilities['canEditFeatured' + folderItems][pandora.user.level],
that = Ox.Element().css({padding: '16px', textAlign: 'center'}), that = Ox.Element().css({padding: '16px', textAlign: 'center'}),
$icon = Ox.Element('<img>') $icon = Ox.Element('<img>')
@ -203,7 +224,6 @@ pandora.ui.listInfo = function() {
.css(getIconCSS()) .css(getIconCSS())
.appendTo(that), .appendTo(that),
$title, $description; $title, $description;
that.append($('<div>').css({height: '16px'})); that.append($('<div>').css({height: '16px'}));
//fixme: allow editing //fixme: allow editing
@ -323,6 +343,8 @@ pandora.ui.listInfo = function() {
.css({fontWeight: 'bold'}) .css({fontWeight: 'bold'})
.html(ui.section == 'items' .html(ui.section == 'items'
? Ox._('All {0}', [Ox._(pandora.site.itemName.plural)]) ? Ox._('All {0}', [Ox._(pandora.site.itemName.plural)])
: ui.section == 'documents'
? Ox._('All {0}', [Ox._('Documents')])
: Ox._('{0} ' + folderItems, [pandora.site.site.name]) : Ox._('{0} ' + folderItems, [pandora.site.site.name])
) )
); );