shul 0.4.6 → 0.4.7

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: a0da5571ebfd3c61844b3d07fbe11042acd52bbc
4
- data.tar.gz: 8042fc5b1139b9632c687740fab48b6773caee8f
3
+ metadata.gz: 67349df56c834799f3417d3eec3549d63cbf7b5c
4
+ data.tar.gz: ceb297f840b5358759e8a167fe04ef73104580f0
5
5
  SHA512:
6
- metadata.gz: e8e2ab21d8b2dd5759b8a9547cbfeee1cd3b14d0a48b61ba96f874ddf68aa4c30c5550996ce53a652bc1295a306d0fb28b8661be39783f30079e0438c4c283f5
7
- data.tar.gz: b4c8714a6275240fc47e3a73763c73459166267853ad2b6a685c7e7618a71c9c1af86414c8ec4f4e8b50e7bacddcf1901589da46c8ed510819b5a9827e5c20a1
6
+ metadata.gz: 5ae48b1b570d875955d912de7d7a54bca72dfc3684353ea44d3bbc34f6592aa04e3e42943711b47b882f819f91f10fe280b97af7b1a4008d2d7455b41a8c29ca
7
+ data.tar.gz: b0255670d5015bc56719e4e0bef96b4360008bc948c4ae68c013aa1c41b97793cc8b157ec1bc6f1c6bcc7fd65635016ce292ce1555182a6fa8055c4824d8fc0a
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -41,6 +41,8 @@ Shul::Main.new Shoes, doc
41
41
 
42
42
  # modifications
43
43
  #
44
+ # 10-Aug-2017: feature: A Textbox element can now be created dynamically
45
+ # e.g. txt = e.create_element('textbox'); e.append_child txt
44
46
  # 09-Aug-2017: feature: onkeypress() now implemented.
45
47
  # Listboxes can now be rendered. Radiogroup events now functional
46
48
  # Textbox implementation is now functional.
@@ -65,16 +67,19 @@ Shul::Main.new Shoes, doc
65
67
  # * tested using the green_shoes gem.
66
68
 
67
69
 
68
-
69
70
  require 'domle'
70
71
 
71
72
 
72
-
73
73
  module RexleObject
74
74
  refine Rexle::Element do
75
+
76
+ @obj = nil
77
+ @obj_children = []
75
78
 
76
79
  def obj() @obj end
77
- def obj=(obj) @obj = obj end
80
+ def obj=(obj) @obj = obj end
81
+ def obj_children() @obj_children end
82
+ def obj_children=(obj) @obj_children = obj end
78
83
 
79
84
  end
80
85
  end
@@ -96,9 +101,16 @@ module Shul
96
101
 
97
102
 
98
103
  class Shule < Domle
104
+
105
+ attr_accessor :callback
99
106
 
100
107
  class Box < Element
101
108
  attr2_accessor *%i(background-color margin padding)
109
+
110
+ def append_child(obj)
111
+ self.add obj
112
+ @rexle.callback.add_element(self, obj)
113
+ end
102
114
 
103
115
  end
104
116
 
@@ -106,7 +118,6 @@ module Shul
106
118
  attr2_accessor *%i(width height)
107
119
 
108
120
  end
109
-
110
121
 
111
122
  class App < Component
112
123
 
@@ -142,10 +153,25 @@ module Shul
142
153
 
143
154
  end
144
155
 
145
- class Textbox < Component
156
+ class Textbox < Component
146
157
 
158
+ attr2_accessor *%i(id value size)
159
+
160
+ def initialize(name='textbox', attributes: nil, rexle: nil)
161
+ super(name, attributes: {value: '', size: '40'}, rexle: rexle)
162
+ end
147
163
  end
148
164
 
165
+
166
+ def create_element(type)
167
+
168
+ h = {
169
+ textbox: Shul::Shule::Textbox.new
170
+ }
171
+
172
+ h[type.to_sym]
173
+ end
174
+
149
175
  def inspect()
150
176
  "#<Shule:%s>" % [self.object_id]
151
177
  end
@@ -274,6 +300,8 @@ module Shul
274
300
  end
275
301
  end
276
302
 
303
+ doc.callback = shul
304
+
277
305
  end
278
306
 
279
307
  def reload()
@@ -315,7 +343,7 @@ module Shul
315
343
 
316
344
  @doc.root.elements.each do |x|
317
345
  method(x.name.sub(':','_').to_sym).call(x) unless x.name == 'script'
318
- end
346
+ end
319
347
 
320
348
  @doc.root.xpath('script').each {|x| script x }
321
349
 
@@ -328,6 +356,17 @@ module Shul
328
356
  end
329
357
 
330
358
  end
359
+
360
+ def add_element(node, x)
361
+
362
+ node.obj = method(x.name.sub(':','_').to_sym).call(x)
363
+ refresh()
364
+
365
+ end
366
+
367
+ def refresh
368
+ @shoes.flush
369
+ end
331
370
 
332
371
  private
333
372
 
@@ -519,10 +558,20 @@ module Shul
519
558
 
520
559
  def e.value=(v)
521
560
  self.attributes[:value] = v
522
- self.obj.replace v
561
+ self.obj.replace v
523
562
  end
524
563
 
525
564
  end
565
+
566
+ def render_elements()
567
+
568
+ #@shoes.clear
569
+ @doc.root.elements.each do |x|
570
+ method(x.name.sub(':','_').to_sym).call(x) unless x.name == 'script'
571
+ end
572
+ end
573
+
574
+ alias reload render_elements
526
575
 
527
576
  def location=(source)
528
577
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  t8eGazfn6KO3ECwm0DI6ZG6K+/TPPHv8HXfONWq0oGmvwamHXWjcz3hCa5hZw0Vt
32
32
  +vU993j3UFViMQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-08-08 00:00:00.000000000 Z
34
+ date: 2017-08-09 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: domle
metadata.gz.sig CHANGED
Binary file