Added navlist widget
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
note
|
||||
description: "Summary description for {WSF_NAVLIST_CONTROL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_NAVLIST_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
WSF_MULTI_CONTROL [WSF_STATELESS_CONTROL]
|
||||
rename
|
||||
make as make_multi_control
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (n: STRING)
|
||||
do
|
||||
make_multi_control (n)
|
||||
add_class ("list-group")
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
add_link (link, text: STRING)
|
||||
local
|
||||
c: WSF_NAVLIST_ITEM_CONTROL
|
||||
do
|
||||
create c.make (control_name + "_item_" + controls.count.out, link, text)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -5,7 +5,7 @@ note
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_NAVLIST_ITEM
|
||||
WSF_NAVLIST_ITEM_CONTROL
|
||||
|
||||
inherit
|
||||
|
||||
@@ -19,10 +19,12 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (n, t: STRING)
|
||||
make (n, link, t: STRING)
|
||||
do
|
||||
make_control (n, "a")
|
||||
text := t
|
||||
attributes := "href=%"" + link + "%"";
|
||||
add_class ("list-group-item")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -66,7 +66,7 @@ feature -- Rendering
|
||||
render: STRING
|
||||
-- HTML representation of this control
|
||||
do
|
||||
Result := render_tag (text, "")
|
||||
Result := render_tag (text, attributes)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
@@ -122,13 +122,13 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render_tag (body, attrs: STRING): STRING
|
||||
render_tag (body: STRING; attrs: detachable STRING): STRING
|
||||
-- Render this control with the specified body and attributes
|
||||
do
|
||||
Result := render_tag_with_generator_name (generator, body, attrs)
|
||||
end
|
||||
|
||||
render_tag_with_generator_name (a_generator, body, attrs: STRING): STRING
|
||||
render_tag_with_generator_name (a_generator, body: STRING; attrs: detachable STRING): STRING
|
||||
-- Render this control with the specified generator name, body and attributes
|
||||
local
|
||||
css_classes_string: STRING
|
||||
@@ -140,7 +140,10 @@ feature -- Rendering
|
||||
loop
|
||||
css_classes_string := css_classes_string + " " + c.item
|
||||
end
|
||||
l_attributes := "id=%"" + control_name + "%" data-name=%"" + control_name + "%" data-type=%"" + a_generator + "%" " + attrs
|
||||
l_attributes := "id=%"" + control_name + "%" data-name=%"" + control_name + "%" data-type=%"" + a_generator + "%" "
|
||||
if attached attrs as a then
|
||||
l_attributes := l_attributes + a
|
||||
end
|
||||
if isolate then
|
||||
l_attributes.append (" data-isolation=%"1%"")
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ feature -- Change
|
||||
|
||||
feature -- Rendering
|
||||
|
||||
render_tag (body, attrs: STRING): STRING
|
||||
render_tag (body: STRING; attrs: detachable STRING): STRING
|
||||
-- Generate HTML of this control with the specified body and attributes
|
||||
local
|
||||
css_classes_string: STRING
|
||||
@@ -53,12 +53,16 @@ feature -- Rendering
|
||||
Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
|
||||
end
|
||||
|
||||
render_tag_with_tagname (tag, body, attrs, css_classes_string: STRING): STRING
|
||||
render_tag_with_tagname (tag, body: STRING; attrs: detachable STRING; css_classes_string: STRING): STRING
|
||||
-- Generate HTML of the specified tag with specified body, attributes and css classes
|
||||
local
|
||||
l_attributes: STRING
|
||||
do
|
||||
create l_attributes.make_from_string (attrs)
|
||||
if attached attrs as a then
|
||||
create l_attributes.make_from_string (a)
|
||||
else
|
||||
l_attributes := ""
|
||||
end
|
||||
if not css_classes_string.is_empty then
|
||||
l_attributes.append (" class=%"")
|
||||
l_attributes.append (css_classes_string)
|
||||
|
||||
Reference in New Issue
Block a user