locations/places;editable metadata

This commit is contained in:
j 2011-12-27 15:10:11 +05:30
parent d5a3231704
commit 5509cea6dc
3 changed files with 71 additions and 36 deletions

View file

@ -45,7 +45,7 @@
{"id": "collection", "title": "Collection", "type": "string"}, {"id": "collection", "title": "Collection", "type": "string"},
{"id": "source", "title": "Source", "type": "string"}, {"id": "source", "title": "Source", "type": "string"},
{"id": "director", "title": "Director", "type": "string"}, {"id": "director", "title": "Director", "type": "string"},
{"id": "locations", "title": "Location", "type": "string"}, {"id": "places", "title": "Places", "type": "string"},
{"id": "year", "title": "Year", "type": "integer"}, {"id": "year", "title": "Year", "type": "integer"},
{"id": "language", "title": "Language", "type": "string"}, {"id": "language", "title": "Language", "type": "string"},
{"id": "category", "title": "Category", "type": "string"}, {"id": "category", "title": "Category", "type": "string"},
@ -196,8 +196,8 @@
"columnWidth": 90 "columnWidth": 90
}, },
{ {
"id": "locations", "id": "places",
"title": "Locations", "title": "Places",
"type": "layer", "type": "layer",
"find": true "find": true
}, },
@ -377,9 +377,9 @@
], ],
"layers": [ "layers": [
{ {
"id": "locations", "id": "places",
"title": "Locations", "title": "Places",
"type": "location", "type": "place",
"overlap": true "overlap": true
}, },
{ {
@ -478,7 +478,7 @@
{"id": "source", "sort": [{"key": "name", "operator": "+"}]}, {"id": "source", "sort": [{"key": "name", "operator": "+"}]},
{"id": "category", "sort": [{"key": "items", "operator": "-"}]}, {"id": "category", "sort": [{"key": "items", "operator": "-"}]},
{"id": "keywords", "sort": [{"key": "items", "operator": "-"}]}, {"id": "keywords", "sort": [{"key": "items", "operator": "-"}]},
{"id": "locations", "sort": [{"key": "items", "operator": "-"}]} {"id": "places", "sort": [{"key": "items", "operator": "-"}]}
], ],
"filtersSize": 176, "filtersSize": 176,
"find": {"conditions": [], "operator": "&"}, "find": {"conditions": [], "operator": "&"},

View file

@ -165,7 +165,6 @@ pandora.ui.infoView = function(data) {
editMetadata('title', event.value); editMetadata('title', event.value);
} }
}) })
.appendTo($text)
) )
.appendTo($text); .appendTo($text);
@ -205,7 +204,7 @@ pandora.ui.infoView = function(data) {
} }
// Country, Year, Language, Runtime ---------------------------------------- // Country, Year, Language, Runtime ----------------------------------------
/*
if (isEditable) { if (isEditable) {
var $div = $('<div>') var $div = $('<div>')
.css(css) .css(css)
@ -249,46 +248,82 @@ pandora.ui.infoView = function(data) {
}); });
$('<div>').css(css).html(html.join('; ')).appendTo($text); $('<div>').css(css).html(html.join('; ')).appendTo($text);
} }
*/
$('<div>').html('<br>').appendTo($text); $('<div>').html('<br>').appendTo($text);
//Categories
$('<div>')
.css(css)
.html(
formatKey('categories') + formatValue(data['category'], 'category')
)
.appendTo($text);
[ [
'language',
'source', 'source',
'collection', 'collection',
'category', 'category',
'user', 'user',
'location', 'location',
].forEach(function(key) {
$('<div>')
.html(
formatKey(key=='user'?'contributor':key) + formatValue(data[key], key)
)
.appendTo($text);
});
[
'date', 'date',
'modified',
'accessed',
'created',
].forEach(function(key) { ].forEach(function(key) {
var $div = $('<div>')
.appendTo($text);
$('<div>') $('<div>')
.html( .html(
formatKey(key=='user'?'contributor':key) + data[key] formatKey({
categorty: 'categories',
user: 'contributor'
}[key] || key).replace('</span>', '&nbsp;</span>')
)
.appendTo($div);
Ox.Editable({
clickLink: pandora.clickLink,
format: function(value) {
return ['language', 'category'].indexOf(key) >= 0
? formatValue(value.split(', '), key)
: value;
},
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
value: ['language', 'category'].indexOf(key) >= 0
? (data[key] || []).join(', ')
: data[key] || ''
})
.bindEvent({
submit: function(event) {
var value = ['language', 'category'].indexOf(key) >= 0
? event.value.split(', ')
: event.value;
editMetadata(key, value);
}
})
.appendTo($div);
});
$('<div>')
.append(formatKey('description'))
.append(
Ox.Editable({
clickLink: pandora.clickLink,
placeholder: formatLight('unknown'),
tooltip: 'Doubleclick to edit',
type: 'textarea',
value: data.description || ''
})
.bindEvent({
submit: function(event) {
editMetadata('description', event.value);
}
})
)
.appendTo($text);
$('<div>').css({height: '16px'}).appendTo($text);
[
'created',
'accessed',
'modified',
].forEach(function(key) {
$('<span>')
.css({padding: '4px'})
.html(
formatKey(key) + data[key]
) )
.appendTo($text); .appendTo($text);
}); });
data.description && $('<div>')
.css(css)
.html(
formatKey('description') + data.description
)
.appendTo($text);
$('<div>').css({height: '16px'}).appendTo($text); $('<div>').css({height: '16px'}).appendTo($text);
// Hue, Saturation, Lightness, Volume -------------------------------------- // Hue, Saturation, Lightness, Volume --------------------------------------

View file

@ -33,7 +33,7 @@ pandora.ui.placesDialog = function() {
//FIXME: this should be more generic //FIXME: this should be more generic
return Ox.getObjectById(pandora.site.layers, 'subtitles') return Ox.getObjectById(pandora.site.layers, 'subtitles')
? {key: 'subtitles', value: name, operator: '='} ? {key: 'subtitles', value: name, operator: '='}
: {key: 'locations', value: name, operator: '=='}; : {key: 'places', value: name, operator: '=='};
}), }),
operator: names.length == 1 ? '&' : '|' operator: names.length == 1 ? '&' : '|'
} }