htmlgrid 1.2.2 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a894cd7a5db3b2ca1cec59510012c4762173876fc0bba7024019467c4d31995a
4
- data.tar.gz: c06fca0f6b632ecfc29d6c83540ebfc96ca595d883b7b66ff03c3ba6892c7ca5
3
+ metadata.gz: ac32c5daad4ba30a32d15b25f2e7204a333847a571b86d6dc4ff3674327ffd7a
4
+ data.tar.gz: 521a04676dbb15f3522c1c5defd8d1813bc8bf87cb1a7ca7cf5982b02e2e1589
5
5
  SHA512:
6
- metadata.gz: bd9cd290ee26db218bc675434031888db1067bdcb28105f656ad9ef8f1f9bbed20b518b83c7b72129ccdaa6e1412c037e9e17b6cf7f0b70aba34eb1f3fd79fab
7
- data.tar.gz: e42dd5526ec2daca35de2eba08da359305424d1b04fa5d8bc2082b2a23b7d8dbbed109bd5ca162bb970db9839147800d90a491115433b3650fcc93467ac4e928
6
+ metadata.gz: 14e4e35e3639f44ff835416fedd0ec82471e179e6cdeead718aac1bdf49657d558412bf1c52797f82fd366bff37f9cfa3291c284f85f1dde2c6c119fb451918f
7
+ data.tar.gz: 4134060a38dee891f9da25d635c3e65956ce8e94943c1e0bbdd262f34bee18a07c1c19a6df548f1db75f0f2a178189453b81efa79704c7c1a1c5bd1d6298e652
@@ -172,7 +172,7 @@ module HtmlGrid
172
172
  def escape(txt)
173
173
  @@html_entities.each_with_object(txt.to_s.dup) { |map, str|
174
174
  char, entity = map
175
- str.gsub!(char, "&" << entity << ";")
175
+ str.gsub!(char, "&" + entity + ";")
176
176
  }
177
177
  end
178
178
 
@@ -180,8 +180,8 @@ module HtmlGrid
180
180
  def escape_symbols(txt)
181
181
  esc = ""
182
182
  txt.to_s.each_byte { |byte|
183
- esc << if (entity = @@symbol_entities[byte])
184
- "&" << entity << ";"
183
+ esc += if (entity = @@symbol_entities[byte])
184
+ "&" + entity + ";"
185
185
  else
186
186
  byte
187
187
  end
@@ -239,6 +239,8 @@ module HtmlGrid
239
239
  value.to_html(context).to_s.dup.force_encoding("utf-8")
240
240
  elsif value&.is_a?(String)
241
241
  _value = CGI.unescape(value.gsub("+", CGI.escape("+")))
242
+ elsif value&.is_a?(Integer)
243
+ _value = value.to_s
242
244
  end
243
245
  end
244
246
 
@@ -37,9 +37,9 @@ module HtmlGrid
37
37
  def to_html(context)
38
38
  res = ""
39
39
  @grid&.each_with_index { |div, idx|
40
- res << context.div(tag_attributes(idx)) {
40
+ res += context.div(tag_attributes(idx)) {
41
41
  div.flatten.inject("") { |html, item|
42
- html << if item.respond_to?(:to_html)
42
+ html += if item.respond_to?(:to_html)
43
43
  item.to_html(context).force_encoding("utf-8")
44
44
  else
45
45
  item.to_s
@@ -62,10 +62,10 @@ module HtmlGrid
62
62
  else
63
63
  attrs.store("href", @dojo_tooltip)
64
64
  end
65
- html << context.div(attrs)
65
+ html += context.div(attrs)
66
66
  elsif @dojo_tooltip.respond_to?(:to_html)
67
67
  @dojo_tooltip.attributes.update(attrs)
68
- html << @dojo_tooltip.to_html(context).force_encoding("utf-8")
68
+ html += @dojo_tooltip.to_html(context).force_encoding("utf-8")
69
69
  end
70
70
  unless html.empty? || dojo_parse_on_load
71
71
  html << context.script("type" => "text/javascript") {
@@ -73,7 +73,7 @@ module HtmlGrid
73
73
  }
74
74
  end
75
75
  # call original dynamic_html
76
- dojo_dynamic_html(context) << html
76
+ "#{dojo_dynamic_html(context)}#{html}"
77
77
  end
78
78
  end
79
79
  end
@@ -114,7 +114,7 @@ module HtmlGrid
114
114
  ].join(",")
115
115
  args.store("data-dojo-config", config)
116
116
  args.store("src", dojo_path)
117
- headers << context.script(args)
117
+ headers += context.script(args)
118
118
  args = {"type" => "text/javascript"}
119
119
  headers << context.script(args) {
120
120
  package_paths = self.class::DOJO_REQUIRE.map { |req|
data/lib/htmlgrid/form.rb CHANGED
@@ -63,11 +63,10 @@ module HtmlGrid
63
63
  private
64
64
 
65
65
  def hidden_fields(context)
66
- "" <<
67
- context.hidden("flavor", @lookandfeel.flavor) <<
68
- context.hidden("language", @lookandfeel.language) <<
66
+ context.hidden("flavor", @lookandfeel.flavor) +
67
+ context.hidden("language", @lookandfeel.language) +
69
68
  context.hidden({"NAME" => "event", "ID" => "event",
70
- "VALUE" => event.to_s}) <<
69
+ "VALUE" => event.to_s}) +
71
70
  context.hidden("state_id", @session.state.object_id.to_s)
72
71
  end
73
72
 
data/lib/htmlgrid/grid.rb CHANGED
@@ -96,10 +96,10 @@ module HtmlGrid
96
96
  def component_html(cgi)
97
97
  html = ""
98
98
  @components.each { |component|
99
- html << if component.respond_to? :to_html
100
- component.to_html(cgi).to_s.dup.force_encoding("utf-8")
99
+ if component.respond_to? :to_html
100
+ html += component.to_html(cgi).to_s.dup.force_encoding("utf-8")
101
101
  else
102
- component.to_s
102
+ html += component.to_s
103
103
  end
104
104
  }
105
105
  html = "&nbsp;" if html.empty?
@@ -162,7 +162,7 @@ module HtmlGrid
162
162
  span = 1
163
163
  @fields.each { |field|
164
164
  if span < 2
165
- html << field.to_html(cgi)
165
+ html += field.to_html(cgi)
166
166
  span = field.colspan
167
167
  else
168
168
  span -= 1
data/lib/htmlgrid/list.rb CHANGED
@@ -90,7 +90,7 @@ module HtmlGrid
90
90
  ystep = step.at(1)
91
91
  components.each { |matrix, component|
92
92
  key = lookandfeel_key(component)
93
- header_key = "th_" << key.to_s
93
+ header_key = "th_" + key.to_s
94
94
  if (txt = @lookandfeel.lookup(header_key))
95
95
  if self.class::SORT_HEADER
96
96
  @grid.add(sort_link(header_key, matrix, component), *matrix)
@@ -113,7 +113,7 @@ module HtmlGrid
113
113
 
114
114
  def meta_tags(context)
115
115
  self.class::META_TAGS.inject("") { |inj, properties|
116
- inj << context.meta(properties)
116
+ inj += context.meta(properties)
117
117
  }
118
118
  end
119
119
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  module HtmlGrid
4
- VERSION = "1.2.2"
4
+ VERSION = "1.2.4"
5
5
  end
@@ -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
data/test/test_grid.rb CHANGED
@@ -255,15 +255,15 @@ class TestGrid < Minitest::Test
255
255
  assert_equal(expected, @grid.to_html(CGI.new))
256
256
  @grid.add(nil, 1, 1)
257
257
  @grid.add_style("bar", 0, 1, 2)
258
- expected = '<TABLE cellspacing="0"><TR><TD class="foo">&nbsp;</TD>'
259
- expected << '<TD>&nbsp;</TD></TR><TR><TD class="bar">&nbsp;</TD>'
260
- expected << '<TD class="bar">&nbsp;</TD></TR></TABLE>'
258
+ expected = '<TABLE cellspacing="0"><TR><TD class="foo">&nbsp;</TD>'+
259
+ '<TD>&nbsp;</TD></TR><TR><TD class="bar">&nbsp;</TD>' +
260
+ '<TD class="bar">&nbsp;</TD></TR></TABLE>'
261
261
  assert_equal(expected, @grid.to_html(CGI.new))
262
262
  @grid.add_style("foobar", 0, 0, 2, 2)
263
- expected = '<TABLE cellspacing="0"><TR><TD class="foobar">&nbsp;</TD>'
264
- expected << '<TD class="foobar">&nbsp;</TD></TR>'
265
- expected << '<TR><TD class="foobar">&nbsp;</TD>'
266
- expected << '<TD class="foobar">&nbsp;</TD></TR></TABLE>'
263
+ expected = '<TABLE cellspacing="0"><TR><TD class="foobar">&nbsp;</TD>' +
264
+ '<TD class="foobar">&nbsp;</TD></TR>' +
265
+ '<TR><TD class="foobar">&nbsp;</TD>' +
266
+ '<TD class="foobar">&nbsp;</TD></TR></TABLE>'
267
267
  assert_equal(expected, @grid.to_html(CGI.new))
268
268
  end
269
269
 
@@ -292,9 +292,9 @@ class TestGrid < Minitest::Test
292
292
  def test_push
293
293
  @grid.add("bar", 4, 0)
294
294
  @grid.push("foo")
295
- expected = '<TABLE cellspacing="0"><TR><TD>&nbsp;</TD><TD>&nbsp;</TD>'
296
- expected << "<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>bar</TD></TR>"
297
- expected << '<TR><TD colspan="5">foo</TD></TR></TABLE>'
295
+ expected = '<TABLE cellspacing="0"><TR><TD>&nbsp;</TD><TD>&nbsp;</TD>' +
296
+ "<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>bar</TD></TR>" +
297
+ '<TR><TD colspan="5">foo</TD></TR></TABLE>'
298
298
  assert_equal(expected, @grid.to_html(CGI.new))
299
299
  end
300
300
 
data/test/test_label.rb CHANGED
@@ -109,10 +109,10 @@ class TestLabel < Minitest::Test
109
109
  def test_to_html1
110
110
  composite = StubLabelComposite.new(StubLabelModel.new, @session)
111
111
  expected = '<TABLE cellspacing="0"><TR>'
112
- expected << '<TD><LABEL for="componentname">Label</LABEL></TD>'
113
- expected << "<TD>component</TD></TR>"
114
- expected << '<TR><TD><LABEL for="componentname">Named Label</LABEL></TD>'
115
- expected << "<TD>component</TD></TR></TABLE>"
112
+ expected += '<TD><LABEL for="componentname">Label</LABEL></TD>'
113
+ expected += "<TD>component</TD></TR>"
114
+ expected += '<TR><TD><LABEL for="componentname">Named Label</LABEL></TD>'
115
+ expected += "<TD>component</TD></TR></TABLE>"
116
116
  assert_equal(expected, composite.to_html(CGI.new))
117
117
  end
118
118
 
@@ -93,8 +93,7 @@ class TestTemplate < Minitest::Test
93
93
  end
94
94
 
95
95
  def test_to_html
96
- result = ""
97
- result << @template.to_html(CGI.new)
96
+ result = @template.to_html(CGI.new)
98
97
  expected = [
99
98
  "<TITLE>Test</TITLE>",
100
99
  '<LINK rel="stylesheet" type="text/css" async="true" href="http://testserver.com:80/resources/gcc/test.css">',
@@ -111,8 +110,7 @@ class TestTemplate < Minitest::Test
111
110
  @lookandfeel.should_receive(:lookup).with(:html_title).and_return("html_title").by_default
112
111
  @lookandfeel.should_receive(:lookup).with(any).and_return(nil).by_default
113
112
  @template = Template.new(nil, @lookandfeel, nil)
114
- result = ""
115
- result << @template.to_html(CGI.new)
113
+ result = @template.to_html(CGI.new)
116
114
  expected = [
117
115
  "<TITLE>html_title</TITLE>",
118
116
  "this is a dummy CSS file, which should be inlined",
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.2
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2025-01-08 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
@@ -243,7 +257,8 @@ files:
243
257
  homepage: https://github.com/zdavatz/htmlgrid/
244
258
  licenses:
245
259
  - GPL v2.1
246
- metadata: {}
260
+ metadata:
261
+ changelog_uri: https://github.com/zdavatz/htmlgrid//blob/master/History.md
247
262
  post_install_message:
248
263
  rdoc_options: []
249
264
  require_paths:
@@ -259,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
274
  - !ruby/object:Gem::Version
260
275
  version: '0'
261
276
  requirements: []
262
- rubygems_version: 3.1.2
277
+ rubygems_version: 3.5.3
263
278
  signing_key:
264
279
  specification_version: 4
265
280
  summary: HtmlGrid is a Html-ToolKit for Ruby Webframeworks.