allow for editing cover url
This commit is contained in:
parent
280cb56b38
commit
d0e2fe0340
3 changed files with 45 additions and 26 deletions
|
|
@ -1,30 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
oml.ui.coverDialog = function(id, url) {
|
||||
oml.ui.coverDialog = function(id, value) {
|
||||
|
||||
var $input = Ox.Input({
|
||||
value: url,
|
||||
var ui = oml.user.ui,
|
||||
|
||||
$input = Ox.Input({
|
||||
style: 'squared',
|
||||
value: value,
|
||||
width: 480
|
||||
})
|
||||
.css({margin: '16px'})
|
||||
.bindEvent({
|
||||
change: function(value) {
|
||||
submit: function() {
|
||||
that.close();
|
||||
oml.api.edit({
|
||||
id: id,
|
||||
cover: value
|
||||
}, function(result) {
|
||||
// ...
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
that = Ox.Dialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'close',
|
||||
id: 'done',
|
||||
style: 'squared',
|
||||
title: Ox._('Close')
|
||||
title: Ox._('Done')
|
||||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
|
|
@ -35,12 +32,31 @@ oml.ui.coverDialog = function(id, url) {
|
|||
closeButton: true,
|
||||
content: $input,
|
||||
height: 48,
|
||||
keys: {escape: 'close', enter: 'close'},
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue