2016-01-11 11:26:06 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-01-16 05:14:22 +00:00
|
|
|
oml.ui.coverDialog = function(id, value) {
|
2016-01-11 11:26:06 +00:00
|
|
|
|
2016-01-16 05:14:22 +00:00
|
|
|
var ui = oml.user.ui,
|
|
|
|
|
|
|
|
$input = Ox.Input({
|
|
|
|
style: 'squared',
|
|
|
|
value: value,
|
2016-01-11 11:26:06 +00:00
|
|
|
width: 480
|
|
|
|
})
|
|
|
|
.css({margin: '16px'})
|
|
|
|
.bindEvent({
|
2016-01-16 05:14:22 +00:00
|
|
|
submit: function() {
|
2016-01-11 11:26:06 +00:00
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
|
|
|
|
that = Ox.Dialog({
|
|
|
|
buttons: [
|
|
|
|
Ox.Button({
|
2016-01-16 05:14:22 +00:00
|
|
|
id: 'done',
|
2016-01-13 08:21:32 +00:00
|
|
|
style: 'squared',
|
2016-01-16 05:14:22 +00:00
|
|
|
title: Ox._('Done')
|
2016-01-11 11:26:06 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
closeButton: true,
|
|
|
|
content: $input,
|
|
|
|
height: 48,
|
2016-01-16 05:14:22 +00:00
|
|
|
keys: {enter: 'done'},
|
2016-01-11 11:26:06 +00:00
|
|
|
removeOnClose: true,
|
|
|
|
title: Ox._('Edit Cover URL'),
|
|
|
|
width: 512
|
|
|
|
})
|
|
|
|
.bindEvent({
|
2016-01-16 05:14:22 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2016-01-11 11:26:06 +00:00
|
|
|
open: function() {
|
|
|
|
$input.focusInput(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return that;
|
|
|
|
|
|
|
|
};
|