htmlgrid 1.1.0 → 1.1.1

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
  SHA1:
3
- metadata.gz: 5ff89d7ef9b327cfe5f71794afc0e08acabe92ae
4
- data.tar.gz: 6669995c93c30107c4b20b207950fa3f7229ec0d
3
+ metadata.gz: c5d30addff4506799b90228f01a9c910f6231967
4
+ data.tar.gz: d96e8a7d27da7aab4acaf1458a334bbf89c76af2
5
5
  SHA512:
6
- metadata.gz: 3a659474980dc94623435c3ede8307cf0249888ccb644187de53a29333936823780a4c3ae8a44a425d9bc15dc8b47865ca633a47ec1d31628ec7e7bffb44f6de
7
- data.tar.gz: fd7d0cd908342a8fc1c48ee087f985dad3bd33ef5ca86cbcc43bde20b6213baff3290cdbdf2db86fe872a32c00f832bb0ee31540474863fc6d031640f47342b2
6
+ metadata.gz: 7be2249769ff2f267ff89af97188e897c89e87d79403e71cb24658f315cf09d25211f756db822aec048da2ecf6fdc166c74a82b1c734b570b0cae68bec642754
7
+ data.tar.gz: b6995921b53ae767df96a8fabdd97e3d7de0396e1a5a3626e88e7ed7d5259c9c84cd97de5e1f54ec26c00b3e7898499fa17f242cf31fb60fef9d9f7e98f86a8a
@@ -1,3 +1,7 @@
1
+ === 1.1.1 / 07.07.2016
2
+
3
+ * Improve dojotoolkit.rb
4
+
1
5
  === 1.1.0 / 06.07.2016
2
6
 
3
7
  * Rename djConfig to dojoConfig
@@ -7,10 +7,9 @@ require 'htmlgrid/component'
7
7
  require 'htmlgrid/div'
8
8
 
9
9
  module HtmlGrid
10
- class Component
10
+ class Component
11
11
  @@msie_ptrn = /MSIE\s*(\d)/
12
- attr_accessor :dojo_tooltip
13
- # FIXME
12
+ attr_accessor :dojo_tooltip
14
13
  # DOJO_VERSION >= 1.7.0 only (removed old version support)
15
14
  def dojo_tag(widget, args={}, inner_html='')
16
15
  div = HtmlGrid::Div.new(@model, @session, self)
@@ -29,50 +28,58 @@ module HtmlGrid
29
28
  tooltip.value = value
30
29
  self.dojo_tooltip = tooltip
31
30
  end
32
- def dojo_parse_widgets
33
- if(@container.respond_to?(:dojo_parse_widgets))
34
- @container.dojo_parse_widgets
35
- end
36
- end
37
- unless(method_defined?(:dojo_dynamic_html))
31
+ def dojo_parse_on_load
32
+ if @container.respond_to?(:dojo_parse_on_load)
33
+ @container.dojo_parse_on_load
34
+ end
35
+ end
36
+ unless method_defined?(:dojo_dynamic_html)
38
37
  alias :dojo_dynamic_html :dynamic_html
39
38
  def dynamic_html(context)
40
39
  html = ''
41
40
  attrs = {
42
- 'data-dojo-type' => 'dijit/Tooltip',
43
- 'data-dojo-props' => "connectId:'#{css_id}'",
44
- 'id' => "#{css_id}_widget",
45
- 'style' => 'display: none',
41
+ # NOTE:
42
+ # DOJO >= 1.8 has support for type name separated by '/'
43
+ # but, <= 1.7 must be separated with '.'
44
+ 'data-dojo-type' => 'dijit.Tooltip',
45
+ 'data-dojo-props' => "connectId:'#{css_id}'",
46
+ 'id' => "#{css_id}_widget",
47
+ 'style' => 'display: none',
46
48
  }
47
- unless((match = @@msie_ptrn.match(@session.user_agent)) \
48
- && match[1].to_i < 7)
49
+ unless match = @@msie_ptrn.match(@session.user_agent) \
50
+ && match[1].to_i < 7
49
51
  attrs.update({
50
52
  'toggle' => 'fade',
51
53
  'toggleDuration' => '500',
52
54
  })
53
55
  end
54
- if(@dojo_tooltip.is_a?(String))
55
- attrs.store('href', "'#@dojo_tooltip'")
56
+ if @dojo_tooltip.is_a?(String)
57
+ if @dojo_tooltip !~ /^http/ # e.g. javascript
58
+ attrs.store('href', "'#@dojo_tooltip'")
59
+ else
60
+ attrs.store('href', @dojo_tooltip)
61
+ end
56
62
  html << context.div(attrs)
57
- elsif(@dojo_tooltip.respond_to?(:to_html))
63
+ elsif @dojo_tooltip.respond_to?(:to_html)
58
64
  @dojo_tooltip.attributes.update(attrs)
59
65
  html << @dojo_tooltip.to_html(context).force_encoding('utf-8')
60
66
  end
61
- unless(html.empty? || dojo_parse_widgets)
67
+ unless html.empty? || dojo_parse_on_load
62
68
  html << context.script('type' => 'text/javascript') {
63
69
  "dojoConfig.searchIds.push('#{css_id}')"
64
70
  }
65
71
  end
72
+ # call original dynamic_html
66
73
  dojo_dynamic_html(context) << html
67
74
  end
68
75
  end
69
- end
76
+ end
70
77
  module DojoToolkit
71
78
  module DojoTemplate
72
79
  DOJO_DEBUG = false
73
80
  DOJO_BACK_BUTTON = false
74
81
  DOJO_ENCODING = nil
75
- DOJO_PARSE_WIDGETS = true
82
+ DOJO_PARSE_ON_LOAD = true
76
83
  DOJO_PREFIX = []
77
84
  DOJO_REQUIRE = []
78
85
  def dynamic_html_headers(context)
@@ -89,7 +96,7 @@ module HtmlGrid
89
96
  }.join(",")
90
97
  end
91
98
  config = [
92
- "parseOnLoad: true",
99
+ "parseOnLoad: #{self.class::DOJO_PARSE_ON_LOAD}",
93
100
  "isDebug: #{self.class::DOJO_DEBUG}",
94
101
  "preventBackButtonFix: #{!self.class::DOJO_BACK_BUTTON}",
95
102
  "bindEncoding: '#{encoding}'",
@@ -131,15 +138,15 @@ module HtmlGrid
131
138
  }
132
139
  dojo_dir = File.dirname(dojo_path)
133
140
  headers << context.style(:type => "text/css") { <<-EOS
134
- @import "#{File.join(dojo_dir, "/resources/dojo.css")}";
135
- @import "#{File.join(dojo_dir, "../dijit/themes/tundra/tundra.css")}";
136
- EOS
141
+ @import "#{File.join(dojo_dir, "/resources/dojo.css")}";
142
+ @import "#{File.join(dojo_dir, "../dijit/themes/tundra/tundra.css")}";
143
+ EOS
137
144
  }
138
145
  headers
139
146
  end
140
- def dojo_parse_widgets
141
- self.class::DOJO_PARSE_WIDGETS
142
- end
147
+ def dojo_parse_on_load
148
+ self.class::DOJO_PARSE_ON_LOAD
149
+ end
143
150
  def onload=(script)
144
151
  (@dojo_onloads ||= []).push(script)
145
152
  end
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  module HtmlGrid
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  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.1.0
4
+ version: 1.1.1
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: 2016-07-06 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sbsm