Adjust layout control and fix navlist

This commit is contained in:
YNH Webdev
2013-11-08 09:27:56 +01:00
parent 0d79799a5d
commit 0721384b60
4 changed files with 18 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 {