Fixed WSF_MULTI_CONTROL (wrong order of subcontrols), completed navbar, improved slider

This commit is contained in:
severin
2013-10-29 15:32:57 +01:00
parent 26e6a62e6b
commit 61f032a819
9 changed files with 84 additions and 48 deletions

View File

@@ -23,10 +23,12 @@ feature {NONE} -- Initialization
--Initialize
do
make_multi_control (n)
active_set := false
add_class ("navbar navbar-inverse navbar-fixed-top")
create nav.make_with_tag_name (control_name + "_nav", "ul")
create nav_right.make_with_tag_name (control_name + "_nav_right", "ul")
nav.add_class ("nav navbar-nav")
nav_right.add_class ("nav navbar-nav navbar-right")
end
make_navbar_with_brand (n, b: STRING)
@@ -62,17 +64,43 @@ feature -- Rendering
feature -- Change
set_active (tab: INTEGER)
-- Sets the given tab as current active tab
require
tab >= 0 and tab < nav.controls.count + nav_right.controls.count
tab >= 1 and tab <= tab_count and not active_set
do
if tab < nav.controls.count then
if tab <= nav.controls.count then
nav.controls.i_th (tab).add_class ("active")
else
nav_right.controls.i_th (tab - nav.controls.count).add_class ("active")
end
active_set := true
end
add_list_element_right (c: WSF_STATELESS_CONTROL)
add_dropdown (l: WSF_STATELESS_CONTROL; d: WSF_STATELESS_CONTROL)
-- Add dropdown menu (in li tag with class dropdown) to navbar
local
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do
create li.make_with_tag_name (control_name + "_link" + nav.controls.count.out, "li")
li.add_class ("dropdown")
li.add_control (l)
li.add_control (d)
add_element (li)
end
add_dropdown_right (l: WSF_STATELESS_CONTROL; d: WSF_STATELESS_CONTROL)
-- Add dropdown menu (in li tag with class dropdown) to right aligned part of navbar
local
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do
create li.make_with_tag_name (control_name + "_link" + nav.controls.count.out, "li")
li.add_class ("dropdown")
li.add_control (l)
li.add_control (d)
add_element_right (li)
end
add_list_element_right (l: WSF_STATELESS_CONTROL)
-- Add element in li tag to right aligned part of navbar
local
name: STRING
@@ -81,33 +109,24 @@ feature -- Change
name := control_name + "_rightlink";
name := name + nav_right.controls.count.out
create li.make_with_tag_name (name, "li")
li.add_control (c)
li.add_control (l)
add_element_right (li)
end
add_list_element (c: WSF_STATELESS_CONTROL)
add_list_element (l: WSF_STATELESS_CONTROL)
-- Add element in li tag to main nav
local
li: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do
create li.make_with_tag_name (control_name + "_link" + nav.controls.count.out, "li")
li.add_control (c)
li.add_control (l)
add_element (li)
end
add_element_right (c: WSF_STATELESS_CONTROL)
-- Add element to right aligned part of navbar
local
right: WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
do
if attached nav_right as r then
right := r
else
create right.make_with_tag_name (control_name + "_rightnav", "ul")
right.add_class ("nav navbar-nav navbar-right")
nav_right := right
end
right.add_control (c)
nav_right.add_control (c)
end
add_element (c: WSF_STATELESS_CONTROL)
@@ -116,8 +135,19 @@ feature -- Change
nav.add_control (c)
end
feature -- Access
tab_count: INTEGER
-- Current sum of the number of items in left and right navbar
do
Result := nav.controls.count + nav_right.controls.count
end
feature -- Properties
active_set: BOOLEAN
-- This flag is set once a tab has been set as active tab
brand: detachable STRING
-- Optional brand of the navbar