Removed add_dropdown methods from navbar, some cleanup in different controls
This commit is contained in:
@@ -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 + " <strong class=%"caret%"></strong>")
|
||||
create {WSF_BASIC_CONTROL} dropdown_toggle.make_with_body_class ("a", "data-toggle=%"dropdown%" href=%"#%" type=%"button%" id=%"" + control_name + "_toggle%"", "dropdown-toggle", title + " <strong class=%"caret%"></strong>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ("<label class=%"col-lg-"+label_width.out+" control-label%" for=%"" + value_control.control_name + "%">" + label + "</label>")
|
||||
if attached label as l and then not l.is_empty then
|
||||
body.append ("<label class=%"col-lg-" + label_width.out + " control-label%" for=%"" + value_control.control_name + "%">" + l + "</label>")
|
||||
body.append ("<div class=%"col-lg-" + (12 - label_width).out + "%">")
|
||||
else
|
||||
body.append ("<div class=%"col-lg-12%">")
|
||||
end
|
||||
body.append ("<div class=%"col-lg-"+(12-label_width).out+"%">")
|
||||
body.append (value_control.render)
|
||||
body.append ("</div>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user