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$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
WSF_NAVLIST_ITEM
|
WSF_NAVLIST_ITEM_CONTROL
|
||||||
|
|
||||||
inherit
|
inherit
|
||||||
|
|
||||||
@@ -19,10 +19,12 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (n, t: STRING)
|
make (n, link, t: STRING)
|
||||||
do
|
do
|
||||||
make_control (n, "a")
|
make_control (n, "a")
|
||||||
text := t
|
text := t
|
||||||
|
attributes := "href=%"" + link + "%"";
|
||||||
|
add_class ("list-group-item")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ feature -- Rendering
|
|||||||
render: STRING
|
render: STRING
|
||||||
-- HTML representation of this control
|
-- HTML representation of this control
|
||||||
do
|
do
|
||||||
Result := render_tag (text, "")
|
Result := render_tag (text, attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Change
|
feature -- Change
|
||||||
|
|||||||
@@ -122,13 +122,13 @@ feature {WSF_PAGE_CONTROL, WSF_CONTROL} -- State management
|
|||||||
|
|
||||||
feature -- Rendering
|
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
|
-- Render this control with the specified body and attributes
|
||||||
do
|
do
|
||||||
Result := render_tag_with_generator_name (generator, body, attrs)
|
Result := render_tag_with_generator_name (generator, body, attrs)
|
||||||
end
|
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
|
-- Render this control with the specified generator name, body and attributes
|
||||||
local
|
local
|
||||||
css_classes_string: STRING
|
css_classes_string: STRING
|
||||||
@@ -140,7 +140,10 @@ feature -- Rendering
|
|||||||
loop
|
loop
|
||||||
css_classes_string := css_classes_string + " " + c.item
|
css_classes_string := css_classes_string + " " + c.item
|
||||||
end
|
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
|
if isolate then
|
||||||
l_attributes.append (" data-isolation=%"1%"")
|
l_attributes.append (" data-isolation=%"1%"")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ feature -- Change
|
|||||||
|
|
||||||
feature -- Rendering
|
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
|
-- Generate HTML of this control with the specified body and attributes
|
||||||
local
|
local
|
||||||
css_classes_string: STRING
|
css_classes_string: STRING
|
||||||
@@ -53,12 +53,16 @@ feature -- Rendering
|
|||||||
Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
|
Result := render_tag_with_tagname (tag_name, body, attrs, css_classes_string)
|
||||||
end
|
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
|
-- Generate HTML of the specified tag with specified body, attributes and css classes
|
||||||
local
|
local
|
||||||
l_attributes: STRING
|
l_attributes: STRING
|
||||||
do
|
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
|
if not css_classes_string.is_empty then
|
||||||
l_attributes.append (" class=%"")
|
l_attributes.append (" class=%"")
|
||||||
l_attributes.append (css_classes_string)
|
l_attributes.append (css_classes_string)
|
||||||
|
|||||||
Reference in New Issue
Block a user