htmlgrid 1.1.6 → 1.1.7

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.
@@ -5,12 +5,12 @@
5
5
 
6
6
  require 'htmlgrid/component'
7
7
  require 'htmlgrid/div'
8
- require 'htmlgrid/template'
9
8
 
10
9
  module HtmlGrid
11
10
  class Component
12
11
  @@msie_ptrn = /MSIE\s*(\d)/
13
12
  attr_accessor :dojo_tooltip
13
+ # DOJO_VERSION >= 1.7.0 only (removed old version support)
14
14
  def dojo_tag(widget, args={}, inner_html='')
15
15
  div = HtmlGrid::Div.new(@model, @session, self)
16
16
  div.set_attribute('data-dojo-type', widget)
@@ -38,6 +38,9 @@ module HtmlGrid
38
38
  def dynamic_html(context)
39
39
  html = ''
40
40
  attrs = {
41
+ # NOTE:
42
+ # DOJO >= 1.8 has support for type name separated by '/'
43
+ # but, <= 1.7 must be separated with '.'
41
44
  'data-dojo-type' => 'dijit/TooltipDialog',
42
45
  'data-dojo-props' => "connectId:#{css_id}",
43
46
  'id' => "#{css_id}_widget",
@@ -63,7 +66,9 @@ module HtmlGrid
63
66
  html << @dojo_tooltip.to_html(context).force_encoding('utf-8')
64
67
  end
65
68
  unless html.empty? || dojo_parse_on_load
66
- html << context.script('type' => 'text/javascript') { "dojoConfig.searchIds.push('#{css_id}')" }
69
+ html << context.script('type' => 'text/javascript') {
70
+ "dojoConfig.searchIds.push('#{css_id}')"
71
+ }
67
72
  end
68
73
  # call original dynamic_html
69
74
  dojo_dynamic_html(context) << html
@@ -72,7 +77,7 @@ module HtmlGrid
72
77
  end
73
78
  module DojoToolkit
74
79
  module DojoTemplate
75
- DOJO_DEBUG = true
80
+ DOJO_DEBUG = false
76
81
  DOJO_BACK_BUTTON = false
77
82
  DOJO_ENCODING = nil
78
83
  DOJO_PARSE_ON_LOAD = true
@@ -91,30 +96,52 @@ module HtmlGrid
91
96
  "{ name: '#{prefix}', location: '#{path}' }"
92
97
  }.join(",")
93
98
  end
94
- puts "dynamic_html_headers with pkgs: #{packages}"
95
- config =config = [
99
+ config = [
100
+ "parseOnLoad: #{self.class::DOJO_PARSE_ON_LOAD}",
101
+ "isDebug: #{self.class::DOJO_DEBUG}",
102
+ "preventBackButtonFix: #{!self.class::DOJO_BACK_BUTTON}",
103
+ "bindEncoding: '#{encoding}'",
104
+ "searchIds: []",
105
+ "urchin: ''",
96
106
  "has: {
97
- 'dojo-debug-messages': true
107
+ 'dojo-firebug': #{self.class::DOJO_DEBUG},
108
+ 'dojo-debug-messages': #{self.class::DOJO_DEBUG}
98
109
  }",
110
+ "packages: [ #{packages} ]"
99
111
  ].join(',')
100
- headers << %(<script>
101
- var dojoConfig = {
102
- parseOnLoad: true,
103
- isDebug: true,
104
- async: true,
105
- urchin: '',
106
- };
107
- </script>)
112
+ args.store('data-dojo-config', config)
113
+ args.store('src', dojo_path)
108
114
  headers << context.script(args)
109
- { 'text/css' => File.join(File.dirname(dojo_path), "/resources/dojo.css"),
110
- 'text/javascript' => dojo_path,
111
- }.each do |type, path|
112
- if (content = get_inline(path))
113
- headers << context.style(:type =>type) { content }
115
+ args = { 'type' => 'text/javascript' }
116
+ headers << context.script(args) {
117
+ package_paths = self.class::DOJO_REQUIRE.map { |req|
118
+ "'#{req}'"
119
+ }.join(',')
120
+ package_names = self.class::DOJO_REQUIRE.map { |req|
121
+ req.split('/').last
122
+ }.join(',')
123
+ if @dojo_onloads
124
+ onloads = ''
125
+ @dojo_onloads.each { |onload|
126
+ onloads << "#{onload}\n"
127
+ }
128
+ script =
129
+ "require([#{package_paths}], function(#{package_names}) {" \
130
+ "ready(function() {" \
131
+ "#{onloads}" \
132
+ "});" \
133
+ "});"
114
134
  else
115
- headers << context.style(:type =>type, :src => path) { "@import \"#{path}\";" }
135
+ script = "require([#{package_paths}]);"
116
136
  end
117
- end
137
+ script
138
+ }
139
+ dojo_dir = File.dirname(dojo_path)
140
+ headers << context.style(:type => "text/css") { <<-EOS
141
+ @import "#{File.join(dojo_dir, "/resources/dojo.css")}";
142
+ @import "#{File.join(dojo_dir, "../dijit/themes/tundra/tundra.css")}";
143
+ EOS
144
+ }
118
145
  headers
119
146
  end
120
147
  def dojo_parse_on_load
@@ -22,9 +22,10 @@
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 -- 19.11.2002 -- hwyss@ywesee.com
25
+ # Template -- htmlgrid -- 19.11.2002 -- hwyss@ywesee.com
26
26
 
27
27
  require 'htmlgrid/composite'
28
+ require 'uri'
28
29
 
29
30
  module HtmlGrid
30
31
  module TemplateMethods
@@ -36,14 +37,9 @@ module HtmlGrid
36
37
  CSS_FILES = []
37
38
  JAVASCRIPTS = []
38
39
  @@local_doc_dir = File.join(Dir.pwd, 'doc')
39
- def get_inline(ressource)
40
+ def TemplateMethods.get_inline(ressource)
40
41
  local_file = File.join(@@local_doc_dir, URI(ressource).path)
41
- if File.exist?(local_file)
42
- # puts "Reading #{ressource} #{local_file} #{File.size(local_file)}"
43
- File.read(local_file)
44
- else
45
- nil
46
- end
42
+ File.exist?(local_file) ? File.read(local_file) : nil
47
43
  end
48
44
  def css_link(context, path=@lookandfeel.resource(:css))
49
45
  properties = {
@@ -52,7 +48,7 @@ module HtmlGrid
52
48
  "async" => "true",
53
49
  'href' => path,
54
50
  }
55
- if (content = get_inline(path))
51
+ if (content = TemplateMethods.get_inline(path))
56
52
  properties.delete('href')
57
53
  context.style(properties) { content }
58
54
  else
@@ -60,8 +56,8 @@ module HtmlGrid
60
56
  end
61
57
  end
62
58
  def css_links(context, path=@lookandfeel.resource(:css))
63
- links = self.class.const_get(:CSS_FILES).collect { |key|
64
- css_link(context, @lookandfeel.resource(key))
59
+ links = self.class.const_get(:CSS_FILES).collect { |key|
60
+ css_link(context, @lookandfeel.resource(key))
65
61
  }
66
62
  links.push(css_link(context, path)) if(path)
67
63
  links.join
@@ -101,7 +97,7 @@ module HtmlGrid
101
97
  "language" => "JavaScript",
102
98
  "type" => "text/javascript",
103
99
  "src" => @lookandfeel.resource_global(:javascript, "#{key}.js"),
104
- }
100
+ }
105
101
  context.script(properties)
106
102
  }
107
103
  jscripts.join
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
3
  module HtmlGrid
4
- VERSION = '1.1.6'
4
+ VERSION = '1.1.7'
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.6
4
+ version: 1.1.7
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: 2020-06-12 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sbsm
@@ -157,6 +157,8 @@ extensions: []
157
157
  extra_rdoc_files: []
158
158
  files:
159
159
  - Manifest.txt
160
+ - TooltipDialog.txt
161
+ - interaction_no_inline.txt
160
162
  - lib/htmlgrid/booleanvalue.rb
161
163
  - lib/htmlgrid/button.rb
162
164
  - lib/htmlgrid/centeredcomposite.rb