54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
Ox.ItemInput = function(options, self) {
|
|
|
|
var self = self || {},
|
|
that = new Ox.Element({}, self)
|
|
.defaults({
|
|
type: 'textarea',
|
|
value: '',
|
|
height: 300,
|
|
width: 100
|
|
})
|
|
.options(options || {}),
|
|
$input;
|
|
|
|
that.append(
|
|
$input = new Ox.Input({
|
|
height: self.options.height,
|
|
style: 'square',
|
|
type: self.options.type,
|
|
value: self.options.value,
|
|
width: self.options.width + 6
|
|
})
|
|
.bind({
|
|
mousedown: function(e) {
|
|
// keep mousedown from reaching list
|
|
e.stopPropagation();
|
|
}
|
|
})
|
|
)
|
|
.append(new Ox.Element()
|
|
.append(new Ox.Button({type: 'text', title: 'Cancel'})
|
|
.css('width', '42%')
|
|
.bindEvent({
|
|
'click': function() {
|
|
that.triggerEvent('cancel');
|
|
}
|
|
}))
|
|
.append(new Ox.Button({type: 'text', title: 'Save'})
|
|
.css('width', '42%')
|
|
.bindEvent({
|
|
'click': function() {
|
|
that.triggerEvent('save', {
|
|
value: $input.value()
|
|
});
|
|
}
|
|
}))
|
|
.css({
|
|
'margin-top': self.options.height-8,
|
|
'height': '16px',
|
|
'text-align': 'right',
|
|
})
|
|
);
|
|
Ox.print($input);
|
|
return that;
|
|
}
|