update infoView.js

This commit is contained in:
Rolux 2016-01-05 20:13:37 +05:30
parent 043abbd27c
commit de5735e8ff
1 changed files with 12 additions and 8 deletions

View File

@ -4,10 +4,12 @@ oml.ui.infoView = function(identifyData) {
var ui = oml.user.ui, var ui = oml.user.ui,
iconSize = identifyData ? 256 : ui.iconSize, arrayKeys = ['author', 'place', 'publisher', 'language'],
css = getCSS(iconSize, oml.config.iconRatio), css = getCSS(iconSize, oml.config.iconRatio),
iconSize = identifyData ? 256 : ui.iconSize,
ids = [ ids = [
{key: 'isbn', url: 'https://google.com/search?q=ISBN+{0}'}, {key: 'isbn', url: 'https://google.com/search?q=ISBN+{0}'},
{key: 'asin', url: 'http://www.amazon.com/dp/{0}'}, {key: 'asin', url: 'http://www.amazon.com/dp/{0}'},
@ -526,9 +528,10 @@ oml.ui.infoView = function(identifyData) {
}, },
placeholder: formatLight(Ox._('unknown')), placeholder: formatLight(Ox._('unknown')),
tooltip: isEditable ? oml.getEditTooltip() : '', tooltip: isEditable ? oml.getEditTooltip() : '',
value: key == 'place' value: data[key] ? (
? (data[key] ? data[key].join('; ') : ['']) Ox.contains(arrayKeys, key)
: data[key] || '' ? data[key].join('; ') : data[key]
) : ''
}) })
.bindEvent({ .bindEvent({
submit: function(event) { submit: function(event) {
@ -562,9 +565,10 @@ oml.ui.infoView = function(identifyData) {
}, },
placeholder: formatLight('unknown'), placeholder: formatLight('unknown'),
tooltip: isEditable ? oml.getEditTooltip() : '', tooltip: isEditable ? oml.getEditTooltip() : '',
value: data[key] value: data[key] ? (
? key == 'language' && Ox.isArray(data[key]) Ox.contains(arrayKeys, key)
? data[key].join('; ') : data[key] : '' ? data[key].join('; ') : data[key]
) : ''
}) })
.bindEvent({ .bindEvent({
submit: function(event) { submit: function(event) {
@ -718,7 +722,7 @@ oml.ui.infoView = function(identifyData) {
function editMetadata(key, value) { function editMetadata(key, value) {
if (value != data[key]) { if (value != data[key]) {
var edit = {id: data.id}; var edit = {id: data.id};
if (Ox.contains(['author', 'place'], key)) { if (Ox.contains(arrayKeys, key)) {
edit[key] = value ? value.split('; ') : []; edit[key] = value ? value.split('; ') : [];
} else { } else {
edit[key] = value; edit[key] = value;