diff --git a/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_control.e b/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_control.e new file mode 100644 index 00000000..fb569856 --- /dev/null +++ b/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_control.e @@ -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 diff --git a/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_item.e b/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_item.e index 4e84e0e8..a2b338a9 100644 --- a/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_item.e +++ b/draft/library/wsf_js_widget/kernel/navlist/wsf_navlist_item.e @@ -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 diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e index d292e59d..841537af 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_button_control.e @@ -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 diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e index 3664b7b8..f3ee1f54 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_control.e @@ -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 diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_control.e index f890f7be..6bfbd7be 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_control.e @@ -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)