add coverDialog.js

This commit is contained in:
rlx 2016-01-11 16:56:06 +05:30
parent 2dcc11dbb6
commit 985c0cfbd4
1 changed files with 50 additions and 0 deletions

50
static/js/coverDialog.js Normal file
View File

@ -0,0 +1,50 @@
'use strict';
oml.ui.coverDialog = function(id, url) {
var $input = Ox.Input({
value: url,
width: 480
})
.css({margin: '16px'})
.bindEvent({
change: function(value) {
that.close();
oml.api.edit({
id: id,
cover: value
}, function(result) {
// ...
});
}
}),
that = Ox.Dialog({
buttons: [
Ox.Button({
id: 'close',
title: Ox._('Close')
})
.bindEvent({
click: function() {
that.close();
}
})
],
closeButton: true,
content: $input,
height: 48,
keys: {escape: 'close', enter: 'close'},
removeOnClose: true,
title: Ox._('Edit Cover URL'),
width: 512
})
.bindEvent({
open: function() {
$input.focusInput(true);
}
});
return that;
};