glimmer-dsl-opal 0.0.8 → 0.0.9

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
  SHA256:
3
- metadata.gz: 6a67315f8276add7f19a24f488c635567a39fe798e7e21e49ce23de2aeb6c0d2
4
- data.tar.gz: e667498792a2522e9271a04ccd2051396c778e528dd77fbb593c6369eee971e2
3
+ metadata.gz: b56026edb0b7ab096e2b972afcc99f2914db153e52fa52616859b44e86d0ad8c
4
+ data.tar.gz: aa94ad9ded4e7cac3ec706db46a012861e9c1e3a0d0026cdcc7833f43733eba0
5
5
  SHA512:
6
- metadata.gz: 02db0846e7e3b430387e693aa4981c2f01636a01b5ed5ba32646cbdac15991604ccbd5efa4d8e8b837027c69861c28b8d1917f5bef792121de9be8b86584e064
7
- data.tar.gz: 5d07f4b44c97c81bcf554b18d423e0007efe14bf8cdaa8529f0c295581518654a94989dcc1a0e921e8626a7ca3ca243f572a4d163f3e4bd450fe81684303dae2
6
+ metadata.gz: 66e958ca4e486e0a33908fb21d72322c375da35774a86e0514898a50b214bff0ecd7e7f4f5ce930983394cf49d9386ddce45f9ddcc0eb5e0074c455e8ebb87c9
7
+ data.tar.gz: 9e57c5f9a2bb433f182e7f7ce392f19985796cd56f8f40bed01bfed2e7385a25b4bf3fb7b06c541dae0b77cda2a981ac71d2a094d21f0beede0f8867b3fd1333
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.9
4
+
5
+ - Upgraded to glimmer gem v0.9.3
6
+ - Fixed issue with missing Glimmer::Opal::ElementProxy#id=(value) method breaking Contact Manager sample Find feature
7
+
3
8
  ## 0.0.8
4
9
 
5
10
  - Contact Manager sample support
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
- # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=65 /> Glimmer DSL for Opal 0.0.8 (Webify Desktop Apps)
1
+ # <img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=65 /> Glimmer DSL for Opal 0.0.9 (Webify Desktop Apps)
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
 
5
- Glimmer DSL for Opal is a web GUI adaptor for webifying [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps (i.e. apps built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)).
5
+ Glimmer DSL for Opal is an experimental web GUI adaptor for [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps (i.e. apps built with [Glimmer](https://github.com/AndyObtiva/glimmer) [DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)). It webifies them via [Rails](https://rubyonrails.org/) and [Opal](https://opalrb.com/), allowing Ruby desktop apps to run on the web without changing a line of code. Apps may then be custom-styled for the web via standard CSS.
6
6
 
7
- It enables running [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps on the web via [Rails](https://rubyonrails.org/) and [Opal](https://opalrb.com/) without changing a line of code. Apps may then be custom-styled for the web via standard CSS.
8
-
9
- NOTE: Alpha Version 0.0.8 only supports bare-minimum capabilities for the following [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) [samples](https://github.com/AndyObtiva/glimmer#samples):
7
+ NOTE: Alpha Version 0.0.9 only supports bare-minimum capabilities for the following [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) [samples](https://github.com/AndyObtiva/glimmer#samples):
10
8
  - [Hello, World!](#hello-world)
11
9
  - [Hello, Combo!](#hello-combo)
12
10
  - [Hello, Computed!](#hello-computed)
@@ -70,7 +68,7 @@ Add the following to `Gemfile`:
70
68
  gem 'opal-rails', '~> 1.1.2'
71
69
  gem 'opal-async', '~> 1.1.0'
72
70
  gem 'opal-browser', '~> 0.2.0'
73
- gem 'glimmer-dsl-opal', '~> 0.0.8', require: false
71
+ gem 'glimmer-dsl-opal', '~> 0.0.9', require: false
74
72
  ```
75
73
 
76
74
  Follow (opal-rails)[https://github.com/opal/opal-rails] instructions, basically the configuration of: config/initializers/assets.rb
@@ -94,7 +92,13 @@ Add more code to `app/assets/javascripts/application.rb` from one of the samples
94
92
 
95
93
  #### Hello, World!
96
94
 
97
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
95
+ Add the following require statement to `app/assets/javascripts/application.rb`
96
+
97
+ ```ruby
98
+ require 'samples/hello/hello_world'
99
+ ```
100
+
101
+ Or add the Glimmer code directly if you prefer to play around with it:
98
102
 
99
103
  ```ruby
100
104
  include Glimmer
@@ -126,7 +130,13 @@ You should see "Hello, World!"
126
130
 
127
131
  #### Hello, Combo!
128
132
 
129
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
133
+ Add the following require statement to `app/assets/javascripts/application.rb`
134
+
135
+ ```ruby
136
+ require 'samples/hello/hello_combo'
137
+ ```
138
+
139
+ Or add the Glimmer code directly if you prefer to play around with it:
130
140
 
131
141
  ```ruby
132
142
  class Person
@@ -183,7 +193,14 @@ You should see "Hello, Combo!"
183
193
 
184
194
  #### Hello, Computed!
185
195
 
186
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
196
+ Add the following require statement to `app/assets/javascripts/application.rb`
197
+
198
+
199
+ ```ruby
200
+ require 'samples/hello/hello_computed'
201
+ ```
202
+
203
+ Or add the Glimmer code directly if you prefer to play around with it:
187
204
 
188
205
  ```ruby
189
206
  class HelloComputed
@@ -295,7 +312,14 @@ You should see "Hello, Computed!"
295
312
 
296
313
  #### Hello, List Single Selection!
297
314
 
298
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
315
+ Add the following require statement to `app/assets/javascripts/application.rb`
316
+
317
+
318
+ ```ruby
319
+ require 'samples/hello/hello_list_single_selection'
320
+ ```
321
+
322
+ Or add the Glimmer code directly if you prefer to play around with it:
299
323
 
300
324
  ```ruby
301
325
  class Person
@@ -352,7 +376,13 @@ You should see "Hello, List Single Selection!"
352
376
 
353
377
  #### Hello, List Multi Selection!
354
378
 
355
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
379
+ Add the following require statement to `app/assets/javascripts/application.rb`
380
+
381
+ ```ruby
382
+ require 'samples/hello/hello_list_multi_selection'
383
+ ```
384
+
385
+ Or add the Glimmer code directly if you prefer to play around with it:
356
386
 
357
387
  ```ruby
358
388
  class Person
@@ -419,7 +449,13 @@ You should see "Hello, List Multi Selection!"
419
449
 
420
450
  #### Hello, Browser!
421
451
 
422
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
452
+ Add the following require statement to `app/assets/javascripts/application.rb`
453
+
454
+ ```ruby
455
+ require 'samples/hello/hello_browser'
456
+ ```
457
+
458
+ Or add the Glimmer code directly if you prefer to play around with it:
423
459
 
424
460
  ```ruby
425
461
  include Glimmer
@@ -450,7 +486,13 @@ You should see "Hello, Browser!"
450
486
 
451
487
  #### Hello, Tab!
452
488
 
453
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
489
+ Add the following require statement to `app/assets/javascripts/application.rb`
490
+
491
+ ```ruby
492
+ require 'samples/hello/hello_tab'
493
+ ```
494
+
495
+ Or add the Glimmer code directly if you prefer to play around with it:
454
496
 
455
497
  ```ruby
456
498
  class HelloTab
@@ -501,7 +543,13 @@ You should see "Hello, Tab!"
501
543
 
502
544
  #### Login
503
545
 
504
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
546
+ Add the following require statement to `app/assets/javascripts/application.rb`
547
+
548
+ ```ruby
549
+ require 'samples/elaborate/login'
550
+ ```
551
+
552
+ Or add the Glimmer code directly if you prefer to play around with it:
505
553
 
506
554
  ```ruby
507
555
  require "observer"
@@ -615,7 +663,13 @@ You should see "Login" dialog
615
663
 
616
664
  #### Tic Tac Toe
617
665
 
618
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
666
+ Add the following require statement to `app/assets/javascripts/application.rb`
667
+
668
+ ```ruby
669
+ require 'samples/elaborate/tic_tac_toe'
670
+ ```
671
+
672
+ Or add the Glimmer code directly if you prefer to play around with it:
619
673
 
620
674
  ```ruby
621
675
  class TicTacToe
@@ -844,7 +898,13 @@ You should see "Tic Tac Toe"
844
898
 
845
899
  #### Contact Manager
846
900
 
847
- Add the following Glimmer code to `app/assets/javascripts/application.rb`
901
+ Add the following require statement to `app/assets/javascripts/application.rb`
902
+
903
+ ```ruby
904
+ require 'samples/elaborate/contact_manager'
905
+ ```
906
+
907
+ Or add the Glimmer code directly if you prefer to play around with it:
848
908
 
849
909
  ```ruby
850
910
  class ContactManager
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -43,6 +43,8 @@ module Glimmer
43
43
  @last_model_collection = model_collection
44
44
  # TODO improve performance
45
45
  selected_table_item_models = parent.selection.map(&:get_data)
46
+ old_items = parent.items
47
+ old_item_ids_per_model = old_items.reduce({}) {|hash, item| hash.merge(item.get_data.hash => item.id) }
46
48
  parent.remove_all
47
49
  model_collection.each do |model|
48
50
  table_item = Glimmer::Opal::TableItem.new(parent)
@@ -50,6 +52,7 @@ module Glimmer
50
52
  table_item.set_text(index, model.send(column_properties[index]).to_s)
51
53
  end
52
54
  table_item.set_data(model)
55
+ table_item.id = old_item_ids_per_model[model.hash] if old_item_ids_per_model[model.hash]
53
56
  end
54
57
  selected_table_items = parent.search {|item| selected_table_item_models.include?(item.get_data) }
55
58
  selected_table_items = [parent.items.first] if selected_table_items.empty? && !parent.items.empty?
@@ -7,6 +7,20 @@ module Glimmer
7
7
  include PropertyOwner
8
8
  attr_reader :parent, :args, :css_classes, :css, :children, :enabled
9
9
 
10
+ class << self
11
+ def next_id_number_for(name)
12
+ @max_id_numbers[name] = max_id_number_for(name) + 1
13
+ end
14
+
15
+ def max_id_number_for(name)
16
+ @max_id_numbers[name] = max_id_numbers[name] || 0
17
+ end
18
+
19
+ def max_id_numbers
20
+ @max_id_numbers ||= {}
21
+ end
22
+ end
23
+
10
24
  def initialize(parent, args)
11
25
  @parent = parent
12
26
  @args = args
@@ -51,10 +65,14 @@ module Glimmer
51
65
  end
52
66
 
53
67
  def id
54
- # TODO replace hash with autoincrement per name
55
- "#{name}-#{hash}"
68
+ @id ||= "#{name}-#{ElementProxy.next_id_number_for(name)}"
56
69
  end
57
-
70
+
71
+ # Sets id explicitly. Useful in cases of wanting to maintain a stable id
72
+ def id=(value)
73
+ @id = value
74
+ end
75
+
58
76
  # Subclasses can override with their own selector
59
77
  def selector
60
78
  "#{name}##{id}"
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.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.2
19
+ version: 0.9.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.2
26
+ version: 0.9.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-mocks
29
29
  requirement: !ruby/object:Gem::Requirement