glimmer-dsl-opal 0.14.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -5
- data/VERSION +1 -1
- data/app/controllers/glimmer/application_controller.rb +4 -0
- data/app/controllers/glimmer/image_paths_controller.rb +41 -0
- data/app/views/glimmer/image_paths/index.html.erb +1 -0
- data/config/routes.rb +24 -0
- data/lib/glimmer-dsl-opal.rb +6 -2
- data/lib/glimmer-dsl-opal/ext/file.rb +31 -0
- data/lib/glimmer-dsl-opal/samples/hello/hello_table.rb +28 -20
- data/lib/glimmer-dsl-opal/samples/hello/hello_table/baseball_park.png +0 -0
- data/lib/glimmer/engine.rb +21 -0
- data/lib/glimmer/swt/composite_proxy.rb +34 -0
- data/lib/glimmer/swt/shell_proxy.rb +43 -0
- data/lib/glimmer/swt/table_item_proxy.rb +3 -0
- data/lib/net/http.rb +2 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724c0f462ad5dd94ef3eb8705f6ceb54b350c0f83976a6a7bb3f0506afe67f65
|
4
|
+
data.tar.gz: 0ba2076cb72f46bbe855c746e80c3747d0d2834f73167266fb42752d873e6290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52727efe6e7efc09cffe80991ccddf6fb4ee69835ecb46f21321ab912997980f6dd9ba9fc68117ce5864f61d63809037139d64b741ff509f66dfda09a2ab0a1
|
7
|
+
data.tar.gz: e00c6998ab192d91340f27567c29b2b6ee63a65680ec316d0a3c74353c0905a04ed2f3771423b527c7441ee6d2dd8870d7c758a09e8151dd0223a4e6053f8a7a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.15.1
|
4
|
+
|
5
|
+
- Auto-expose images of gems that depend on glimmer-dsl-opal as downloadable asset links providing `/glimmer/image_paths` server call to obtain them
|
6
|
+
- Update Hello, Table! to work with image background
|
7
|
+
|
3
8
|
## 0.14.0
|
4
9
|
|
5
10
|
- Initial Net::HTTP support for get and post_form
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Opal 0.15.1 (Pure Ruby Web GUI)
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-opal.svg)](http://badge.fury.io/rb/glimmer-dsl-opal)
|
3
3
|
[![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
@@ -141,7 +141,7 @@ Hello, Table! Game Booked
|
|
141
141
|
|
142
142
|
NOTE: Glimmer DSL for Opal is an alpha project. Please help make better by contributing, adopting for small or low risk projects, and providing feedback. It is still an early alpha, so the more feedback and issues you report the better.
|
143
143
|
|
144
|
-
**Alpha Version** 0.
|
144
|
+
**Alpha Version** 0.15.1 only supports bare-minimum capabilities for the included [samples](https://github.com/AndyObtiva/glimmer-dsl-opal#samples) (originally written for [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt))
|
145
145
|
|
146
146
|
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
147
147
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
@@ -151,7 +151,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
|
|
151
151
|
|
152
152
|
## Table of Contents
|
153
153
|
|
154
|
-
- [Glimmer DSL for Opal 0.
|
154
|
+
- [Glimmer DSL for Opal 0.15.1 (Pure Ruby Web GUI)](#-glimmer-dsl-for-opal-0151-pure-ruby-web-gui)
|
155
155
|
- [Principles](#principles)
|
156
156
|
- [Background](#background)
|
157
157
|
- [Pre-requisites](#pre-requisites)
|
@@ -252,7 +252,7 @@ Add the following to `Gemfile`:
|
|
252
252
|
gem 'opal-rails', '~> 1.1.2'
|
253
253
|
gem 'opal-async', '~> 1.2.0'
|
254
254
|
gem 'opal-jquery', '~> 0.4.4'
|
255
|
-
gem 'glimmer-dsl-opal', '~> 0.
|
255
|
+
gem 'glimmer-dsl-opal', '~> 0.15.1'
|
256
256
|
gem 'glimmer-dsl-xml', '~> 1.2.0', require: false
|
257
257
|
gem 'glimmer-dsl-css', '~> 1.2.0', require: false
|
258
258
|
|
@@ -2234,6 +2234,8 @@ Glimmer DSL for Opal Contact Manager Edit Done
|
|
2234
2234
|
|
2235
2235
|
#### Weather
|
2236
2236
|
|
2237
|
+
Code: [lib/glimmer-dsl-opal/samples/elaborate/weather](lib/glimmer-dsl-opal/samples/elaborate/weather.rb)
|
2238
|
+
|
2237
2239
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
2238
2240
|
|
2239
2241
|
```ruby
|
@@ -2246,7 +2248,7 @@ Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObt
|
|
2246
2248
|
|
2247
2249
|
![Weather Montreal F](https://github.com/AMaleh/glimmer-dsl-swt/raw/master/images/glimmer-weather-montreal-fahrenheit.png)
|
2248
2250
|
|
2249
|
-
![Weather Atlanta F](https://github.com/AMaleh
|
2251
|
+
![Weather Atlanta F](https://github.com/AMaleh/glimmer-dsl-swt/raw/master/images/glimmer-weather-atlanta-fahrenheit.png)
|
2250
2252
|
|
2251
2253
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
2252
2254
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.15.1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Glimmer
|
4
|
+
class ImagePathsController < ApplicationController
|
5
|
+
def index
|
6
|
+
Gem.loaded_specs.map(&:last).select {|s| s.name == 'glimmer-dsl-opal' || s.dependencies.detect {|dep| dep.name == 'glimmer-dsl-opal'} }
|
7
|
+
full_gem_specs = Gem.loaded_specs.map(&:last).select {|s| s.name == 'glimmer-dsl-opal' || s.dependencies.detect {|dep| dep.name == 'glimmer-dsl-swt'} }
|
8
|
+
full_gem_paths = full_gem_specs.map {|gem_spec| gem_spec.full_gem_path}
|
9
|
+
full_gem_names = full_gem_paths.map {|path| File.basename(path)}
|
10
|
+
full_gem_image_path_collections = full_gem_paths.map do |gem_path|
|
11
|
+
Dir[File.join(gem_path, '**', '*')].to_a.select {|f| !!f.match(/(png|jpg|jpeg|gif)$/) }
|
12
|
+
end
|
13
|
+
download_gem_image_path_collections = full_gem_names.size.times.map do |n|
|
14
|
+
full_gem_name = full_gem_names[n]
|
15
|
+
full_gem_image_paths = full_gem_image_path_collections[n]
|
16
|
+
full_gem_image_paths.map do |image_path|
|
17
|
+
File.join(full_gem_name, image_path.split(full_gem_name).last)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
download_gem_image_paths = download_gem_image_path_collections.flatten
|
21
|
+
download_gem_image_dir_names = download_gem_image_paths.map {|p| File.dirname(p)}.uniq
|
22
|
+
download_gem_image_dir_names.each do |image_dir_name|
|
23
|
+
FileUtils.mkdir_p(Rails.root.join('app', 'assets', 'images', image_dir_name))
|
24
|
+
end
|
25
|
+
full_gem_names.size.times.each do |n|
|
26
|
+
full_image_paths = full_gem_image_path_collections[n]
|
27
|
+
download_image_paths = download_gem_image_path_collections[n]
|
28
|
+
full_image_paths.each_with_index do |image_path, i|
|
29
|
+
download_image_path = download_image_paths[i]
|
30
|
+
image_dir_name = File.dirname(image_path)
|
31
|
+
FileUtils.cp_r(image_path, Rails.root.join('app', 'assets', 'images', download_image_path)) # TODO check first if files match and avoid copying if so to save time
|
32
|
+
end
|
33
|
+
end
|
34
|
+
download_gem_image_paths = download_gem_image_paths.map {|p| "/assets/#{p}"}
|
35
|
+
|
36
|
+
# TODO apply a security white list
|
37
|
+
render json: download_gem_image_paths
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
NADA
|
data/config/routes.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
Glimmer::Engine.routes.draw do
|
23
|
+
resources :image_paths, only: [:index]
|
24
|
+
end
|
data/lib/glimmer-dsl-opal.rb
CHANGED
@@ -37,6 +37,10 @@ if RUBY_ENGINE == 'opal'
|
|
37
37
|
def include_package(package)
|
38
38
|
# No Op (just a shim)
|
39
39
|
end
|
40
|
+
|
41
|
+
def __dir__
|
42
|
+
'(dir)'
|
43
|
+
end
|
40
44
|
end
|
41
45
|
|
42
46
|
require 'opal-parser'
|
@@ -81,10 +85,11 @@ if RUBY_ENGINE == 'opal'
|
|
81
85
|
require 'glimmer/config/opal_logger'
|
82
86
|
require 'glimmer-dsl-xml'
|
83
87
|
require 'glimmer-dsl-css'
|
88
|
+
|
84
89
|
Element.alias_native :replace_with, :replaceWith
|
85
90
|
Element.alias_native :select
|
86
91
|
Element.alias_native :dialog
|
87
|
-
|
92
|
+
|
88
93
|
Glimmer::Config.loop_max_count = 250 # TODO disable
|
89
94
|
|
90
95
|
original_logger_level = Glimmer::Config.logger.level
|
@@ -96,7 +101,6 @@ if RUBY_ENGINE == 'opal'
|
|
96
101
|
result ||= method == '<<'
|
97
102
|
result ||= method == 'handle'
|
98
103
|
end
|
99
|
-
|
100
104
|
else
|
101
105
|
require_relative 'glimmer/engine'
|
102
106
|
end
|
@@ -19,11 +19,42 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
require 'net/http'
|
23
|
+
|
22
24
|
class File
|
23
25
|
class << self
|
26
|
+
REGEXP_DIR_FILE = /\(dir\)|\(file\)/
|
27
|
+
|
28
|
+
attr_accessor :image_paths
|
29
|
+
|
24
30
|
def read(*args, &block)
|
25
31
|
# TODO implement via asset downloads in the future
|
26
32
|
# No Op in Opal
|
27
33
|
end
|
34
|
+
|
35
|
+
# Include special processing for images that matches them against a list of available image paths from the server
|
36
|
+
# to convert to web paths.
|
37
|
+
alias expand_path_without_glimmer expand_path
|
38
|
+
def expand_path(path, base=nil)
|
39
|
+
get_image_paths unless image_paths
|
40
|
+
if base
|
41
|
+
path = expand_path_without_glimmer(path, base)
|
42
|
+
end
|
43
|
+
path_include_dir_or_file = !!path.match(REGEXP_DIR_FILE)
|
44
|
+
if !path_include_dir_or_file
|
45
|
+
path
|
46
|
+
else
|
47
|
+
essential_path = path.split('(dir)').last.split('(file)').last
|
48
|
+
image_paths.detect do |image_path|
|
49
|
+
image_path.include?(essential_path)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_image_paths
|
55
|
+
image_paths_json = Net::HTTP.get(`window.location.origin`, '/glimmer/image_paths.json')
|
56
|
+
self.image_paths = JSON.parse(image_paths_json)
|
57
|
+
end
|
58
|
+
|
28
59
|
end
|
29
60
|
end
|
@@ -179,25 +179,33 @@ class HelloTable
|
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
|
-
include Glimmer
|
183
|
-
|
184
|
-
|
182
|
+
include Glimmer::UI::CustomShell
|
183
|
+
|
184
|
+
before_body {
|
185
|
+
Display.app_name = 'Hello, Table!'
|
186
|
+
}
|
187
|
+
|
188
|
+
body {
|
185
189
|
shell {
|
186
190
|
grid_layout
|
187
191
|
|
188
192
|
text 'Hello, Table!'
|
193
|
+
background_image File.expand_path('hello_table/baseball_park.png', __dir__)
|
194
|
+
image File.expand_path('hello_table/baseball_park.png', __dir__)
|
189
195
|
|
190
196
|
label {
|
191
197
|
layout_data :center, :center, true, false
|
192
198
|
|
193
|
-
text '
|
194
|
-
|
199
|
+
text 'BASEBALL PLAYOFF SCHEDULE'
|
200
|
+
background :transparent if OS.windows?
|
201
|
+
foreground rgb(94, 107, 103)
|
202
|
+
font name: 'Optima', height: 38, style: :bold
|
195
203
|
}
|
196
204
|
|
197
205
|
combo(:read_only) {
|
198
206
|
layout_data :center, :center, true, false
|
199
207
|
selection <=> [BaseballGame, :playoff_type]
|
200
|
-
font height:
|
208
|
+
font height: 14
|
201
209
|
}
|
202
210
|
|
203
211
|
table(:editable) { |table_proxy|
|
@@ -248,29 +256,29 @@ class HelloTable
|
|
248
256
|
# Sort by these additional properties after handling sort by the column the user clicked
|
249
257
|
additional_sort_properties :date, :time, :home_team, :away_team, :ballpark, :promotion
|
250
258
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
259
|
+
menu {
|
260
|
+
menu_item {
|
261
|
+
text 'Book'
|
262
|
+
|
263
|
+
on_widget_selected {
|
264
|
+
book_selected_game
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
260
268
|
}
|
261
269
|
|
262
270
|
button {
|
263
271
|
text 'Book Selected Game'
|
264
272
|
layout_data :center, :center, true, false
|
265
|
-
font height:
|
266
|
-
enabled
|
273
|
+
font height: 14
|
274
|
+
enabled <= [BaseballGame, :selected_game]
|
267
275
|
|
268
276
|
on_widget_selected {
|
269
277
|
book_selected_game
|
270
278
|
}
|
271
279
|
}
|
272
|
-
}
|
273
|
-
|
280
|
+
}
|
281
|
+
}
|
274
282
|
|
275
283
|
def book_selected_game
|
276
284
|
message_box {
|
@@ -280,4 +288,4 @@ class HelloTable
|
|
280
288
|
end
|
281
289
|
end
|
282
290
|
|
283
|
-
HelloTable.
|
291
|
+
HelloTable.launch
|
Binary file
|
data/lib/glimmer/engine.rb
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
module Glimmer
|
2
23
|
class Engine < ::Rails::Engine
|
3
24
|
isolate_namespace Glimmer
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer/swt/grid_layout_proxy'
|
2
23
|
require 'glimmer/swt/widget_proxy'
|
3
24
|
|
@@ -41,6 +62,19 @@ module Glimmer
|
|
41
62
|
# TODO implement layout(changed = nil, all = nil) just as per SWT API
|
42
63
|
@layout&.layout(self, changed)
|
43
64
|
end
|
65
|
+
|
66
|
+
# background image
|
67
|
+
def background_image
|
68
|
+
@background_image
|
69
|
+
end
|
70
|
+
|
71
|
+
# background image is stretched by default
|
72
|
+
def background_image=(value)
|
73
|
+
@background_image = value
|
74
|
+
dom_element.css('background-image', "url(#{background_image})")
|
75
|
+
dom_element.css('background-repeat', 'no-repeat')
|
76
|
+
dom_element.css('background-size', 'cover')
|
77
|
+
end
|
44
78
|
|
45
79
|
end
|
46
80
|
|
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2020-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
1
22
|
require 'glimmer/swt/widget_proxy'
|
2
23
|
require 'glimmer/swt/layout_proxy'
|
3
24
|
require 'glimmer/swt/display_proxy'
|
@@ -71,6 +92,28 @@ module Glimmer
|
|
71
92
|
Document.title = value
|
72
93
|
end
|
73
94
|
|
95
|
+
# favicon
|
96
|
+
def image
|
97
|
+
@image
|
98
|
+
end
|
99
|
+
|
100
|
+
def image=(value)
|
101
|
+
@image = value
|
102
|
+
# TODO consider moving this code to favicon_dom_element
|
103
|
+
if favicon_dom_element.empty?
|
104
|
+
favicon_element = Element.new(:link)
|
105
|
+
favicon_element.attr('rel', 'icon')
|
106
|
+
Document.find('head').append(favicon_element)
|
107
|
+
else
|
108
|
+
favicon_element = favicon_dom_element
|
109
|
+
end
|
110
|
+
favicon_element.attr('href', image)
|
111
|
+
end
|
112
|
+
|
113
|
+
def favicon_dom_element
|
114
|
+
Document.find('link[rel=icon]')
|
115
|
+
end
|
116
|
+
|
74
117
|
def minimum_size=(width_or_minimum_size, height = nil)
|
75
118
|
@minimum_size = height.nil? ? width_or_minimum_size : Point.new(width_or_minimum_size, height)
|
76
119
|
return if @minimum_size.nil?
|
data/lib/net/http.rb
CHANGED
@@ -37,7 +37,8 @@ module Net
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def get(uri, path_and_params)
|
40
|
-
uri =
|
40
|
+
uri = File.join(uri, path_and_params)
|
41
|
+
uri = "#{`window.location.protocol`}//#{uri}" unless uri.start_with?('http:') || uri.start_with?('https:') # TODO refactor repetitive code
|
41
42
|
result = nil
|
42
43
|
::HTTP.get(uri, {async: false, dataType: 'text'}) do |response|
|
43
44
|
result = response.body if response.ok?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -263,6 +263,10 @@ files:
|
|
263
263
|
- app/assets/stylesheets/glimmer/jquery-ui.structure.css
|
264
264
|
- app/assets/stylesheets/glimmer/jquery-ui.theme.css
|
265
265
|
- app/assets/stylesheets/glimmer/jquery.ui.timepicker.css
|
266
|
+
- app/controllers/glimmer/application_controller.rb
|
267
|
+
- app/controllers/glimmer/image_paths_controller.rb
|
268
|
+
- app/views/glimmer/image_paths/index.html.erb
|
269
|
+
- config/routes.rb
|
266
270
|
- lib/display.rb
|
267
271
|
- lib/glimmer-dsl-opal.rb
|
268
272
|
- lib/glimmer-dsl-opal/ext/class.rb
|
@@ -299,6 +303,7 @@ files:
|
|
299
303
|
- lib/glimmer-dsl-opal/samples/hello/hello_radio_group.rb
|
300
304
|
- lib/glimmer-dsl-opal/samples/hello/hello_tab.rb
|
301
305
|
- lib/glimmer-dsl-opal/samples/hello/hello_table.rb
|
306
|
+
- lib/glimmer-dsl-opal/samples/hello/hello_table/baseball_park.png
|
302
307
|
- lib/glimmer-dsl-opal/samples/hello/hello_world.rb
|
303
308
|
- lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/GPL-LICENSE.txt
|
304
309
|
- lib/glimmer-dsl-opal/vendor/jquery-ui-timepicker/MIT-LICENSE.txt
|