Removed add_dropdown methods from navbar, some cleanup in different controls

This commit is contained in:
severin
2014-01-04 13:43:51 +01:00
parent e675e8aad9
commit c9599f449f
6 changed files with 20 additions and 47 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)