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": "source", "title": "Source", "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": "language", "title": "Language", "type": "string"},
{"id": "category", "title": "Category", "type": "string"},
@ -196,8 +196,8 @@
"columnWidth": 90
},
{
"id": "locations",
"title": "Locations",
"id": "places",
"title": "Places",
"type": "layer",
"find": true
},
@ -377,9 +377,9 @@
],
"layers": [
{
"id": "locations",
"title": "Locations",
"type": "location",
"id": "places",
"title": "Places",
"type": "place",
"overlap": true
},
{
@ -478,7 +478,7 @@
{"id": "source", "sort": [{"key": "name", "operator": "+"}]},
{"id": "category", "sort": [{"key": "items", "operator": "-"}]},
{"id": "keywords", "sort": [{"key": "items", "operator": "-"}]},
{"id": "locations", "sort": [{"key": "items", "operator": "-"}]}
{"id": "places", "sort": [{"key": "items", "operator": "-"}]}
],
"filtersSize": 176,
"find": {"conditions": [], "operator": "&"},

View file

@ -165,7 +165,6 @@ pandora.ui.infoView = function(data) {
editMetadata('title', event.value);
}
})
.appendTo($text)
)
.appendTo($text);
@ -205,7 +204,7 @@ pandora.ui.infoView = function(data) {
}
// Country, Year, Language, Runtime ----------------------------------------
/*
if (isEditable) {
var $div = $('<div>')
.css(css)
@ -249,46 +248,82 @@ pandora.ui.infoView = function(data) {
});
$('<div>').css(css).html(html.join('; ')).appendTo($text);
}
*/
$('<div>').html('<br>').appendTo($text);
//Categories
$('<div>')
.css(css)
.html(
formatKey('categories') + formatValue(data['category'], 'category')
)
.appendTo($text);
[
'language',
'source',
'collection',
'category',
'user',
'location',
].forEach(function(key) {
$('<div>')
.html(
formatKey(key=='user'?'contributor':key) + formatValue(data[key], key)
)
.appendTo($text);
});
[
'date',
'modified',
'accessed',
'created',
].forEach(function(key) {
var $div = $('<div>')
.appendTo($text);
$('<div>')
.html(
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=='user'?'contributor':key) + data[key]
formatKey(key) + data[key]
)
.appendTo($text);
});
data.description && $('<div>')
.css(css)
.html(
formatKey('description') + data.description
)
.appendTo($text);
$('<div>').css({height: '16px'}).appendTo($text);
// Hue, Saturation, Lightness, Volume --------------------------------------

View file

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