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