htmlgrid 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/htmlgrid/component.rb +2 -0
- data/lib/htmlgrid/component.rb~ +252 -0
- data/lib/htmlgrid/composite.rb +1 -1
- data/lib/htmlgrid/version.rb +1 -1
- data/lib/htmlgrid/version.rb~ +5 -0
- data/test/test_component.rb +7 -0
- data/test/test_component.rb~ +204 -0
- metadata +23 -8
- data/TooltipDialog.txt +0 -73
- data/interaction_no_inline.txt +0 -1216
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87d0fe1b57b1446781886b5c03fff8f9eaef864515f05cfb0312269bb933b925
|
|
4
|
+
data.tar.gz: c134762161a92b02cd1e8658fb22efd6a2d0d89f57c9d088b05236dfd5a3b9dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb5d41e32a404dd906968f050859a7312466d01ce71c57afd8deabb48fbf8caa0884f450e61b59524abeb9cf7d0e224757df0712203163a3243148ac7c323f19
|
|
7
|
+
data.tar.gz: 02c89a8f66c5ce317a14f144d42d9f174ac62f3ae9e63ef1fca735df94ebe504ff69cf259f2aa3500af1fad5fdf02ab0b1b5de70e95f4d19d0dc0733e3b95f3e
|
data/lib/htmlgrid/component.rb
CHANGED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
|
5
|
+
# Copyright (C) 2003 ywesee - intellectual capital connected
|
|
6
|
+
# Andreas Schrafl, Benjamin Fay, Hannes Wyss, Markus Huggler
|
|
7
|
+
#
|
|
8
|
+
# This library is free software; you can redistribute it and/or
|
|
9
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
10
|
+
# License as published by the Free Software Foundation; either
|
|
11
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
12
|
+
#
|
|
13
|
+
# This library is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16
|
+
# Lesser General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
19
|
+
# License along with this library; if not, write to the Free Software
|
|
20
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21
|
+
#
|
|
22
|
+
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
|
23
|
+
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
|
24
|
+
#
|
|
25
|
+
# HtmlGrid::Component -- htmlgrid -- 23.12.2012 -- mhatakeyama@ywesee.com
|
|
26
|
+
# HtmlGrid::Component -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
|
|
27
|
+
#++
|
|
28
|
+
|
|
29
|
+
module HtmlGrid
|
|
30
|
+
class Component
|
|
31
|
+
# sets the 'class' html-attribute
|
|
32
|
+
CSS_CLASS = nil
|
|
33
|
+
# sets the 'id' html-attribute
|
|
34
|
+
CSS_ID = nil
|
|
35
|
+
# other html-attributes
|
|
36
|
+
HTML_ATTRIBUTES = {}
|
|
37
|
+
# default http-headers
|
|
38
|
+
HTTP_HEADERS = {
|
|
39
|
+
"Content-Type" => "text/html",
|
|
40
|
+
"Cache-Control" => "no-cache, max-age=3600, must-revalidate"
|
|
41
|
+
}
|
|
42
|
+
# precede instances of this class with a label?
|
|
43
|
+
LABEL = false
|
|
44
|
+
@@html_entities = [
|
|
45
|
+
["&", "amp"],
|
|
46
|
+
["<", "lt"],
|
|
47
|
+
[">", "gt"]
|
|
48
|
+
] # :nodoc:
|
|
49
|
+
@@symbol_entities = {
|
|
50
|
+
34 => "forall",
|
|
51
|
+
36 => "exist",
|
|
52
|
+
42 => "lowast",
|
|
53
|
+
45 => "minus",
|
|
54
|
+
64 => "cong",
|
|
55
|
+
65 => "Alpha", 97 => "alpha",
|
|
56
|
+
66 => "Beta", 98 => "beta",
|
|
57
|
+
67 => "Chi", 99 => "chi",
|
|
58
|
+
68 => "Delta", 100 => "delta",
|
|
59
|
+
69 => "Epsilon", 101 => "epsilon",
|
|
60
|
+
70 => "Phi", 102 => "phi",
|
|
61
|
+
71 => "Gamma", 103 => "gamma",
|
|
62
|
+
72 => "Eta", 104 => "eta",
|
|
63
|
+
73 => "Iota", 105 => "iota",
|
|
64
|
+
75 => "Kappa", 107 => "kappa",
|
|
65
|
+
76 => "Lambda", 108 => "lambda",
|
|
66
|
+
77 => "Mu", 109 => "mu",
|
|
67
|
+
78 => "Nu", 110 => "nu",
|
|
68
|
+
79 => "Omicron", 111 => "omicron",
|
|
69
|
+
80 => "Pi", 112 => "pi",
|
|
70
|
+
81 => "Theta", 113 => "theta",
|
|
71
|
+
82 => "Rho", 114 => "rho",
|
|
72
|
+
83 => "Sigma", 115 => "sigma",
|
|
73
|
+
84 => "Tau", 116 => "tau",
|
|
74
|
+
85 => "Upsilon", 117 => "upsilon",
|
|
75
|
+
86 => "sigmaf",
|
|
76
|
+
87 => "Omega", 119 => "omega",
|
|
77
|
+
88 => "Xi", 120 => "xi",
|
|
78
|
+
89 => "Psi", 121 => "psi",
|
|
79
|
+
90 => "Zeta", 122 => "zeta",
|
|
80
|
+
94 => "perp", 126 => "sim",
|
|
81
|
+
163 => "le",
|
|
82
|
+
165 => "infin",
|
|
83
|
+
166 => "fnof",
|
|
84
|
+
171 => "harr",
|
|
85
|
+
172 => "larr",
|
|
86
|
+
173 => "uarr",
|
|
87
|
+
174 => "rarr",
|
|
88
|
+
175 => "darr",
|
|
89
|
+
179 => "ge",
|
|
90
|
+
181 => "prop",
|
|
91
|
+
182 => "part",
|
|
92
|
+
185 => "ne",
|
|
93
|
+
186 => "equiv",
|
|
94
|
+
187 => "asymp",
|
|
95
|
+
191 => "crarr",
|
|
96
|
+
196 => "otimes",
|
|
97
|
+
197 => "oplus",
|
|
98
|
+
198 => "empty",
|
|
99
|
+
199 => "cap",
|
|
100
|
+
200 => "cup",
|
|
101
|
+
201 => "sup",
|
|
102
|
+
202 => "supe",
|
|
103
|
+
203 => "nsub",
|
|
104
|
+
204 => "sub",
|
|
105
|
+
205 => "sube",
|
|
106
|
+
206 => "isin",
|
|
107
|
+
207 => "notin",
|
|
108
|
+
208 => "ang",
|
|
109
|
+
209 => "nabla",
|
|
110
|
+
213 => "prod",
|
|
111
|
+
214 => "radic",
|
|
112
|
+
215 => "sdot",
|
|
113
|
+
217 => "and",
|
|
114
|
+
218 => "or",
|
|
115
|
+
219 => "hArr",
|
|
116
|
+
220 => "lArr",
|
|
117
|
+
221 => "uArr",
|
|
118
|
+
222 => "rArr",
|
|
119
|
+
223 => "dArr",
|
|
120
|
+
229 => "sum",
|
|
121
|
+
242 => "int"
|
|
122
|
+
} # :nodoc:
|
|
123
|
+
attr_reader :attributes, :model
|
|
124
|
+
attr_accessor :value
|
|
125
|
+
def initialize(model, session = nil, container = nil)
|
|
126
|
+
@model = model
|
|
127
|
+
@session = session
|
|
128
|
+
@lookandfeel = session.lookandfeel if session.respond_to?(:lookandfeel)
|
|
129
|
+
@container = container
|
|
130
|
+
@attributes = self.class::HTML_ATTRIBUTES.dup
|
|
131
|
+
if css_class
|
|
132
|
+
@attributes.store("class", css_class)
|
|
133
|
+
end
|
|
134
|
+
if css_id
|
|
135
|
+
@attributes.store("id", css_id)
|
|
136
|
+
end
|
|
137
|
+
@value = nil
|
|
138
|
+
@label = self.class::LABEL
|
|
139
|
+
init
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# delegator to @container, default definition in Form
|
|
143
|
+
def autofill?
|
|
144
|
+
@container.autofill? if @container.respond_to?(:autofill?)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# gets the 'class' html-attribute if defined
|
|
148
|
+
def css_class
|
|
149
|
+
@css_class ||= self.class::CSS_CLASS
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# sets the 'class' html-attribute
|
|
153
|
+
def css_class=(css_class)
|
|
154
|
+
@css_class = @attributes["class"] = css_class
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# gets the 'id' html-attribute if defined
|
|
158
|
+
def css_id
|
|
159
|
+
@css_id ||= self.class::CSS_ID
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# sets the 'id' html-attribute
|
|
163
|
+
def css_id=(css_id)
|
|
164
|
+
@css_id = @attributes["id"] = css_id
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def dynamic_html(context)
|
|
168
|
+
""
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# escape '&', '<' and '>' characters in txt
|
|
172
|
+
def escape(txt)
|
|
173
|
+
@@html_entities.each_with_object(txt.to_s.dup) { |map, str|
|
|
174
|
+
char, entity = map
|
|
175
|
+
str.gsub!(char, "&" << entity << ";")
|
|
176
|
+
}
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# escape symbol-font strings
|
|
180
|
+
def escape_symbols(txt)
|
|
181
|
+
esc = ""
|
|
182
|
+
txt.to_s.each_byte { |byte|
|
|
183
|
+
esc << if (entity = @@symbol_entities[byte])
|
|
184
|
+
"&" << entity << ";"
|
|
185
|
+
else
|
|
186
|
+
byte
|
|
187
|
+
end
|
|
188
|
+
}
|
|
189
|
+
esc
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# delegator to @container, default definition in Form
|
|
193
|
+
def formname
|
|
194
|
+
@container.formname if @container.respond_to?(:formname)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def http_headers
|
|
198
|
+
self.class::HTTP_HEADERS.dup
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# precede this instance with a label?
|
|
202
|
+
def label?
|
|
203
|
+
@label
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
attr_writer :label
|
|
207
|
+
|
|
208
|
+
def onclick=(onclick)
|
|
209
|
+
@attributes["onclick"] = onclick
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# delegator to @container, default definition in Template
|
|
213
|
+
def onload=(onload)
|
|
214
|
+
@container.onload = onload if @container.respond_to? :onload=
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# delegator to @container, default definition in Form
|
|
218
|
+
def onsubmit=(onsubmit)
|
|
219
|
+
@container.onsubmit = onsubmit if @container.respond_to? :onsubmit=
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# set a html attribute
|
|
223
|
+
def set_attribute(key, value)
|
|
224
|
+
@attributes.store(key, value)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def tabindex=(tab)
|
|
228
|
+
@attributes.store("tabIndex", tab.to_s)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def to_html(context)
|
|
232
|
+
_to_html(context, @value).to_s.encode("utf-8")
|
|
233
|
+
end
|
|
234
|
+
@@nl2br_ptrn = /(\r\n)|(\n)|(\r)/
|
|
235
|
+
def _to_html(context, value = @value)
|
|
236
|
+
if value.is_a?(Array)
|
|
237
|
+
value.collect { |item| _to_html(context, item) }.join(" ")
|
|
238
|
+
elsif value.respond_to?(:to_html)
|
|
239
|
+
value.to_html(context).to_s.dup.force_encoding("utf-8")
|
|
240
|
+
elsif value&.is_a?(String)
|
|
241
|
+
_value = CGI.unescape(value.gsub("+", CGI.escape("+")))
|
|
242
|
+
# elsif value&.is_a?(Integer)
|
|
243
|
+
# _value = value.to_s
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
private
|
|
248
|
+
|
|
249
|
+
def init
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
end
|
data/lib/htmlgrid/composite.rb
CHANGED
|
@@ -163,7 +163,7 @@ module HtmlGrid
|
|
|
163
163
|
end
|
|
164
164
|
rescue => exc
|
|
165
165
|
exc.backtrace.push(sprintf("%s::COMPONENTS[%s] in create(%s)",
|
|
166
|
-
self.class, components.
|
|
166
|
+
self.class, components.key(component).inspect, component))
|
|
167
167
|
raise exc
|
|
168
168
|
end
|
|
169
169
|
|
data/lib/htmlgrid/version.rb
CHANGED
data/test/test_component.rb
CHANGED
|
@@ -162,6 +162,13 @@ class TestComponent < Minitest::Test
|
|
|
162
162
|
assert_equal(true, comp.label?)
|
|
163
163
|
end
|
|
164
164
|
|
|
165
|
+
def test_integer_to_html
|
|
166
|
+
comp = HtmlGrid::Component.new("context")
|
|
167
|
+
comp.value = 3
|
|
168
|
+
result = comp.to_html(CGI.new)
|
|
169
|
+
assert_equal("3", result)
|
|
170
|
+
end
|
|
171
|
+
|
|
165
172
|
def test_escape
|
|
166
173
|
txt = "Guten Tag! & wie gehts uns denn heute? '<' schlechter oder '>' besser?"
|
|
167
174
|
control = txt.dup
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# HtmlGrid -- HyperTextMarkupLanguage Framework
|
|
4
|
+
# Copyright (C) 2003 ywesee - intellectual capital connected
|
|
5
|
+
# Hannes Wyss
|
|
6
|
+
#
|
|
7
|
+
# This library is free software; you can redistribute it and/or
|
|
8
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
9
|
+
# License as published by the Free Software Foundation; either
|
|
10
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
11
|
+
#
|
|
12
|
+
# This library is distributed in the hope that it will be useful,
|
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15
|
+
# Lesser General Public License for more details.
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
18
|
+
# License along with this library; if not, write to the Free Software
|
|
19
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20
|
+
#
|
|
21
|
+
# ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
|
|
22
|
+
# htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
|
|
23
|
+
#
|
|
24
|
+
# TestComponent -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
|
|
25
|
+
|
|
26
|
+
$: << File.expand_path("../lib", File.dirname(__FILE__))
|
|
27
|
+
$: << File.expand_path("../ext", File.dirname(__FILE__))
|
|
28
|
+
$: << File.dirname(__FILE__)
|
|
29
|
+
|
|
30
|
+
require "minitest/autorun"
|
|
31
|
+
require "htmlgrid/component"
|
|
32
|
+
require "stub/cgi"
|
|
33
|
+
|
|
34
|
+
module HtmlGrid
|
|
35
|
+
class Component
|
|
36
|
+
attr_reader :session, :container
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class TestComponent < Minitest::Test
|
|
41
|
+
STRING_WITH_SHARP = "Test_#_gartenhat"
|
|
42
|
+
STRING_WITH_PLUS = "Test_+_plus"
|
|
43
|
+
STRING_WITH_UMLAUT = "Test_with_Umlaut_üé"
|
|
44
|
+
class StubAttributeComponent < HtmlGrid::Component
|
|
45
|
+
HTML_ATTRIBUTES = {"key" => "val"}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
class StubInitComponent < HtmlGrid::Component
|
|
49
|
+
attr_reader :init_called
|
|
50
|
+
def init
|
|
51
|
+
@init_called = true
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class StubLabelComponent < HtmlGrid::Component
|
|
56
|
+
LABEL = true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class StubContainer
|
|
60
|
+
attr_accessor :onsubmit
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class ToHTMLreturnFrozen
|
|
64
|
+
def initialize content
|
|
65
|
+
@content = content
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def to_html(what)
|
|
69
|
+
@content.to_s.freeze
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def setup
|
|
74
|
+
@component = HtmlGrid::Component.new(nil, nil)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_initialize1
|
|
78
|
+
HtmlGrid::Component.new("foo", "bar")
|
|
79
|
+
comp = HtmlGrid::Component.new("foo", "bar")
|
|
80
|
+
assert_equal("foo", comp.model)
|
|
81
|
+
assert_equal("bar", comp.session)
|
|
82
|
+
assert_nil(comp.container)
|
|
83
|
+
assert_equal(false, comp.label?)
|
|
84
|
+
comp.label = true
|
|
85
|
+
assert_equal(true, comp.label?)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def test_initialize2
|
|
89
|
+
HtmlGrid::Component.new("foo", "bar", "baz")
|
|
90
|
+
comp = HtmlGrid::Component.new("foo", "bar", "baz")
|
|
91
|
+
assert_equal("foo", comp.model)
|
|
92
|
+
assert_equal("bar", comp.session)
|
|
93
|
+
assert_equal("baz", comp.container)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_to_html
|
|
97
|
+
comp = HtmlGrid::Component.new("foo", "bar", "baz").to_html(CGI.new)
|
|
98
|
+
assert_equal("", comp)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Next is test for https://github.com/zdavatz/oddb.org/issues/118 FrozenError at /de/just-medical
|
|
102
|
+
def test_to_html_frozen_empty
|
|
103
|
+
comp = HtmlGrid::Component.new("context")
|
|
104
|
+
comp.value = ToHTMLreturnFrozen.new("")
|
|
105
|
+
result = comp.to_html(CGI.new)
|
|
106
|
+
assert_equal("", result)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def test_gartenhag_to_html
|
|
110
|
+
comp = HtmlGrid::Component.new("context")
|
|
111
|
+
comp.value = STRING_WITH_SHARP
|
|
112
|
+
result = comp.to_html(CGI.new)
|
|
113
|
+
assert_equal(STRING_WITH_SHARP, result)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_minus_to_html
|
|
117
|
+
comp = HtmlGrid::Component.new("context")
|
|
118
|
+
comp.value = STRING_WITH_PLUS
|
|
119
|
+
result = comp.to_html(CGI.new)
|
|
120
|
+
assert_equal(STRING_WITH_PLUS, result)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_umlaut_to_html
|
|
124
|
+
comp = HtmlGrid::Component.new("context")
|
|
125
|
+
comp.value = STRING_WITH_UMLAUT
|
|
126
|
+
result = comp.to_html(CGI.new)
|
|
127
|
+
assert_equal(STRING_WITH_UMLAUT, result)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def test_escaped_STRING_WITH_UMLAUT_to_html
|
|
131
|
+
comp = HtmlGrid::Component.new("context")
|
|
132
|
+
comp.value = CGI.escape(STRING_WITH_UMLAUT)
|
|
133
|
+
result = comp.to_html(CGI.new)
|
|
134
|
+
assert_equal(STRING_WITH_UMLAUT, result)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_initialize3
|
|
138
|
+
comp = StubAttributeComponent.new("foo", "bar")
|
|
139
|
+
expected = {"key" => "val"}
|
|
140
|
+
assert_respond_to(comp, :attributes)
|
|
141
|
+
assert_equal(expected, comp.attributes)
|
|
142
|
+
assert_equal(expected, StubAttributeComponent::HTML_ATTRIBUTES)
|
|
143
|
+
comp.attributes.store("other", "val")
|
|
144
|
+
expected2 = {"key" => "val", "other" => "val"}
|
|
145
|
+
assert_equal(expected2, comp.attributes)
|
|
146
|
+
assert_equal(expected, StubAttributeComponent::HTML_ATTRIBUTES)
|
|
147
|
+
assert_equal({}, @component.attributes)
|
|
148
|
+
assert_equal({}, HtmlGrid::Component::HTML_ATTRIBUTES)
|
|
149
|
+
@component.attributes.store("third", "val")
|
|
150
|
+
expected = {"third" => "val"}
|
|
151
|
+
assert_equal(expected, @component.attributes)
|
|
152
|
+
assert_equal({}, HtmlGrid::Component::HTML_ATTRIBUTES)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def test_initialize4
|
|
156
|
+
comp = StubInitComponent.new("foo", "bar")
|
|
157
|
+
assert_equal(true, comp.init_called)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_initialize5
|
|
161
|
+
comp = StubLabelComponent.new(nil, nil)
|
|
162
|
+
assert_equal(true, comp.label?)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def test_integer_to_html
|
|
166
|
+
comp = HtmlGrid::Component.new("context")
|
|
167
|
+
comp.value = 3
|
|
168
|
+
result = comp.to_html(CGI.new)
|
|
169
|
+
assert_equal("xx", result)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def test_escape
|
|
173
|
+
txt = "Guten Tag! & wie gehts uns denn heute? '<' schlechter oder '>' besser?"
|
|
174
|
+
control = txt.dup
|
|
175
|
+
expected = "Guten Tag! & wie gehts uns denn heute? '<' schlechter oder '>' besser?"
|
|
176
|
+
assert_equal(expected, @component.escape(txt))
|
|
177
|
+
assert_equal(control, txt)
|
|
178
|
+
assert_equal(expected, @component.escape(txt))
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def test_escape_symbols
|
|
182
|
+
txt = "\263"
|
|
183
|
+
expected = "≥"
|
|
184
|
+
assert_equal(expected, @component.escape_symbols(txt))
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def test_onsubmit
|
|
188
|
+
@component.onsubmit = "submitted"
|
|
189
|
+
assert_equal({}, @component.attributes)
|
|
190
|
+
cont = StubContainer.new
|
|
191
|
+
comp = HtmlGrid::Component.new("foo", "bar", cont)
|
|
192
|
+
comp.onsubmit = "submitted"
|
|
193
|
+
assert_equal("submitted", cont.onsubmit)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def test_set_attribute
|
|
197
|
+
assert_equal({}, @component.attributes)
|
|
198
|
+
@component.set_attribute("href", "http://www.ywesee.com")
|
|
199
|
+
expected = {
|
|
200
|
+
"href" => "http://www.ywesee.com"
|
|
201
|
+
}
|
|
202
|
+
assert_equal(expected, @component.attributes)
|
|
203
|
+
end
|
|
204
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: htmlgrid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sbsm
|
|
@@ -38,6 +38,20 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: 1.6.4
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: psych
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "<"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 4.0.0
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "<"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 4.0.0
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: bundler
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -171,12 +185,11 @@ extensions: []
|
|
|
171
185
|
extra_rdoc_files: []
|
|
172
186
|
files:
|
|
173
187
|
- Manifest.txt
|
|
174
|
-
- TooltipDialog.txt
|
|
175
|
-
- interaction_no_inline.txt
|
|
176
188
|
- lib/htmlgrid/booleanvalue.rb
|
|
177
189
|
- lib/htmlgrid/button.rb
|
|
178
190
|
- lib/htmlgrid/centeredcomposite.rb
|
|
179
191
|
- lib/htmlgrid/component.rb
|
|
192
|
+
- lib/htmlgrid/component.rb~
|
|
180
193
|
- lib/htmlgrid/composite.rb
|
|
181
194
|
- lib/htmlgrid/datevalue.rb
|
|
182
195
|
- lib/htmlgrid/div.rb
|
|
@@ -223,10 +236,12 @@ files:
|
|
|
223
236
|
- lib/htmlgrid/urllink.rb
|
|
224
237
|
- lib/htmlgrid/value.rb
|
|
225
238
|
- lib/htmlgrid/version.rb
|
|
239
|
+
- lib/htmlgrid/version.rb~
|
|
226
240
|
- test/stub/cgi.rb
|
|
227
241
|
- test/suite.rb
|
|
228
242
|
- test/test_add_row.rb
|
|
229
243
|
- test/test_component.rb
|
|
244
|
+
- test/test_component.rb~
|
|
230
245
|
- test/test_composite.rb
|
|
231
246
|
- test/test_datevalue.rb
|
|
232
247
|
- test/test_divlist.rb
|
|
@@ -246,7 +261,7 @@ homepage: https://github.com/zdavatz/htmlgrid/
|
|
|
246
261
|
licenses:
|
|
247
262
|
- GPL v2.1
|
|
248
263
|
metadata: {}
|
|
249
|
-
post_install_message:
|
|
264
|
+
post_install_message:
|
|
250
265
|
rdoc_options: []
|
|
251
266
|
require_paths:
|
|
252
267
|
- lib
|
|
@@ -261,8 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
261
276
|
- !ruby/object:Gem::Version
|
|
262
277
|
version: '0'
|
|
263
278
|
requirements: []
|
|
264
|
-
rubygems_version: 3.
|
|
265
|
-
signing_key:
|
|
279
|
+
rubygems_version: 3.3.20
|
|
280
|
+
signing_key:
|
|
266
281
|
specification_version: 4
|
|
267
282
|
summary: HtmlGrid is a Html-ToolKit for Ruby Webframeworks.
|
|
268
283
|
test_files: []
|
data/TooltipDialog.txt
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/>>built
|
|
2
|
-
require({cache:{"url:dijit/templates/TooltipDialog.html":"<div role=\"alertdialog\" tabIndex=\"-1\">\n\t<div class=\"dijitTooltipContainer\" role=\"presentation\">\n\t\t<div data-dojo-attach-point=\"contentsNode\" class=\"dijitTooltipContents dijitTooltipFocusNode\">\n\t\t\t<div data-dojo-attach-point=\"containerNode\"></div>\n\t\t\t${!actionBarTemplate}\n\t\t</div>\n\t</div>\n\t<div class=\"dijitTooltipConnector\" role=\"presentation\" data-dojo-attach-point=\"connectorNode\"></div>\n</div>\n"}});
|
|
3
|
-
define("dijit/TooltipDialog",["dojo/_base/declare","dojo/dom-class","dojo/has","dojo/keys","dojo/_base/lang","dojo/on","./focus","./layout/ContentPane","./_DialogMixin","./form/_FormMixin","./_TemplatedMixin","dojo/text!./templates/TooltipDialog.html","./main"],function(_1,_2,_3,_4,_5,on,_6,_7,_8,_9,_a,_b,_c){
|
|
4
|
-
var _d=_1("dijit.TooltipDialog",[_7,_a,_9,_8],{title:"",doLayout:false,autofocus:true,baseClass:"dijitTooltipDialog",_firstFocusItem:null,_lastFocusItem:null,templateString:_b,_setTitleAttr:"containerNode",postCreate:function(){
|
|
5
|
-
this.inherited(arguments);
|
|
6
|
-
this.own(on(this.domNode,"keydown",_5.hitch(this,"_onKey")));
|
|
7
|
-
},orient:function(_e,_f,_10){
|
|
8
|
-
var _11={"MR-ML":"dijitTooltipRight","ML-MR":"dijitTooltipLeft","TM-BM":"dijitTooltipAbove","BM-TM":"dijitTooltipBelow","BL-TL":"dijitTooltipBelow dijitTooltipABLeft","TL-BL":"dijitTooltipAbove dijitTooltipABLeft","BR-TR":"dijitTooltipBelow dijitTooltipABRight","TR-BR":"dijitTooltipAbove dijitTooltipABRight","BR-BL":"dijitTooltipRight","BL-BR":"dijitTooltipLeft","BR-TL":"dijitTooltipBelow dijitTooltipABLeft","BL-TR":"dijitTooltipBelow dijitTooltipABRight","TL-BR":"dijitTooltipAbove dijitTooltipABRight","TR-BL":"dijitTooltipAbove dijitTooltipABLeft"}[_f+"-"+_10];
|
|
9
|
-
_2.replace(this.domNode,_11,this._currentOrientClass||"");
|
|
10
|
-
this._currentOrientClass=_11;
|
|
11
|
-
},focus:function(){
|
|
12
|
-
this._getFocusItems();
|
|
13
|
-
_6.focus(this._firstFocusItem);
|
|
14
|
-
},onOpen:function(pos){
|
|
15
|
-
this.orient(this.domNode,pos.aroundCorner,pos.corner);
|
|
16
|
-
var _12=pos.aroundNodePos;
|
|
17
|
-
if(pos.corner.charAt(0)=="M"&&pos.aroundCorner.charAt(0)=="M"){
|
|
18
|
-
this.connectorNode.style.top=_12.y+((_12.h-this.connectorNode.offsetHeight)>>1)-pos.y+"px";
|
|
19
|
-
this.connectorNode.style.left="";
|
|
20
|
-
}else{
|
|
21
|
-
if(pos.corner.charAt(1)=="M"&&pos.aroundCorner.charAt(1)=="M"){
|
|
22
|
-
this.connectorNode.style.left=_12.x+((_12.w-this.connectorNode.offsetWidth)>>1)-pos.x+"px";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
this._onShow();
|
|
26
|
-
},onClose:function(){
|
|
27
|
-
this.onHide();
|
|
28
|
-
},_onKey:function(evt){
|
|
29
|
-
if(evt.keyCode==_4.ESCAPE){
|
|
30
|
-
this.defer("onCancel");
|
|
31
|
-
evt.stopPropagation();
|
|
32
|
-
evt.preventDefault();
|
|
33
|
-
}else{
|
|
34
|
-
if(evt.keyCode==_4.TAB){
|
|
35
|
-
var _13=evt.target;
|
|
36
|
-
this._getFocusItems();
|
|
37
|
-
if(this._firstFocusItem==this._lastFocusItem){
|
|
38
|
-
evt.stopPropagation();
|
|
39
|
-
evt.preventDefault();
|
|
40
|
-
}else{
|
|
41
|
-
if(_13==this._firstFocusItem&&evt.shiftKey){
|
|
42
|
-
_6.focus(this._lastFocusItem);
|
|
43
|
-
evt.stopPropagation();
|
|
44
|
-
evt.preventDefault();
|
|
45
|
-
}else{
|
|
46
|
-
if(_13==this._lastFocusItem&&!evt.shiftKey){
|
|
47
|
-
_6.focus(this._firstFocusItem);
|
|
48
|
-
evt.stopPropagation();
|
|
49
|
-
evt.preventDefault();
|
|
50
|
-
}else{
|
|
51
|
-
evt.stopPropagation();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}});
|
|
58
|
-
if(_3("dojo-bidi")){
|
|
59
|
-
_d.extend({_setTitleAttr:function(_14){
|
|
60
|
-
this.containerNode.title=(this.textDir&&this.enforceTextDirWithUcc)?this.enforceTextDirWithUcc(null,_14):_14;
|
|
61
|
-
this._set("title",_14);
|
|
62
|
-
},_setTextDirAttr:function(_15){
|
|
63
|
-
if(!this._created||this.textDir!=_15){
|
|
64
|
-
this._set("textDir",_15);
|
|
65
|
-
if(this.textDir&&this.title){
|
|
66
|
-
this.containerNode.title=this.enforceTextDirWithUcc(null,this.title);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}});
|
|
70
|
-
}
|
|
71
|
-
return _d;
|
|
72
|
-
});
|
|
73
|
-
|