htmlgrid 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/htmlgrid/composite.rb +6 -1
- data/lib/htmlgrid/dojotoolkit.rb +90 -87
- data/lib/htmlgrid/grid.rb +1 -1
- metadata +6 -6
data/History.txt
CHANGED
data/lib/htmlgrid/composite.rb
CHANGED
@@ -22,6 +22,7 @@
|
|
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 -- 03.04.2012 -- yasaka@ywesee.com
|
25
26
|
# Template -- htmlgrid -- 23.02.2012 -- mhatakeyama@ywesee.com
|
26
27
|
# Template -- htmlgrid -- 23.10.2002 -- hwyss@ywesee.com
|
27
28
|
|
@@ -261,7 +262,11 @@ module HtmlGrid
|
|
261
262
|
end
|
262
263
|
def to_html(context)
|
263
264
|
@grid.set_attributes(@attributes)
|
264
|
-
|
265
|
+
if RUBY_VERSION > "1.9"
|
266
|
+
super << @grid.to_html(context).force_encoding('utf-8')
|
267
|
+
else
|
268
|
+
super << @grid.to_html(context)
|
269
|
+
end
|
265
270
|
end
|
266
271
|
private
|
267
272
|
def back(model=@model, session=@session)
|
data/lib/htmlgrid/dojotoolkit.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# HtmlGrid::DojoToolkit -- davaz.com -- 06.04.2012 -- yasaka@ywesee.com
|
3
4
|
# HtmlGrid::DojoToolkit -- davaz.com -- 14.03.2006 -- mhuggler@ywesee.com
|
4
5
|
|
5
6
|
require 'htmlgrid/component'
|
@@ -9,9 +10,8 @@ module HtmlGrid
|
|
9
10
|
class Component
|
10
11
|
@@msie_ptrn = /MSIE\s*(\d)/
|
11
12
|
attr_accessor :dojo_tooltip
|
12
|
-
|
13
|
-
|
14
|
-
end
|
13
|
+
# FIXME
|
14
|
+
# DOJO_VERSION >= 1.7.0 only (removed old version support)
|
15
15
|
def dojo_tag(widget, args={}, inner_html='')
|
16
16
|
# <dojo:#{widget} ...> does not work on konqueror as of
|
17
17
|
# 02.06.2006. In combination with DOJO_DEBUG = true it even
|
@@ -29,7 +29,7 @@ module HtmlGrid
|
|
29
29
|
=end
|
30
30
|
div = HtmlGrid::Div.new(@model, @session, self)
|
31
31
|
div.set_attribute('dojoType', widget)
|
32
|
-
lim =
|
32
|
+
lim = ","
|
33
33
|
args.each { |key, value|
|
34
34
|
if(value.is_a?(Array))
|
35
35
|
value = value.join(lim)
|
@@ -38,7 +38,7 @@ module HtmlGrid
|
|
38
38
|
}
|
39
39
|
div.value = inner_html
|
40
40
|
div
|
41
|
-
|
41
|
+
end
|
42
42
|
def dojo_title=(value)
|
43
43
|
tooltip = HtmlGrid::Div.new(@model, @session, self)
|
44
44
|
tooltip.value = value
|
@@ -49,38 +49,38 @@ module HtmlGrid
|
|
49
49
|
@container.dojo_parse_widgets
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
unless(method_defined?(:dojo_dynamic_html))
|
53
|
+
alias :dojo_dynamic_html :dynamic_html
|
54
|
+
def dynamic_html(context)
|
55
|
+
html = ''
|
56
56
|
attrs = {
|
57
|
-
'
|
58
|
-
'connectId'
|
59
|
-
'id'
|
60
|
-
'style'
|
57
|
+
'data-dojo-type' => 'ywesee.widget.Tooltip',
|
58
|
+
'connectId' => css_id,
|
59
|
+
'id' => "#{css_id}_widget",
|
60
|
+
'style' => 'display: none',
|
61
61
|
}
|
62
62
|
unless((match = @@msie_ptrn.match(@session.user_agent)) \
|
63
63
|
&& match[1].to_i < 7)
|
64
64
|
attrs.update({
|
65
|
-
|
66
|
-
|
65
|
+
'toggle' => 'fade',
|
66
|
+
'toggleDuration' => '500',
|
67
67
|
})
|
68
68
|
end
|
69
|
-
|
70
|
-
attrs.store('href',
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
69
|
+
if(@dojo_tooltip.is_a?(String))
|
70
|
+
attrs.store('href', "'#@dojo_tooltip'")
|
71
|
+
html << context.div(attrs)
|
72
|
+
elsif(@dojo_tooltip.respond_to?(:to_html))
|
73
|
+
@dojo_tooltip.attributes.update(attrs)
|
74
|
+
html << @dojo_tooltip.to_html(context)
|
75
|
+
end
|
76
|
+
unless(html.empty? || dojo_parse_widgets)
|
77
|
+
html << context.script('type' => 'text/javascript') {
|
78
|
+
"djConfig.searchIds.push('#{css_id}')"
|
79
|
+
}
|
80
|
+
end
|
81
|
+
dojo_dynamic_html(context) << html
|
82
|
+
end
|
83
|
+
end
|
84
84
|
end
|
85
85
|
module DojoToolkit
|
86
86
|
module DojoTemplate
|
@@ -90,8 +90,8 @@ module HtmlGrid
|
|
90
90
|
DOJO_PARSE_WIDGETS = true
|
91
91
|
DOJO_PREFIX = []
|
92
92
|
DOJO_REQUIRE = []
|
93
|
-
|
94
|
-
|
93
|
+
def dynamic_html_headers(context)
|
94
|
+
headers = super
|
95
95
|
encoding = self.class::DOJO_ENCODING
|
96
96
|
encoding ||= if RUBY_VERSION >= '1.9'
|
97
97
|
Encoding.default_external
|
@@ -99,69 +99,72 @@ module HtmlGrid
|
|
99
99
|
$KCODE == 'UTF8' ? 'UTF-8' : 'ISO-8859-1'
|
100
100
|
end
|
101
101
|
dojo_path = @lookandfeel.resource_global(:dojo_js)
|
102
|
-
|
103
|
-
|
104
|
-
}
|
102
|
+
dojo_path ||= '/resources/dojo/dojo/dojo.js'
|
103
|
+
args = { 'type' => 'text/javascript'}
|
105
104
|
headers << context.script(args.dup) {
|
106
105
|
"djConfig = {
|
107
|
-
isDebug:
|
108
|
-
parseWidgets:
|
106
|
+
isDebug: #{self.class::DOJO_DEBUG},
|
107
|
+
parseWidgets: #{dojo_parse_widgets},
|
109
108
|
preventBackButtonFix: #{!self.class::DOJO_BACK_BUTTON},
|
110
|
-
bindEncoding:
|
111
|
-
searchIds:
|
112
|
-
urchin:
|
109
|
+
bindEncoding: '#{encoding}',
|
110
|
+
searchIds: [],
|
111
|
+
urchin: ''
|
113
112
|
};"
|
114
113
|
}
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
"bindEncoding:'#{encoding}'",
|
121
|
-
"searchIds:[]",
|
122
|
-
"urchin:''" ].join(',')
|
123
|
-
args.store('djConfig', config)
|
124
|
-
else
|
125
|
-
dojo_path ||= '/resources/dojo/dojo.js'
|
114
|
+
packages = ""
|
115
|
+
unless(self.class::DOJO_PREFIX.empty?)
|
116
|
+
packages = self.class::DOJO_PREFIX.collect { |prefix, path|
|
117
|
+
"{ name: '#{prefix}', location: '#{path}' }"
|
118
|
+
}.join(",")
|
126
119
|
end
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
script << "dojo.addOnLoad(function() { #{onload} });"
|
151
|
-
}
|
152
|
-
end
|
153
|
-
script
|
154
|
-
}
|
155
|
-
if(dojo_9?)
|
156
|
-
dojo_dir = File.dirname(dojo_path)
|
157
|
-
headers << context.style(:type => "text/css") { <<-EOS
|
158
|
-
@import "#{File.join(dojo_dir, "/resources/dojo.css")}";
|
159
|
-
@import "#{File.join(dojo_dir, "../dijit/themes/tundra/tundra.css")}";
|
160
|
-
EOS
|
120
|
+
config = [
|
121
|
+
"parseOnLoad: true",
|
122
|
+
"isDebug: #{self.class::DOJO_DEBUG}",
|
123
|
+
"preventBackButtonFix: #{!self.class::DOJO_BACK_BUTTON}",
|
124
|
+
"bindEncoding: '#{encoding}'",
|
125
|
+
"searchIds: []",
|
126
|
+
"async: true",
|
127
|
+
"urchin: ''",
|
128
|
+
"has: {
|
129
|
+
'dojo-firebug': #{self.class::DOJO_DEBUG},
|
130
|
+
'dojo-debug-messages': #{self.class::DOJO_DEBUG}
|
131
|
+
}",
|
132
|
+
"packages: [ #{packages} ]"
|
133
|
+
].join(',')
|
134
|
+
args.store('data-dojo-config', config)
|
135
|
+
args.store('src', dojo_path)
|
136
|
+
|
137
|
+
headers << context.script(args)
|
138
|
+
args = { 'type' => 'text/javascript' }
|
139
|
+
headers << context.script(args) {
|
140
|
+
script = ''
|
141
|
+
self.class::DOJO_REQUIRE.each { |req|
|
142
|
+
script << "'#{req}',"
|
161
143
|
}
|
162
|
-
|
144
|
+
if(@dojo_onloads)
|
145
|
+
onloads = ''
|
146
|
+
@dojo_onloads.each { |onload|
|
147
|
+
onloads << "#{onload}\n"
|
148
|
+
}
|
149
|
+
script =
|
150
|
+
"require([#{script.chomp(',')}], function(ready, parser) {" \
|
151
|
+
"ready(function() {" \
|
152
|
+
"#{onloads}" \
|
153
|
+
"});" \
|
154
|
+
"});"
|
155
|
+
else
|
156
|
+
script = "require([#{script.chomp(',')}]);"
|
157
|
+
end
|
158
|
+
script
|
159
|
+
}
|
160
|
+
dojo_dir = File.dirname(dojo_path)
|
161
|
+
headers << context.style(:type => "text/css") { <<-EOS
|
162
|
+
@import "#{File.join(dojo_dir, "/resources/dojo.css")}";
|
163
|
+
@import "#{File.join(dojo_dir, "../dijit/themes/tundra/tundra.css")}";
|
164
|
+
EOS
|
165
|
+
}
|
163
166
|
headers
|
164
|
-
|
167
|
+
end
|
165
168
|
def dojo_parse_widgets
|
166
169
|
self.class::DOJO_PARSE_WIDGETS
|
167
170
|
end
|
data/lib/htmlgrid/grid.rb
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
# HtmlGrid::Grid -- htmlgrid -- 23.02.2012 -- mhatakeyama@ywesee.com
|
26
26
|
# HtmlGrid::Grid -- htmlgrid -- 12.01.2010 -- hwyss@ywesee.com
|
27
27
|
begin
|
28
|
-
VERSION = '1.0.
|
28
|
+
VERSION = '1.0.6'
|
29
29
|
begin
|
30
30
|
# for gem install
|
31
31
|
ext_dir = File.expand_path('../../ext/htmlgrid', File.dirname(__FILE__))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: htmlgrid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
16
|
-
requirement: &
|
16
|
+
requirement: &12802620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12802620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: hoe
|
27
|
-
requirement: &
|
27
|
+
requirement: &12802200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '2.13'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12802200
|
36
36
|
description: HtmlGrid is a Html-ToolKit for Ruby Webframeworks.
|
37
37
|
email:
|
38
38
|
- mhatakeyama@ywesee.com, zdavatz@ywesee.com
|