This commit is contained in:
j 2016-11-29 22:02:48 +00:00
commit fd74784672
7 changed files with 63 additions and 44 deletions

View file

@ -24,7 +24,7 @@ pandora.ui.home = function() {
left: 0,
top: 0,
right: 0,
bottom: '80px',
bottom: '160px',
width: window.innerWidth + 'px',
margin: 'auto',
cursor: 'pointer'
@ -180,7 +180,7 @@ pandora.ui.home = function() {
}
}),
$aboutButton = Ox.Button({
title: Ox._('About {0}', [pandora.site.site.name]),
title: Ox._('{0}', [pandora.site.site.name]),
width: 156
})
.css({

View file

@ -18,11 +18,16 @@ pandora.ui.infoView = function(data) {
iconLeft = iconSize == 256 ? Math.floor((iconSize - iconWidth) / 2) : 0,
borderRadius = ui.icons == 'posters' ? 0 : iconSize / 8,
margin = 16,
nameKeys = [
'director', 'cinematographer', 'editor',
'writer', 'producer', 'featuring'
],
listKeys = nameKeys.concat(['language', 'themes', 'groups']),
nameKeys = pandora.site.itemKeys.filter(function(key) {
return key.sortType == 'person';
}).map(function(key) {
return key.id;
}),
listKeys = pandora.site.itemKeys.filter(function(key) {
return Ox.isArray(key.type);
}).map(function(key){
return key.id;
}),
posterKeys = nameKeys.concat(['title', 'date', 'collection']),
statisticsWidth = 128,
@ -231,7 +236,7 @@ pandora.ui.infoView = function(data) {
// Groups ------------------------------------------------------------------
renderGroup(['location', 'date', 'language', 'format', 'archiveid']);
renderGroup(['location', 'date', 'language', 'format']);
renderGroup([
'director', 'cinematographer', 'editor',
@ -240,6 +245,8 @@ pandora.ui.infoView = function(data) {
renderGroup(['themes']);
renderGroup(['links']);
// Summary -------------------------------------------------------------
if (canEdit || data.summary) {
@ -253,12 +260,7 @@ pandora.ui.infoView = function(data) {
clickLink: pandora.clickLink,
collapseToEnd: false,
editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
format: imageCSS,
maxHeight: Infinity,
placeholder: formatLight(Ox._('No Summary')),
tooltip: canEdit ? pandora.getEditTooltip() : '',
@ -319,12 +321,7 @@ pandora.ui.infoView = function(data) {
descriptions[key] = Ox.EditableContent({
clickLink: pandora.clickLink,
editable: canEdit,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
format: imageCSS,
placeholder: formatLight(Ox._('No {0} Description', [Ox._(Ox.toTitleCase(key))])),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
@ -577,6 +574,11 @@ pandora.ui.infoView = function(data) {
ret = value ? Ox.formatDate(value,
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
) : '';
} else if (key == 'links') {
ret = value.split(', ').map(function(link) {
return '<a href="' + link + '">' + Ox.parseURL(link).host + '</a>';
}).join(', ');
return ret;
} else if (listKeys.indexOf(key) > -1) {
ret = value.split(', ');
} else {
@ -682,6 +684,23 @@ pandora.ui.infoView = function(data) {
});
}
function imageCSS(value) {
var $html = $('<div>').html(value);
$html.find('img').each(function(i, img) {
var $img = $(img),
css = {
'max-width': '256px',
'max-height': '256px',
'margin': '0 16px 16px 0'
};
if (!$img.parents('figure').length) {
css['float'] = 'left';
}
$img.css(css);
});
return $html.html();
}
function renderGroup(keys) {
var $element;
if (canEdit || keys.filter(function(key) {