htmlgrid 1.2.0 → 1.2.1

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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/htmlgrid/booleanvalue.rb +14 -14
  3. data/lib/htmlgrid/button.rb +9 -9
  4. data/lib/htmlgrid/centeredcomposite.rb +21 -20
  5. data/lib/htmlgrid/component.rb +214 -199
  6. data/lib/htmlgrid/composite.rb +332 -301
  7. data/lib/htmlgrid/datevalue.rb +12 -12
  8. data/lib/htmlgrid/div.rb +9 -9
  9. data/lib/htmlgrid/divcomposite.rb +44 -43
  10. data/lib/htmlgrid/divform.rb +8 -8
  11. data/lib/htmlgrid/divlist.rb +17 -19
  12. data/lib/htmlgrid/divtemplate.rb +6 -6
  13. data/lib/htmlgrid/dojotoolkit.rb +54 -48
  14. data/lib/htmlgrid/errormessage.rb +47 -43
  15. data/lib/htmlgrid/form.rb +70 -62
  16. data/lib/htmlgrid/formlist.rb +14 -14
  17. data/lib/htmlgrid/grid.rb +111 -67
  18. data/lib/htmlgrid/image.rb +17 -16
  19. data/lib/htmlgrid/infomessage.rb +15 -14
  20. data/lib/htmlgrid/input.rb +34 -32
  21. data/lib/htmlgrid/inputcheckbox.rb +13 -13
  22. data/lib/htmlgrid/inputcurrency.rb +9 -9
  23. data/lib/htmlgrid/inputdate.rb +11 -11
  24. data/lib/htmlgrid/inputfile.rb +13 -12
  25. data/lib/htmlgrid/inputradio.rb +9 -9
  26. data/lib/htmlgrid/inputtext.rb +10 -10
  27. data/lib/htmlgrid/javascript.rb +17 -16
  28. data/lib/htmlgrid/label.rb +53 -49
  29. data/lib/htmlgrid/labeltext.rb +8 -8
  30. data/lib/htmlgrid/link.rb +31 -27
  31. data/lib/htmlgrid/list.rb +121 -110
  32. data/lib/htmlgrid/namedcomponent.rb +28 -25
  33. data/lib/htmlgrid/pass.rb +11 -11
  34. data/lib/htmlgrid/passthru.rb +20 -17
  35. data/lib/htmlgrid/popuplink.rb +41 -39
  36. data/lib/htmlgrid/reset.rb +8 -8
  37. data/lib/htmlgrid/richtext.rb +22 -20
  38. data/lib/htmlgrid/select.rb +28 -26
  39. data/lib/htmlgrid/span.rb +9 -9
  40. data/lib/htmlgrid/spancomposite.rb +18 -18
  41. data/lib/htmlgrid/spanlist.rb +9 -9
  42. data/lib/htmlgrid/staticinput.rb +14 -13
  43. data/lib/htmlgrid/submit.rb +9 -9
  44. data/lib/htmlgrid/template.rb +120 -105
  45. data/lib/htmlgrid/text.rb +9 -9
  46. data/lib/htmlgrid/textarea.rb +19 -17
  47. data/lib/htmlgrid/ulcomposite.rb +22 -22
  48. data/lib/htmlgrid/ullist.rb +9 -9
  49. data/lib/htmlgrid/urllink.rb +38 -36
  50. data/lib/htmlgrid/value.rb +9 -9
  51. data/lib/htmlgrid/version.rb +2 -2
  52. data/test/stub/cgi.rb +10 -7
  53. data/test/suite.rb +3 -3
  54. data/test/test_add_row.rb +12 -13
  55. data/test/test_component.rb +121 -100
  56. data/test/test_composite.rb +85 -46
  57. data/test/test_datevalue.rb +28 -24
  58. data/test/test_divlist.rb +126 -0
  59. data/test/test_dojotoolkit.rb +41 -27
  60. data/test/test_form.rb +89 -73
  61. data/test/test_formlist.rb +77 -65
  62. data/test/test_grid.rb +256 -208
  63. data/test/test_input.rb +37 -31
  64. data/test/test_interaction_list.rb +106 -70
  65. data/test/test_label.rb +91 -77
  66. data/test/test_list.rb +110 -95
  67. data/test/test_select.rb +35 -30
  68. data/test/test_template.rb +63 -55
  69. data/test/test_text.rb +36 -31
  70. metadata +17 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -25,20 +25,23 @@
25
25
  # PassThru -- HtmlGrid -- 29.10.2003 -- hwyss@ywesee.com
26
26
 
27
27
  module HtmlGrid
28
- class PassThru
29
- def initialize(model, session, container=nil)
30
- @model = model
31
- @session = session
32
- @lookandfeel = @session.lookandfeel
33
- init()
34
- end
35
- def init
36
- end
37
- def http_headers
38
- {}
39
- end
40
- def to_html(context)
41
- ''
42
- end
43
- end
28
+ class PassThru
29
+ def initialize(model, session, container = nil)
30
+ @model = model
31
+ @session = session
32
+ @lookandfeel = @session.lookandfeel
33
+ init
34
+ end
35
+
36
+ def init
37
+ end
38
+
39
+ def http_headers
40
+ {}
41
+ end
42
+
43
+ def to_html(context)
44
+ ""
45
+ end
46
+ end
44
47
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,45 +22,47 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # PopupLink -- htmlgrid -- 20.03.2003 -- hwyss@ywesee.com
25
+ # PopupLink -- htmlgrid -- 20.03.2003 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/link'
27
+ require "htmlgrid/link"
28
28
 
29
- module HtmlGrid
30
- class PopupLink < Link
31
- attr_writer :width, :height
32
- attr_writer :locationbar, :scrollbars, :resizable, :toolbar, :menubar
33
- def init
34
- super
35
- @scrollbars = true
36
- @resizable = true
37
- @toolbar = true
38
- @menubar = false
39
- @locationbar = false
40
- @width = 750
41
- @height = 460
42
- end
29
+ module HtmlGrid
30
+ class PopupLink < Link
31
+ attr_writer :width, :height
32
+ attr_writer :locationbar, :scrollbars, :resizable, :toolbar, :menubar
33
+ def init
34
+ super
35
+ @scrollbars = true
36
+ @resizable = true
37
+ @toolbar = true
38
+ @menubar = false
39
+ @locationbar = false
40
+ @width = 750
41
+ @height = 460
42
+ end
43
43
  @@name_ptrn = /[^a-z]+/i
44
- def to_html(context)
45
- props = {
46
- 'scrollbars' => yesorno(@scrollbars),
47
- 'resizable' => yesorno(@resizable),
48
- 'toolbar' => yesorno(@toolbar),
49
- 'menubar' => yesorno(@menubar),
50
- 'locationbar' => yesorno(@locationbar),
51
- 'width' => @width,
52
- 'height' => @height,
53
- }.collect { |key, val|
54
- [key,val].join('=')
55
- }.join(',')
56
- name = @lookandfeel.lookup(@name).to_s.gsub(@@name_ptrn, '')
57
- script = "window.open('#{href}', '#{name}', '#{props}').focus(); return false"
58
- @attributes.store('onClick', script)
59
- super
60
- end
61
- private
62
- def yesorno(value)
63
- value ? 'yes' : 'no'
64
- end
65
- end
44
+ def to_html(context)
45
+ props = {
46
+ "scrollbars" => yesorno(@scrollbars),
47
+ "resizable" => yesorno(@resizable),
48
+ "toolbar" => yesorno(@toolbar),
49
+ "menubar" => yesorno(@menubar),
50
+ "locationbar" => yesorno(@locationbar),
51
+ "width" => @width,
52
+ "height" => @height
53
+ }.collect { |key, val|
54
+ [key, val].join("=")
55
+ }.join(",")
56
+ name = @lookandfeel.lookup(@name).to_s.gsub(@@name_ptrn, "")
57
+ script = "window.open('#{href}', '#{name}', '#{props}').focus(); return false"
58
+ @attributes.store("onClick", script)
59
+ super
60
+ end
61
+
62
+ private
63
+
64
+ def yesorno(value)
65
+ value ? "yes" : "no"
66
+ end
67
+ end
66
68
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -24,13 +24,13 @@
24
24
  #
25
25
  # Reset -- htmlgrid -- 14.01.2003 -- benfay@ywesee.com
26
26
 
27
- require 'htmlgrid/staticinput'
27
+ require "htmlgrid/staticinput"
28
28
 
29
29
  module HtmlGrid
30
- class Reset < StaticInput
31
- def init
32
- super
33
- @attributes['type'] = 'reset'
34
- end
35
- end
30
+ class Reset < StaticInput
31
+ def init
32
+ super
33
+ @attributes["type"] = "reset"
34
+ end
35
+ end
36
36
  end
@@ -1,26 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  # Richtext -- htmlgrid -- 29.06.2004 -- mhuggler@ywesee.com
4
4
 
5
- require 'htmlgrid/component'
5
+ require "htmlgrid/component"
6
6
 
7
7
  module HtmlGrid
8
- class RichText < Component
9
- def init
10
- super
11
- @elements = []
12
- end
13
- def <<(element)
14
- @elements.push(element)
15
- end
16
- def to_html(context)
17
- @elements.collect { |element|
18
- if(element.respond_to?(:to_html))
19
- element.to_html(context).force_encoding('utf-8')
20
- else
21
- element.to_s
22
- end
23
- }.join(' ')
24
- end
25
- end
8
+ class RichText < Component
9
+ def init
10
+ super
11
+ @elements = []
12
+ end
13
+
14
+ def <<(element)
15
+ @elements.push(element)
16
+ end
17
+
18
+ def to_html(context)
19
+ @elements.collect { |element|
20
+ if element.respond_to?(:to_html)
21
+ element.to_html(context).force_encoding("utf-8")
22
+ else
23
+ element.to_s
24
+ end
25
+ }.join(" ")
26
+ end
27
+ end
26
28
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,32 +22,34 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Select -- htmlgrid -- 10.03.2003 -- hwyss@ywesee.com
25
+ # Select -- htmlgrid -- 10.03.2003 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/namedcomponent'
27
+ require "htmlgrid/namedcomponent"
28
28
 
29
29
  module HtmlGrid
30
- class AbstractSelect < NamedComponent
31
- LABEL = true
32
- attr_accessor :selected, :valid_values
33
- def to_html(context)
34
- context.select(@attributes) {
35
- sel = selection(context)
36
- sel.is_a?(Array) ? sel.join : sel.to_s
37
- }
38
- end
39
- end
40
- class Select < AbstractSelect
41
- private
42
- def selection(context)
43
- @selected ||= (@model.send(@name).to_s if(@model.respond_to?(@name)))
44
- @valid_values ||= @session.valid_values(@name)
45
- @valid_values.collect { |value|
46
- val = value.to_s
47
- attributes = { "value" => val }
48
- attributes.store("selected", true) if(val == selected)
49
- context.option(attributes) { @lookandfeel.lookup(value) { val } }
50
- }
51
- end
52
- end
30
+ class AbstractSelect < NamedComponent
31
+ LABEL = true
32
+ attr_accessor :selected, :valid_values
33
+ def to_html(context)
34
+ context.select(@attributes) {
35
+ sel = selection(context)
36
+ sel.is_a?(Array) ? sel.join : sel.to_s
37
+ }
38
+ end
39
+ end
40
+
41
+ class Select < AbstractSelect
42
+ private
43
+
44
+ def selection(context)
45
+ @selected ||= (@model.send(@name).to_s if @model.respond_to?(@name))
46
+ @valid_values ||= @session.valid_values(@name)
47
+ @valid_values.collect { |value|
48
+ val = value.to_s
49
+ attributes = {"value" => val}
50
+ attributes.store("selected", true) if val == selected
51
+ context.option(attributes) { @lookandfeel.lookup(value) { val } }
52
+ }
53
+ end
54
+ end
53
55
  end
data/lib/htmlgrid/span.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -24,14 +24,14 @@
24
24
  #
25
25
  # Span -- oddb -- 12.08.2003 -- mhuggler@ywesee.com
26
26
 
27
- require 'htmlgrid/component'
27
+ require "htmlgrid/component"
28
28
 
29
29
  module HtmlGrid
30
- class Span < Component
31
- def to_html(context)
32
- context.span(@attributes) {
33
- super << dynamic_html(context)
34
- }
35
- end
36
- end
30
+ class Span < Component
31
+ def to_html(context)
32
+ context.span(@attributes) {
33
+ super << dynamic_html(context)
34
+ }
35
+ end
36
+ end
37
37
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,24 +22,24 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Template -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
25
+ # Template -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/composite'
27
+ require "htmlgrid/composite"
28
28
 
29
29
  module HtmlGrid
30
- class SpanComposite < TagComposite
31
- def to_html(context)
32
- res = ''
33
- @grid.each_with_index { |span, idx|
34
- res << context.span(tag_attributes(idx)) {
35
- if(span.respond_to?(:to_html))
36
- span.to_html(context).force_encoding('utf-8')
37
- else
38
- span
39
- end
40
- }
41
- }
42
- res
43
- end
44
- end
30
+ class SpanComposite < TagComposite
31
+ def to_html(context)
32
+ res = ""
33
+ @grid.each_with_index { |span, idx|
34
+ res << context.span(tag_attributes(idx)) {
35
+ if span.respond_to?(:to_html)
36
+ span.to_html(context).force_encoding("utf-8")
37
+ else
38
+ span
39
+ end
40
+ }
41
+ }
42
+ res
43
+ end
44
+ end
45
45
  end
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  # HtmlGrid::SpanList -- davaz.com -- 04.05.2006 -- mhuggler@ywesee.com
4
4
 
5
- require 'htmlgrid/spancomposite'
5
+ require "htmlgrid/spancomposite"
6
6
 
7
7
  module HtmlGrid
8
- class SpanList < HtmlGrid::SpanComposite
9
- def compose
10
- @model.each { |item|
11
- super(item)
12
- }
13
- end
14
- end
8
+ class SpanList < HtmlGrid::SpanComposite
9
+ def compose
10
+ @model.each { |item|
11
+ super(item)
12
+ }
13
+ end
14
+ end
15
15
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,19 +22,20 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # StaticInput -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
25
+ # StaticInput -- htmlgrid -- 26.11.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/input'
27
+ require "htmlgrid/input"
28
28
 
29
29
  module HtmlGrid
30
- class StaticInput < NamedComponent
31
- LABEL = false
32
- def init
33
- super
34
- @attributes['value'] = @lookandfeel.lookup(@name)
35
- end
36
- def to_html(context)
37
- context.input(@attributes)
38
- end
39
- end
30
+ class StaticInput < NamedComponent
31
+ LABEL = false
32
+ def init
33
+ super
34
+ @attributes["value"] = @lookandfeel.lookup(@name)
35
+ end
36
+
37
+ def to_html(context)
38
+ context.input(@attributes)
39
+ end
40
+ end
40
41
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
2
+
3
3
  #
4
4
  # HtmlGrid -- HyperTextMarkupLanguage Framework
5
5
  # Copyright (C) 2003 ywesee - intellectual capital connected
@@ -22,15 +22,15 @@
22
22
  # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zuerich, Switzerland
23
23
  # htmlgrid@ywesee.com, www.ywesee.com/htmlgrid
24
24
  #
25
- # Submit -- htmlgrid -- 25.11.2002 -- hwyss@ywesee.com
25
+ # Submit -- htmlgrid -- 25.11.2002 -- hwyss@ywesee.com
26
26
 
27
- require 'htmlgrid/staticinput'
27
+ require "htmlgrid/staticinput"
28
28
 
29
29
  module HtmlGrid
30
- class Submit < StaticInput
31
- def init
32
- super
33
- @attributes['type'] = 'submit'
34
- end
35
- end
30
+ class Submit < StaticInput
31
+ def init
32
+ super
33
+ @attributes["type"] = "submit"
34
+ end
35
+ end
36
36
  end