Skip to content

Commit 61f90bb

Browse files
committed
Merge branch 'jvelilla-ewf_wsf_html5'
2 parents 8b60ab0 + fac3dd3 commit 61f90bb

23 files changed

+1185
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
note
2+
description: "[
3+
Represent an input type color
4+
Example
5+
<input id="color" name="color" type="color">
6+
]"
7+
date: "$Date$"
8+
revision: "$Revision$"
9+
EIS: "name=color", "src=https://html.spec.whatwg.org/multipage/forms.html#color-state-(type=color)"
10+
class
11+
WSF_FORM_COLOR_INPUT
12+
13+
inherit
14+
WSF_FORM_INPUT
15+
16+
create
17+
make,
18+
make_with_text
19+
20+
feature -- Access
21+
22+
input_type: STRING = "color"
23+
end
24+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
note
2+
description: "[
3+
Example:
4+
<name="startdate" min="2012-01-01" max="2013-01-01" type="date">
5+
]"
6+
date: "$Date$"
7+
revision: "$Revision$"
8+
EIS: "name=date", "src=https://html.spec.whatwg.org/multipage/forms.html#date-state-(type=date)"
9+
10+
class
11+
WSF_FORM_DATE_INPUT
12+
inherit
13+
14+
WSF_FORM_INPUT
15+
redefine
16+
specific_input_attributes_string
17+
end
18+
19+
WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE
20+
21+
create
22+
make,
23+
make_with_text
24+
25+
feature -- Access
26+
27+
input_type: STRING = "date"
28+
29+
30+
feature {NONE} -- Conversion
31+
32+
specific_input_attributes_string: detachable STRING_8
33+
-- Specific input attributes if any.
34+
-- To redefine if needed
35+
do
36+
create Result.make_empty
37+
append_numeric_input_attributes_to (Result)
38+
end
39+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
note
2+
description: "[
3+
Represent an input type datetime
4+
Example
5+
<input id="entry-day-time" name="entry-day-time" type="datetime">
6+
]"
7+
author: ""
8+
date: "$Date$"
9+
revision: "$Revision$"
10+
EIS: "name=datetime", "src=https://html.spec.whatwg.org/multipage/forms.html#date-and-time-state-(type=datetime)"
11+
12+
class
13+
WSF_FORM_DATETIME_INPUT
14+
15+
inherit
16+
17+
WSF_FORM_INPUT
18+
redefine
19+
specific_input_attributes_string
20+
end
21+
22+
WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE
23+
24+
create
25+
make,
26+
make_with_text
27+
28+
feature -- Access
29+
30+
input_type: STRING = "datetime"
31+
32+
33+
feature {NONE} -- Conversion
34+
35+
specific_input_attributes_string: detachable STRING_8
36+
-- Specific input attributes if any.
37+
-- To redefine if needed
38+
do
39+
create Result.make_empty
40+
append_numeric_input_attributes_to (Result)
41+
end
42+
end
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
note
2+
description: "[
3+
Represent an input type datetime-local
4+
Example:
5+
<input id="arrival-time" name="arrival-time " type="datetime-local">
6+
]"
7+
date: "$Date$"
8+
revision: "$Revision$"
9+
EIS: "name=datetime-local", "src=https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)"
10+
class
11+
WSF_FORM_DATETIME_LOCAL_INPUT
12+
inherit
13+
14+
WSF_FORM_INPUT
15+
redefine
16+
specific_input_attributes_string
17+
end
18+
19+
WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE
20+
21+
create
22+
make,
23+
make_with_text
24+
25+
feature -- Access
26+
27+
input_type: STRING = "datetime-local"
28+
29+
30+
feature {NONE} -- Conversion
31+
32+
specific_input_attributes_string: detachable STRING_8
33+
-- Specific input attributes if any.
34+
-- To redefine if needed
35+
do
36+
-- TODO find a way to validte differnet types of
37+
-- values to (min, max and step).
38+
create Result.make_empty
39+
append_numeric_input_attributes_to (Result)
40+
end
41+
end
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
note
2+
description: "[
3+
Represent the intput type email
4+
Example:
5+
<input type="email" name="email" required>
6+
]"
7+
date: "$Date$"
8+
revision: "$Revision$"
9+
EIS: "name=email", "src=https://html.spec.whatwg.org/multipage/forms.html#e-mail-state-(type=email)"
10+
11+
class
12+
WSF_FORM_EMAIL_INPUT
13+
14+
inherit
15+
16+
WSF_FORM_INPUT
17+
18+
create
19+
make,
20+
make_with_text
21+
22+
feature -- Access
23+
24+
input_type: STRING = "email"
25+
26+
end
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
note
2+
description: "[
3+
Represent attributes applicable to input type type=[number, range, date]
4+
The attributes: min, max, step.
5+
]"
6+
date: "$Date$"
7+
revision: "$Revision$"
8+
EIS: "name=numeric attributes", "src=https://html.spec.whatwg.org/multipage/forms.html#common-input-element-attributes"
9+
10+
class
11+
WSF_FORM_FIELD_WITH_NUMERIC_ATTRIBUTE
12+
13+
inherit
14+
15+
SHARED_HTML_ENCODER
16+
17+
18+
feature -- Access
19+
20+
min: detachable READABLE_STRING_8
21+
-- minimun value accepted by Current field.
22+
23+
max: detachable READABLE_STRING_8
24+
-- maximun value accepted by Current field.
25+
26+
step: detachable READABLE_STRING_8
27+
-- step is the increment that the value should adjust up or down, with the default step value being 1.
28+
29+
feature -- Element Change
30+
31+
set_min (a_val: INTEGER)
32+
-- Set `min' with `a_val'.
33+
do
34+
set_min_string (a_val.out)
35+
ensure
36+
min_set: attached min as l_min implies l_min.same_string (a_val.out)
37+
end
38+
39+
set_max (a_val: INTEGER)
40+
-- Set `max' with `a_val'.
41+
do
42+
set_max_string(a_val.out)
43+
ensure
44+
max_set: attached max as l_max implies l_max.same_string (a_val.out)
45+
end
46+
47+
set_step (a_val: REAL)
48+
-- Set `step' with `a_val'.
49+
do
50+
set_step_string (a_val.out)
51+
ensure
52+
step_set: attached step as l_step implies l_step.same_string (a_val.out)
53+
end
54+
55+
set_min_string (a_val: READABLE_STRING_GENERAL)
56+
-- Set `min' with `a_val'.
57+
require
58+
is_valid_number: a_val.is_integer
59+
do
60+
if a_val.is_string_32 then
61+
min := html_encoder.encoded_string (a_val.as_string_32)
62+
elseif a_val.is_string_8 then
63+
min := a_val.as_string_8
64+
end
65+
ensure
66+
min_set: attached min as l_min implies l_min.same_string_general (a_val)
67+
end
68+
69+
set_max_string (a_val: READABLE_STRING_GENERAL)
70+
-- Set `max' with `a_val'.
71+
require
72+
is_valid_number: a_val.is_integer
73+
do
74+
if a_val.is_string_32 then
75+
max := html_encoder.encoded_string (a_val.as_string_32)
76+
elseif a_val.is_string_8 then
77+
max := a_val.as_string_8
78+
end
79+
ensure
80+
max_set: attached max as l_max implies l_max.same_string_general (a_val)
81+
end
82+
83+
set_step_string (a_val: READABLE_STRING_GENERAL)
84+
-- Set `step' with `a_val'.
85+
require
86+
is_valid_sequence: a_val.is_number_sequence or else a_val.is_real_sequence
87+
do
88+
if a_val.is_string_32 then
89+
step := html_encoder.encoded_string (a_val.as_string_32)
90+
elseif a_val.is_string_8 then
91+
step := a_val.as_string_8
92+
end
93+
ensure
94+
step_set: attached step as l_step implies l_step.same_string_general (a_val)
95+
end
96+
97+
98+
feature {NONE} -- Conversion
99+
100+
append_numeric_input_attributes_to (a_target: STRING)
101+
-- append numeric attributes to a_target, if any.
102+
do
103+
--min
104+
if attached min as l_min then
105+
a_target.append (" min=%"")
106+
a_target.append(l_min)
107+
a_target.append_character ('%"')
108+
end
109+
110+
--max
111+
if attached max as l_max then
112+
a_target.append (" max=%"")
113+
a_target.append (l_max)
114+
a_target.append_character ('%"')
115+
end
116+
117+
--step
118+
if attached step as l_step then
119+
a_target.append (" step=%"")
120+
a_target.append (l_step)
121+
a_target.append_character ('%"')
122+
end
123+
end
124+
125+
end

library/server/wsf_html/form/wsf_form_image_input.e

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ inherit
1212
redefine
1313
specific_input_attributes_string
1414
end
15+
WSF_FORM_WITH_ALTERNATIVE_ACTIONS
16+
1517

1618
create
1719
make
@@ -51,6 +53,7 @@ feature {NONE} -- Implementation
5153
if attached alt as l_alt then
5254
Result.append (" alt=%"" + l_alt + "%"")
5355
end
56+
append_submit_image_input_attributes_to (Result)
5457
end
5558

5659
invariant

library/server/wsf_html/form/wsf_form_input.e

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ deferred class
1010
inherit
1111
WSF_FORM_FIELD
1212

13+
WSF_FORM_INPUT_WITH_HTML5
14+
1315
feature {NONE} -- Initialization
1416

1517
make (a_name: like name)
@@ -86,6 +88,7 @@ feature -- Conversion
8688
append_css_class_to (a_html, Void)
8789
append_css_id_to (a_html)
8890
append_css_style_to (a_html)
91+
append_html5_input_attributes_to (a_theme, a_html)
8992

9093
if is_readonly then
9194
a_html.append (" readonly=%"readonly%"")
@@ -131,6 +134,7 @@ feature {NONE} -- Implementation
131134
-- Specific input attributes if any.
132135
--| To redefine if needed
133136
do
137+
-- TODO: should we consider to use theme?
134138
end
135139

136140
end

0 commit comments

Comments
 (0)