Added TextArea
This commit is contained in:
@@ -54,10 +54,27 @@ class WSF_TEXT_CONTROL extends WSF_CONTROL
|
||||
window.states[@control_name]['text'] = state.text
|
||||
@$el.val(state.text)
|
||||
|
||||
class WSF_TEXTAREA_CONTROL extends WSF_CONTROL
|
||||
attach_events: () ->
|
||||
self = @
|
||||
@$el.change () ->
|
||||
self.change()
|
||||
|
||||
change: () ->
|
||||
window.states[@control_name]['text'] = @$el.val()
|
||||
if window.states[@control_name]['callback_change']
|
||||
trigger_callback(@control_name, 'change')
|
||||
|
||||
update: (state) ->
|
||||
if state.text?
|
||||
window.states[@control_name]['text'] = state.text
|
||||
$el.val(state.text)
|
||||
|
||||
#map class name to effective class
|
||||
typemap =
|
||||
"WSF_BUTTON_CONTROL":WSF_BUTTON_CONTROL
|
||||
"WSF_TEXT_CONTROL":WSF_TEXT_CONTROL
|
||||
"WSF_TEXTAREA_CONTROL":WSF_TEXTAREA_CONTROL
|
||||
|
||||
#create a js class for each control
|
||||
for name,state of window.states
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript 1.6.1
|
||||
(function() {
|
||||
var $el, WSF_BUTTON_CONTROL, WSF_CONTROL, WSF_TEXT_CONTROL, controls, name, state, trigger_callback, type, typemap, _ref,
|
||||
var $el, WSF_BUTTON_CONTROL, WSF_CONTROL, WSF_TEXTAREA_CONTROL, WSF_TEXT_CONTROL, controls, name, state, trigger_callback, type, typemap, _ref,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
@@ -109,9 +109,44 @@
|
||||
|
||||
})(WSF_CONTROL);
|
||||
|
||||
WSF_TEXTAREA_CONTROL = (function(_super) {
|
||||
|
||||
__extends(WSF_TEXTAREA_CONTROL, _super);
|
||||
|
||||
function WSF_TEXTAREA_CONTROL() {
|
||||
return WSF_TEXTAREA_CONTROL.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
WSF_TEXTAREA_CONTROL.prototype.attach_events = function() {
|
||||
var self;
|
||||
self = this;
|
||||
return this.$el.change(function() {
|
||||
return self.change();
|
||||
});
|
||||
};
|
||||
|
||||
WSF_TEXTAREA_CONTROL.prototype.change = function() {
|
||||
window.states[this.control_name]['text'] = this.$el.val();
|
||||
if (window.states[this.control_name]['callback_change']) {
|
||||
return trigger_callback(this.control_name, 'change');
|
||||
}
|
||||
};
|
||||
|
||||
WSF_TEXTAREA_CONTROL.prototype.update = function(state) {
|
||||
if (state.text != null) {
|
||||
window.states[this.control_name]['text'] = state.text;
|
||||
return $el.val(state.text);
|
||||
}
|
||||
};
|
||||
|
||||
return WSF_TEXTAREA_CONTROL;
|
||||
|
||||
})(WSF_CONTROL);
|
||||
|
||||
typemap = {
|
||||
"WSF_BUTTON_CONTROL": WSF_BUTTON_CONTROL,
|
||||
"WSF_TEXT_CONTROL": WSF_TEXT_CONTROL
|
||||
"WSF_TEXT_CONTROL": WSF_TEXT_CONTROL,
|
||||
"WSF_TEXTAREA_CONTROL": WSF_TEXTAREA_CONTROL
|
||||
};
|
||||
|
||||
_ref = window.states;
|
||||
|
||||
Reference in New Issue
Block a user