update placeholder after setting a mixed field to an empty value
This commit is contained in:
parent
8866960009
commit
aaa9a4a538
1 changed files with 17 additions and 8 deletions
|
@ -8,6 +8,8 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
|
||||
arrayKeys = ['author', 'place', 'publisher', 'language', 'categories'],
|
||||
|
||||
editables = {},
|
||||
|
||||
iconSize = externalData ? 256 : ui.iconSize,
|
||||
|
||||
isMultiple = arguments.length == 2,
|
||||
|
@ -484,7 +486,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
marginTop: '-2px'
|
||||
})
|
||||
.append(
|
||||
Ox.EditableContent({
|
||||
editables['title'] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
placeholder: formatLight(Ox._(
|
||||
|
@ -512,7 +514,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
marginTop: '2px'
|
||||
})
|
||||
.append(
|
||||
Ox.EditableContent({
|
||||
editables['author'] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
|
@ -557,7 +559,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
$('<span>')
|
||||
.html(formatKey(key))
|
||||
.appendTo($div);
|
||||
Ox.EditableContent({
|
||||
editables[key] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
|
@ -599,7 +601,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
$('<span>')
|
||||
.html(formatKey(key))
|
||||
.appendTo($div);
|
||||
Ox.EditableContent({
|
||||
editables[key] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
|
@ -641,7 +643,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
$('<span>')
|
||||
.html(formatKey('categories'))
|
||||
.appendTo($div);
|
||||
Ox.EditableContent({
|
||||
editables['categories'] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
|
@ -672,7 +674,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
$('<span>')
|
||||
.html(formatKey('isbn'))
|
||||
.appendTo($div);
|
||||
Ox.EditableContent({
|
||||
editables['isbn'] = Ox.EditableContent({
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
return (value ? [
|
||||
|
@ -709,7 +711,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
textAlign: 'justify'
|
||||
})
|
||||
.append(
|
||||
Ox.EditableContent({
|
||||
editables[key] = Ox.EditableContent({
|
||||
clickLink: oml.clickLink,
|
||||
editable: isEditable,
|
||||
format: function(value) {
|
||||
|
@ -798,6 +800,13 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
if (!Ox.isEqual(edit[key], data[key])) {
|
||||
data[key] = edit[key];
|
||||
oml.api.edit(edit, function(result) {
|
||||
if (isMixed[key]) {
|
||||
isMixed[key] = false
|
||||
var placeholder = editables[key].options('placeholder').replace('Mixed', 'Unknown').replace('mixed', 'unknown')
|
||||
editables[key].options({
|
||||
placeholder: placeholder
|
||||
})
|
||||
}
|
||||
if (!isMultiple || ui.updateResults) {
|
||||
Ox.Request.clearCache();
|
||||
if (Ox.contains(['title', 'author', 'description'], key)) {
|
||||
|
@ -815,7 +824,7 @@ oml.ui.infoView = function(externalData, isMixed) {
|
|||
result.data.id, key, result.data[key]
|
||||
);
|
||||
}
|
||||
that.updateElement(result.data, [$data]);
|
||||
$data && that.updateElement(result.data, [$data]);
|
||||
that.triggerEvent('change', Ox.extend({}, key, value));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue