Adjust layout control and fix navlist
This commit is contained in:
@@ -22,19 +22,20 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make ( link, t: STRING)
|
make (link, t: STRING)
|
||||||
do
|
do
|
||||||
make_control ("a")
|
make_control ("a")
|
||||||
text := t
|
text := t
|
||||||
attributes := "href=%"" + link + "%"";
|
attributes := "href=%"" + link + "%"";
|
||||||
add_class ("list-group-item")
|
add_class ("list-group-item")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||||
|
|
||||||
set_state (new_state: JSON_OBJECT)
|
set_state (new_state: JSON_OBJECT)
|
||||||
-- Restore text from json
|
-- Restore text from json
|
||||||
do
|
do
|
||||||
Precursor {WSF_BUTTON_CONTROL}(new_state)
|
Precursor {WSF_BUTTON_CONTROL} (new_state)
|
||||||
if attached {JSON_BOOLEAN} new_state.item ("active") as new_active then
|
if attached {JSON_BOOLEAN} new_state.item ("active") as new_active then
|
||||||
active := new_active.item
|
active := new_active.item
|
||||||
end
|
end
|
||||||
@@ -44,7 +45,7 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
-- Return state which contains the current text and if there is an event handle attached
|
-- Return state which contains the current text and if there is an event handle attached
|
||||||
do
|
do
|
||||||
Result := Precursor {WSF_BUTTON_CONTROL}
|
Result := Precursor {WSF_BUTTON_CONTROL}
|
||||||
Result.put_boolean (true, "active")
|
Result.put_boolean (active, "active")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Change
|
feature -- Change
|
||||||
@@ -52,9 +53,12 @@ feature -- Change
|
|||||||
set_active (a: BOOLEAN)
|
set_active (a: BOOLEAN)
|
||||||
-- Set text of that button
|
-- Set text of that button
|
||||||
do
|
do
|
||||||
|
if active /= a then
|
||||||
active := a
|
active := a
|
||||||
state_changes.replace (create {JSON_BOOLEAN}.make_boolean (a), "active")
|
state_changes.replace (create {JSON_BOOLEAN}.make_boolean (a), "active")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Properties
|
feature -- Properties
|
||||||
|
|
||||||
active: BOOLEAN
|
active: BOOLEAN
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ inherit
|
|||||||
WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
rename
|
rename
|
||||||
make as make_multi_control,
|
make as make_multi_control,
|
||||||
add_control as add_control_raw
|
add_control as add_control_raw
|
||||||
end
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
@@ -38,13 +38,19 @@ feature -- Add control
|
|||||||
add_control_raw (div)
|
add_control_raw (div)
|
||||||
end
|
end
|
||||||
|
|
||||||
add_control (c: WSF_STATELESS_CONTROL; span: INTEGER)
|
add_control (col:INTEGER; c: WSF_STATELESS_CONTROL)
|
||||||
|
do
|
||||||
|
if attached {WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]}controls[col] as div then
|
||||||
|
div.add_control (c)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add_column (span:INTEGER)
|
||||||
local
|
local
|
||||||
div: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
div: WSF_STATELESS_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||||
do
|
do
|
||||||
create div.make_with_tag_name ("div")
|
create div.make_with_tag_name ("div")
|
||||||
div.add_class ("col-md-" + span.out)
|
div.add_class ("col-md-" + span.out)
|
||||||
div.add_control (c)
|
|
||||||
add_control_raw (div)
|
add_control_raw (div)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ class WSF_NAVLIST_ITEM_CONTROL extends WSF_BUTTON_CONTROL
|
|||||||
update: (state) ->
|
update: (state) ->
|
||||||
super
|
super
|
||||||
if state.active?
|
if state.active?
|
||||||
|
@state['active'] = state.active
|
||||||
if state.active
|
if state.active
|
||||||
@$el.addClass("active")
|
@$el.addClass("active")
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ WSF_NAVLIST_ITEM_CONTROL = (function(_super) {
|
|||||||
WSF_NAVLIST_ITEM_CONTROL.prototype.update = function(state) {
|
WSF_NAVLIST_ITEM_CONTROL.prototype.update = function(state) {
|
||||||
WSF_NAVLIST_ITEM_CONTROL.__super__.update.apply(this, arguments);
|
WSF_NAVLIST_ITEM_CONTROL.__super__.update.apply(this, arguments);
|
||||||
if (state.active != null) {
|
if (state.active != null) {
|
||||||
|
this.state['active'] = state.active;
|
||||||
if (state.active) {
|
if (state.active) {
|
||||||
return this.$el.addClass("active");
|
return this.$el.addClass("active");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user