diff --git a/draft/library/wsf_js_widget/kernel/dropdown/wsf_dropdown_control.e b/draft/library/wsf_js_widget/kernel/dropdown/wsf_dropdown_control.e index 9417242a..55576f21 100644 --- a/draft/library/wsf_js_widget/kernel/dropdown/wsf_dropdown_control.e +++ b/draft/library/wsf_js_widget/kernel/dropdown/wsf_dropdown_control.e @@ -31,9 +31,10 @@ feature {NONE} -- Initialization do make_multi_control_with_tag_name (t) add_class ("dropdown") - create {WSF_BASIC_CONTROL} dropdown_toggle.make_with_body_class ("a", "data-toggle=%"dropdown%" href=%"#%"", "dropdown-toggle", title + " ") + create {WSF_BASIC_CONTROL} dropdown_toggle.make_with_body_class ("a", "data-toggle=%"dropdown%" href=%"#%" type=%"button%" id=%"" + control_name + "_toggle%"", "dropdown-toggle", title + " ") create dropdown_menu.make_with_tag_name ("ul") dropdown_menu.add_class ("dropdown-menu") + dropdown_menu.append_attribute ("role=%"menu%" aria-labelledby=%"" + control_name + "_toggle%"") add_control (dropdown_toggle) add_control (dropdown_menu) end @@ -46,6 +47,7 @@ feature -- Change do create li.make_with_tag_name ("li") li.append_attribute ("role=%"presentation%"") + c.append_attribute ("role=%"menuitem%" tabindex=%"-1%"") li.add_control (c) dropdown_menu.add_control (li) end diff --git a/draft/library/wsf_js_widget/kernel/navbar/wsf_navbar_control.e b/draft/library/wsf_js_widget/kernel/navbar/wsf_navbar_control.e index 4c7b69b9..55290f69 100644 --- a/draft/library/wsf_js_widget/kernel/navbar/wsf_navbar_control.e +++ b/draft/library/wsf_js_widget/kernel/navbar/wsf_navbar_control.e @@ -28,14 +28,14 @@ feature {NONE} -- Initialization active_set := false add_class ("navbar navbar-inverse navbar-fixed-top") create nav.make_with_tag_name ("ul") - create nav_right.make_with_tag_name ( "ul") - controls.extend (nav) - controls.extend (nav_right) + create nav_right.make_with_tag_name ("ul") + add_control (nav) + add_control (nav_right) nav.add_class ("nav navbar-nav") nav_right.add_class ("nav navbar-nav navbar-right") end - make_with_brand ( b: STRING) + make_with_brand (b: STRING) -- Initialize with specified brand string do make @@ -80,30 +80,6 @@ feature -- Change active_set := true end - 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 ("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 ("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 diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e index 1494a207..eecb9413 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_form_element_control.e @@ -25,24 +25,22 @@ create feature {NONE} -- Initialization - make (a_label: STRING; c: WSF_VALUE_CONTROL [G]) + make (a_label: detachable STRING; c: WSF_VALUE_CONTROL [G]) -- Initialize form element control with a specific label and value control do make_with_validators (a_label, c, create {ARRAYED_LIST [WSF_VALIDATOR [G]]}.make (0)) end - make_with_validators (a_label: STRING; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]]) + make_with_validators (a_label: detachable STRING; c: WSF_VALUE_CONTROL [G]; v: LIST [WSF_VALIDATOR [G]]) -- Initialize form element control with a specific label, value control and list of validators do make_control ("div") add_class ("form-group") - if not attached {WSF_VALUE_CONTROL [LIST[ANY]]} c then - + if not attached {WSF_VALUE_CONTROL [LIST [ANY]]} c then c.add_class ("form-control") else c.add_class ("form-control-static") end - label_width := 2 value_control := c validators := v @@ -146,10 +144,12 @@ feature -- Implementation body: STRING do body := "" - if not label.is_empty then - body.append ("") + if attached label as l and then not l.is_empty then + body.append ("") + body.append ("
") + else + body.append ("
") end - body.append ("
") body.append (value_control.render) body.append ("
") Result := render_tag (body, "") @@ -203,7 +203,7 @@ feature -- Properties validators: LIST [WSF_VALIDATOR [G]] -- The validators which check the input when validaton is performed - label: STRING + label: detachable STRING -- The label of this form element control error: STRING diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e index 44da1df7..1b9b3800 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_multi_control.e @@ -164,7 +164,7 @@ feature -- Rendering Result := Result + c.item.render end if not tag_name.is_empty then - Result := render_tag (Result, "") + Result := render_tag (Result, attributes) end 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 26b581ad..3d9b2e1e 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 @@ -86,6 +86,7 @@ feature -- Rendering l_attributes.append_character ('%"') end Result := "<" + tag + " " + l_attributes + -- Check if we have to render a body. For some elements, this is not the case (like textareas) or only if the body is not empty. if body.is_empty and not tag.same_string ("textarea") and not tag.same_string ("span") and not tag.same_string ("button") and not tag.same_string ("ul") and not tag.same_string ("div") then Result.append (" />") else @@ -96,11 +97,7 @@ feature -- Rendering render_tag_with_body (body: STRING): STRING -- Generate HTML of this control with the specified body do - if attached attributes as attrs then - Result := render_tag (body, attrs) - else - Result := render_tag (body, "") - end + Result := render_tag (body, attributes) end render: STRING diff --git a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_multi_control.e b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_multi_control.e index 9e3579cd..18a192ce 100644 --- a/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_multi_control.e +++ b/draft/library/wsf_js_widget/kernel/webcontrol/wsf_stateless_multi_control.e @@ -1,4 +1,3 @@ - note description: "Summary description for {WSF_STATELESS_MULTI_CONTROL}." author: "" @@ -38,8 +37,6 @@ feature {NONE} -- Initialization feature - - set_control_id (d: INTEGER) do control_id := d @@ -74,6 +71,7 @@ feature d.control_name_prefix := control_name_prefix + control_id.out + "_" end end + feature -- Event handling handle_callback (cname: LIST [STRING]; event: STRING; event_parameter: detachable ANY)