Merge branch 'widget_grid' into widget

Conflicts:
	examples/widgetapp/widget.coffee
	examples/widgetapp/widget.js
This commit is contained in:
YNH Webdev
2013-09-15 14:04:45 +02:00
32 changed files with 963 additions and 174 deletions

View File

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.6.1
(function() {
var $el, Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, cache, controls, name, state, template, tmpl, trigger_callback, type, typemap, validatormap, _ref, _ref1, _ref2,
var $el, Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGINATION_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, cache, controls, name, state, template, tmpl, trigger_callback, type, typemap, validatormap, _ref, _ref1, _ref2,
__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; };
@@ -24,11 +24,12 @@
}
};
trigger_callback = function(control_name, event) {
trigger_callback = function(control_name, event, event_parameter) {
return $.ajax({
data: {
control_name: control_name,
event: event,
event_parameter: event_parameter,
states: JSON.stringify(window.states)
},
cache: false
@@ -262,9 +263,8 @@
WSF_AUTOCOMPLETE_CONTROL.prototype.attach_events = function() {
var self;
WSF_AUTOCOMPLETE_CONTROL.__super__.attach_events.apply(this, arguments);
self = this;
return this.$el.typeahead({
this.$el.typeahead({
name: this.control_name,
template: window.states[this.control_name]['template'],
engine: Mini,
@@ -283,6 +283,12 @@
}
}
});
this.$el.on('typeahead:closed', function() {
return self.change();
});
return this.$el.on('typeahead:blured', function() {
return self.change();
});
};
return WSF_AUTOCOMPLETE_CONTROL;
@@ -482,6 +488,98 @@
})(WSF_CONTROL);
WSF_PAGINATION_CONTROL = (function(_super) {
__extends(WSF_PAGINATION_CONTROL, _super);
function WSF_PAGINATION_CONTROL() {
return WSF_PAGINATION_CONTROL.__super__.constructor.apply(this, arguments);
}
WSF_PAGINATION_CONTROL.prototype.attach_events = function() {
var self;
self = this;
return this.$el.on('click', 'a', function(e) {
e.preventDefault();
return self.click(e);
});
};
WSF_PAGINATION_CONTROL.prototype.click = function(e) {
var nr;
nr = $(e.target).data('nr');
if (nr === "next") {
return trigger_callback(this.control_name, "next");
} else if (nr === "prev") {
return trigger_callback(this.control_name, "prev");
} else {
return trigger_callback(this.control_name, "goto", nr);
}
};
WSF_PAGINATION_CONTROL.prototype.update = function(state) {
if (state._html != null) {
return this.$el.html($(state._html).html());
}
};
return WSF_PAGINATION_CONTROL;
})(WSF_CONTROL);
WSF_GRID_CONTROL = (function(_super) {
__extends(WSF_GRID_CONTROL, _super);
function WSF_GRID_CONTROL() {
return WSF_GRID_CONTROL.__super__.constructor.apply(this, arguments);
}
WSF_GRID_CONTROL.prototype.attach_events = function() {
var self;
return self = this;
};
WSF_GRID_CONTROL.prototype.update = function(state) {
if (state.datasource != null) {
window.states[this.control_name]['datasource'] = state.datasource;
}
if (state._body != null) {
return this.$el.find('tbody').html(state._body);
}
};
return WSF_GRID_CONTROL;
})(WSF_CONTROL);
WSF_REPEATER_CONTROL = (function(_super) {
__extends(WSF_REPEATER_CONTROL, _super);
function WSF_REPEATER_CONTROL() {
return WSF_REPEATER_CONTROL.__super__.constructor.apply(this, arguments);
}
WSF_REPEATER_CONTROL.prototype.attach_events = function() {
var self;
return self = this;
};
WSF_REPEATER_CONTROL.prototype.update = function(state) {
if (state.datasource != null) {
window.states[this.control_name]['datasource'] = state.datasource;
}
if (state._body != null) {
this.$el.find('.repeater_content').html(state._body);
return console.log(state._body);
}
};
return WSF_REPEATER_CONTROL;
})(WSF_CONTROL);
typemap = {
"WSF_BUTTON_CONTROL": WSF_BUTTON_CONTROL,
"WSF_INPUT_CONTROL": WSF_INPUT_CONTROL,
@@ -491,7 +589,10 @@
"WSF_FORM_ELEMENT_CONTROL": WSF_FORM_ELEMENT_CONTROL,
"WSF_HTML_CONTROL": WSF_HTML_CONTROL,
"WSF_CHECKBOX_LIST_CONTROL": WSF_CHECKBOX_LIST_CONTROL,
"WSF_PROGRESS_CONTROL": WSF_PROGRESS_CONTROL
"WSF_PROGRESS_CONTROL": WSF_PROGRESS_CONTROL,
"WSF_PAGINATION_CONTROL": WSF_PAGINATION_CONTROL,
"WSF_GRID_CONTROL": WSF_GRID_CONTROL,
"WSF_REPEATER_CONTROL": WSF_REPEATER_CONTROL
};
_ref = window.states;