Fix dropdown list, clean up actions
This commit is contained in:
@@ -9,7 +9,7 @@ class
|
|||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
rename
|
rename
|
||||||
make as make_multi_control,
|
make as make_multi_control,
|
||||||
make_with_tag_name as make_multi_control_with_tag_name
|
make_with_tag_name as make_multi_control_with_tag_name
|
||||||
|
|||||||
@@ -33,38 +33,41 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Actions
|
feature -- Actions
|
||||||
|
|
||||||
start_modal (url: STRING; title: STRING)
|
start_modal (url: STRING; title: STRING; big: BOOLEAN)
|
||||||
--Start a modal window containg an other or the same page
|
|
||||||
local
|
|
||||||
modal: WSF_JSON_OBJECT
|
|
||||||
do
|
|
||||||
create modal.make
|
|
||||||
modal.put_string ("start_modal", "type")
|
|
||||||
modal.put_string (url, "url")
|
|
||||||
modal.put_string (title, "title")
|
|
||||||
actions.add (modal)
|
|
||||||
end
|
|
||||||
|
|
||||||
start_modal_big (url: STRING; title: STRING)
|
|
||||||
--Start a modal window containg an other or the same page
|
--Start a modal window containg an other or the same page
|
||||||
local
|
local
|
||||||
modal: WSF_JSON_OBJECT
|
modal: WSF_JSON_OBJECT
|
||||||
do
|
do
|
||||||
create modal.make
|
create modal.make
|
||||||
|
if big then
|
||||||
modal.put_string ("start_modal_big", "type")
|
modal.put_string ("start_modal_big", "type")
|
||||||
|
else
|
||||||
|
modal.put_string ("start_modal", "type")
|
||||||
|
end
|
||||||
modal.put_string (url, "url")
|
modal.put_string (url, "url")
|
||||||
modal.put_string (title, "title")
|
modal.put_string (title, "title")
|
||||||
actions.add (modal)
|
actions.add (modal)
|
||||||
end
|
end
|
||||||
|
|
||||||
show_alert (mesage: STRING)
|
show_alert (message: STRING)
|
||||||
--Start a modal window containg an other or the same page
|
--Start a modal window containg an other or the same page
|
||||||
local
|
local
|
||||||
modal: WSF_JSON_OBJECT
|
modal: WSF_JSON_OBJECT
|
||||||
do
|
do
|
||||||
create modal.make
|
create modal.make
|
||||||
modal.put_string ("show_alert", "type")
|
modal.put_string ("show_alert", "type")
|
||||||
modal.put_string (mesage, "message")
|
modal.put_string (message, "message")
|
||||||
|
actions.add (modal)
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect (url: STRING)
|
||||||
|
--Redirect to an other page
|
||||||
|
local
|
||||||
|
modal: WSF_JSON_OBJECT
|
||||||
|
do
|
||||||
|
create modal.make
|
||||||
|
modal.put_string ("redirect", "type")
|
||||||
|
modal.put_string (url, "url")
|
||||||
actions.add (modal)
|
actions.add (modal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ parseSuggestions = (data)->
|
|||||||
return d
|
return d
|
||||||
return null
|
return null
|
||||||
loaded = {}
|
loaded = {}
|
||||||
|
|
||||||
lazy_load = (requirements,fn,that)->
|
lazy_load = (requirements,fn,that)->
|
||||||
if requirements.length == 0
|
if requirements.length == 0
|
||||||
return ()->
|
return ()->
|
||||||
@@ -249,8 +250,6 @@ class WSF_CONTROL
|
|||||||
cache: no
|
cache: no
|
||||||
.done (new_states)->
|
.done (new_states)->
|
||||||
#Update all classes
|
#Update all classes
|
||||||
if new_states.actions?
|
|
||||||
self.process_actions(new_states.actions)
|
|
||||||
self.get_page().process_update(new_states)
|
self.get_page().process_update(new_states)
|
||||||
|
|
||||||
#Simple event listener
|
#Simple event listener
|
||||||
@@ -290,13 +289,14 @@ class WSF_PAGE_CONTROL extends WSF_CONTROL
|
|||||||
@load_subcontrols()
|
@load_subcontrols()
|
||||||
|
|
||||||
process_update: (new_states)->
|
process_update: (new_states)->
|
||||||
|
if new_states.actions?
|
||||||
|
@process_actions(new_states.actions)
|
||||||
for control in @controls
|
for control in @controls
|
||||||
if control?
|
if control?
|
||||||
control.process_update(new_states)
|
control.process_update(new_states)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
get_full_control_name: ()->
|
get_full_control_name: ()->
|
||||||
""
|
""
|
||||||
|
|
||||||
@@ -599,6 +599,8 @@ class WSF_REPEATER_CONTROL extends WSF_CONTROL
|
|||||||
|
|
||||||
|
|
||||||
#### actions
|
#### actions
|
||||||
|
redirect = (action) ->
|
||||||
|
document.location.href = action.url
|
||||||
|
|
||||||
show_alert = (action)->
|
show_alert = (action)->
|
||||||
alert(action.message)
|
alert(action.message)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Generated by CoffeeScript 1.6.1
|
// Generated by CoffeeScript 1.6.1
|
||||||
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CODEVIEW_CONTROL, WSF_CONTROL, WSF_DROPDOWN_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_NAVLIST_ITEM_CONTROL, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PASSWORD_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_SLIDER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, loaded, parseSuggestions, show_alert, start_modal, start_modal_big, template, tmpl,
|
var Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CODEVIEW_CONTROL, WSF_CONTROL, WSF_DROPDOWN_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_NAVLIST_ITEM_CONTROL, WSF_PAGE_CONTROL, WSF_PAGINATION_CONTROL, WSF_PASSWORD_CONTROL, WSF_PROGRESS_CONTROL, WSF_REGEXP_VALIDATOR, WSF_REPEATER_CONTROL, WSF_SLIDER_CONTROL, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, build_control, cache, controls, lazy_load, loaded, parseSuggestions, redirect, show_alert, start_modal, start_modal_big, template, tmpl,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__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; };
|
__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; };
|
||||||
|
|
||||||
@@ -394,9 +394,6 @@ WSF_CONTROL = (function() {
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
cache: false
|
cache: false
|
||||||
}).done(function(new_states) {
|
}).done(function(new_states) {
|
||||||
if (new_states.actions != null) {
|
|
||||||
self.process_actions(new_states.actions);
|
|
||||||
}
|
|
||||||
return self.get_page().process_update(new_states);
|
return self.get_page().process_update(new_states);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -456,6 +453,9 @@ WSF_PAGE_CONTROL = (function(_super) {
|
|||||||
|
|
||||||
WSF_PAGE_CONTROL.prototype.process_update = function(new_states) {
|
WSF_PAGE_CONTROL.prototype.process_update = function(new_states) {
|
||||||
var control, _i, _len, _ref;
|
var control, _i, _len, _ref;
|
||||||
|
if (new_states.actions != null) {
|
||||||
|
this.process_actions(new_states.actions);
|
||||||
|
}
|
||||||
_ref = this.controls;
|
_ref = this.controls;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
control = _ref[_i];
|
control = _ref[_i];
|
||||||
@@ -1029,6 +1029,10 @@ WSF_REPEATER_CONTROL = (function(_super) {
|
|||||||
|
|
||||||
})(WSF_CONTROL);
|
})(WSF_CONTROL);
|
||||||
|
|
||||||
|
redirect = function(action) {
|
||||||
|
return document.location.href = action.url;
|
||||||
|
};
|
||||||
|
|
||||||
show_alert = function(action) {
|
show_alert = function(action) {
|
||||||
return alert(action.message);
|
return alert(action.message);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ feature
|
|||||||
|
|
||||||
show_code
|
show_code
|
||||||
do
|
do
|
||||||
start_modal_big ("/codeview?file=" + generator.as_lower, "Eiffel code " + generator)
|
start_modal ("/codeview?file=" + generator.as_lower, "Eiffel code " + generator, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature
|
feature
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ feature
|
|||||||
form.add_control (button1)
|
form.add_control (button1)
|
||||||
--Button 2
|
--Button 2
|
||||||
create button2.make ("Start Modal Grid")
|
create button2.make ("Start Modal Grid")
|
||||||
button2.set_click_event (agent handle_click)
|
button2.set_click_event (agent run_modal)
|
||||||
form.add_control (button2)
|
form.add_control (button2)
|
||||||
--Result
|
--Result
|
||||||
create result_html.make ("p", "")
|
create result_html.make ("p", "")
|
||||||
@@ -109,6 +109,11 @@ feature
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
run_modal
|
||||||
|
do
|
||||||
|
start_modal("/","Test Modal", true);
|
||||||
|
end
|
||||||
|
|
||||||
process
|
process
|
||||||
do
|
do
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user