From 5509cea6dc77a629604f0e167e510aca9c13b824 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 27 Dec 2011 15:10:11 +0530 Subject: [PATCH] locations/places;editable metadata --- pandora/padma.jsonc | 14 ++--- static/js/pandora/infoView.padma.js | 91 ++++++++++++++++++++--------- static/js/pandora/placesDialog.js | 2 +- 3 files changed, 71 insertions(+), 36 deletions(-) diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index 5f353ef16..20eb5e959 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -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": "&"}, diff --git a/static/js/pandora/infoView.padma.js b/static/js/pandora/infoView.padma.js index 1d1801ba5..0fc355ac9 100644 --- a/static/js/pandora/infoView.padma.js +++ b/static/js/pandora/infoView.padma.js @@ -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 = $('
') .css(css) @@ -249,46 +248,82 @@ pandora.ui.infoView = function(data) { }); $('
').css(css).html(html.join('; ')).appendTo($text); } + */ $('
').html('
').appendTo($text); - //Categories - $('
') - .css(css) - .html( - formatKey('categories') + formatValue(data['category'], 'category') - ) - .appendTo($text); - [ + 'language', 'source', 'collection', 'category', 'user', 'location', - ].forEach(function(key) { - $('
') - .html( - formatKey(key=='user'?'contributor':key) + formatValue(data[key], key) - ) - .appendTo($text); - }); - [ 'date', - 'modified', - 'accessed', - 'created', ].forEach(function(key) { + var $div = $('
') + .appendTo($text); $('
') + .html( + formatKey({ + categorty: 'categories', + user: 'contributor' + }[key] || key).replace('', ' ') + ) + .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); + }); + $('
') + .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); + + $('
').css({height: '16px'}).appendTo($text); + [ + 'created', + 'accessed', + 'modified', + ].forEach(function(key) { + $('') + .css({padding: '4px'}) .html( - formatKey(key=='user'?'contributor':key) + data[key] + formatKey(key) + data[key] ) .appendTo($text); }); - data.description && $('
') - .css(css) - .html( - formatKey('description') + data.description - ) - .appendTo($text); + $('
').css({height: '16px'}).appendTo($text); // Hue, Saturation, Lightness, Volume -------------------------------------- diff --git a/static/js/pandora/placesDialog.js b/static/js/pandora/placesDialog.js index c7b6d2e74..71a64024e 100644 --- a/static/js/pandora/placesDialog.js +++ b/static/js/pandora/placesDialog.js @@ -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 ? '&' : '|' }