more info/edit view formatting fixes

This commit is contained in:
Rolux 2016-01-08 15:41:24 +05:30
parent 214e6a7e36
commit 29435355cb
2 changed files with 24 additions and 10 deletions

View file

@ -160,7 +160,7 @@ oml.ui.editDialog = function() {
Ox.EditableContent({ Ox.EditableContent({
editable: true, editable: true,
format: function(value) { format: function(value) {
return formatValue(value.split(separator), 'author'); return formatValue(splitValue(value), 'author');
}, },
placeholder: formatLight(Ox._('Unknown Author')), placeholder: formatLight(Ox._('Unknown Author')),
tooltip: tooltip, tooltip: tooltip,
@ -197,7 +197,7 @@ oml.ui.editDialog = function() {
editable: true, editable: true,
format: function(value) { format: function(value) {
return formatValue( return formatValue(
key == 'place' ? value.split(separator) : value, key == 'place' ? splitValue(value) : value,
key key
); );
}, },
@ -234,7 +234,7 @@ oml.ui.editDialog = function() {
editable: true, editable: true,
format: function(value) { format: function(value) {
return formatValue( return formatValue(
key == 'language' ? value.split(separator) : value, key == 'language' ? splitValue(value) : value,
key key
); );
}, },
@ -262,6 +262,9 @@ oml.ui.editDialog = function() {
}).append( }).append(
Ox.EditableContent({ Ox.EditableContent({
editable: true, editable: true,
format: function(value) {
return value.replace(/\n/g, '<br>');
},
placeholder: formatLight('No Description'), placeholder: formatLight('No Description'),
tooltip: tooltip, tooltip: tooltip,
type: 'textarea', type: 'textarea',
@ -283,6 +286,12 @@ oml.ui.editDialog = function() {
} }
function splitValue(value) {
return Ox.encodeHTMLEntities(
Ox.decodeHTMLEntities(value).split(separator)
);
}
return that; return that;
}; };

View file

@ -318,6 +318,10 @@ oml.ui.infoView = function(identifyData) {
return $element; return $element;
} }
function splitValue(value) {
return Ox.encodeHTMLEntities(Ox.decodeHTMLEntities(value).split('; '));
}
function toggleCoverSize(ratio) { function toggleCoverSize(ratio) {
var css; var css;
iconSize = iconSize == 256 ? 512 : 256, iconSize = iconSize == 256 ? 512 : 256,
@ -485,7 +489,7 @@ oml.ui.infoView = function(identifyData) {
clickLink: oml.clickLink, clickLink: oml.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value) {
return formatValue(value.split('; '), 'author'); return formatValue(splitValue(value), 'author');
}, },
placeholder: formatLight(Ox._('Unknown Author')), placeholder: formatLight(Ox._('Unknown Author')),
tooltip: isEditable ? oml.getEditTooltip() : '', tooltip: isEditable ? oml.getEditTooltip() : '',
@ -524,7 +528,7 @@ oml.ui.infoView = function(identifyData) {
format: function(value) { format: function(value) {
return formatValue( return formatValue(
Ox.contains(arrayKeys, key) Ox.contains(arrayKeys, key)
? value.split('; ') : value, ? splitValue(value) : value,
key key
); );
}, },
@ -561,11 +565,9 @@ oml.ui.infoView = function(identifyData) {
clickLink: oml.clickLink, clickLink: oml.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) { format: function(value) {
return formatValue( return key == 'language'
Ox.contains(arrayKeys, key) ? formatValue(splitValue(value), key)
? value.split('; ') : value, : value;
key
);
}, },
placeholder: formatLight('unknown'), placeholder: formatLight('unknown'),
tooltip: isEditable ? oml.getEditTooltip() : '', tooltip: isEditable ? oml.getEditTooltip() : '',
@ -631,6 +633,9 @@ oml.ui.infoView = function(identifyData) {
Ox.EditableContent({ Ox.EditableContent({
clickLink: oml.clickLink, clickLink: oml.clickLink,
editable: isEditable, editable: isEditable,
format: function(value) {
return value.replace(/\n/g, '<br>');
},
placeholder: formatLight('No Description'), placeholder: formatLight('No Description'),
tooltip: isEditable ? oml.getEditTooltip() : '', tooltip: isEditable ? oml.getEditTooltip() : '',
type: 'textarea', type: 'textarea',