67 lines
No EOL
1.9 KiB
JavaScript
67 lines
No EOL
1.9 KiB
JavaScript
'use strict';
|
|
|
|
oml.ui.coverDialog = function(id, value) {
|
|
|
|
var ui = oml.user.ui,
|
|
|
|
$input = Ox.Input({
|
|
style: 'squared',
|
|
value: value,
|
|
width: 480
|
|
})
|
|
.css({margin: '16px'})
|
|
.bindEvent({
|
|
submit: function() {
|
|
that.close();
|
|
}
|
|
}),
|
|
|
|
that = Ox.Dialog({
|
|
buttons: [
|
|
Ox.Button({
|
|
id: 'done',
|
|
style: 'squared',
|
|
title: Ox._('Done')
|
|
})
|
|
.bindEvent({
|
|
click: function() {
|
|
that.close();
|
|
}
|
|
})
|
|
],
|
|
closeButton: true,
|
|
content: $input,
|
|
height: 48,
|
|
keys: {enter: 'done'},
|
|
removeOnClose: true,
|
|
title: Ox._('Edit Cover URL'),
|
|
width: 512
|
|
})
|
|
.bindEvent({
|
|
close: function() {
|
|
var inputValue = $input.value();
|
|
if (inputValue != value) {
|
|
oml.api.edit({
|
|
id: id,
|
|
cover: inputValue
|
|
}, function(result) {
|
|
if (ui.icons == 'cover') {
|
|
oml.$ui.info.updateElement();
|
|
oml.$ui.browser.value(ui.item, {
|
|
cover: result.data.cover,
|
|
coverRatio: result.data.coverRatio,
|
|
modified: result.data.modified
|
|
});
|
|
oml.$ui.infoView.updateCover();
|
|
}
|
|
});
|
|
}
|
|
},
|
|
open: function() {
|
|
$input.focusInput(true);
|
|
}
|
|
});
|
|
|
|
return that;
|
|
|
|
}; |