vdom-rb 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 175eed1045ac11f8cf7f8d233172412e44252a7a
4
- data.tar.gz: 097298a39a6fa4cbb6f73e231639af21c09f89ab
3
+ metadata.gz: ae060eafd4a737e9346b3c04d192e2e1b51922d1
4
+ data.tar.gz: 56029e3e1cf1afd1df129607289d8bc79c017029
5
5
  SHA512:
6
- metadata.gz: f14abe05447c686b6e95e0f24254348d6f12134484bf202208d36d70201b865ca1849ca2b6af6c212fbdda89cf771329c9b82b9a0858d580f71b64f7cd2082f1
7
- data.tar.gz: 52c1210dae305dd5a8e12ff67e305276405be2064c85c2047ea85b0f4c3897d857775736bee204135560cef8aa720c1c92111d90c1e9a45db1890898357b5850
6
+ metadata.gz: 8abe0441436d59e9f9b1e0087d8497d1f2dd53b64d162f83e8e2695c3ea983429aa5c7852abd5602e9d4a660280cac39958e8ddb2efbe605e47bee79e348515c
7
+ data.tar.gz: 7d8a70cb6668761bca7a335736ec3259ab5221d5782eb428d7ecee804b07763ee84b4cad3475ec174aa34cfb64e5dcc1b3d91ff84daf8865e178513d8c0aacdd
data/lib/vdom-rb.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  # __FILE__ MUST BE SAME NAME AS GEM
2
+ require 'opal'
3
+ require 'clearwater'
2
4
  module VDOM
3
5
  require_relative "vdom/version"
4
6
  end
data/lib/vdom/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module VDOM
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,4 +1,3 @@
1
- puts "#{__FILE__}[#{__LINE__}] requiring vdom stuff"
2
1
  require 'clearwater'
3
2
  require 'vdom/registry'
4
3
 
@@ -120,7 +120,10 @@ module VDOM
120
120
  end
121
121
  end
122
122
 
123
- def collapsible(callback, collapsed: false, content: nil)
123
+ def up_down(callback, up: true, down: false, content: nil, pull: 'left')
124
+ up = up && !down
125
+ pull = pull.to_s
126
+ left = pull == 'left'
124
127
  node(:div,
125
128
  attributes: {
126
129
  onclick: callback,
@@ -129,10 +132,12 @@ module VDOM
129
132
  content: [
130
133
  node(:span,
131
134
  attributes: {
132
- class: "glyphicon glyphicon-menu-#{collapsed ? 'down' : 'up'} pull-left",
135
+ class: "glyphicon glyphicon-menu-#{up ? 'up' : 'down'} pull-#{pull}",
133
136
  style: {
134
137
  font_size: 'smaller',
135
- margin_right: '0.5em',
138
+ margin_top: '0.2em',
139
+ margin_left: left ? '0.3em' : '0.5em',
140
+ margin_right: left ? '0.5em' : '0.3em',
136
141
  vertical_align: 'middle',
137
142
  color: 'inherit',
138
143
  background_color: 'inherit',
@@ -143,16 +148,20 @@ module VDOM
143
148
  )
144
149
  end
145
150
 
146
- def arrify(obj)
147
- if obj
148
- if Enumerable === obj
149
- obj.to_a
150
- else
151
- [obj]
151
+ def arrify(*args)
152
+ result = []
153
+ args.each do |arg|
154
+ if arg
155
+ if Enumerable === arg
156
+ arg.each do |e|
157
+ result << e
158
+ end
159
+ else
160
+ result << arg
161
+ end
152
162
  end
153
- else
154
- []
155
163
  end
164
+ result
156
165
  end
157
166
 
158
167
  # TODO: generalize from bootstrap
data/opal/vdom/table.rb CHANGED
@@ -40,7 +40,7 @@ module VDOM
40
40
  # debug __FILE__, __LINE__, __method__, "section=#{section} column=#{column.id} content=#{content}"
41
41
  end
42
42
  if _is_head && column.sort?
43
- content = Renderer.sortable(
43
+ content = sortable(
44
44
  column.sort_callback,
45
45
  direction: _table.sort_column_id == column.id ? _table.sort_order : 0,
46
46
  content: content
@@ -198,13 +198,14 @@ module VDOM
198
198
 
199
199
  def render
200
200
  @render_count += 1
201
- node(
201
+ Renderer.node(
202
202
  :table,
203
203
  attributes: { class: css, style: style },
204
- content: [caption_component] + section_components
204
+ content: (caption_content ? [caption_component] : []) +
205
+ section_components
205
206
  )
206
207
  end
207
-
208
+
208
209
  def caption_component
209
210
  TableCaption.new(caption_state)
210
211
  end
@@ -238,7 +239,6 @@ module VDOM
238
239
  end
239
240
 
240
241
  def section_attributes(section)
241
- # TODO:
242
242
  nil
243
243
  end
244
244
 
@@ -253,6 +253,7 @@ module VDOM
253
253
 
254
254
  # set or toggle the sort order to/of the given column
255
255
  def sort!(column_id)
256
+ # debug __FILE__, __LINE__, __method__, "column_id=#{column_id}"
256
257
  if @sort_column_id == column_id
257
258
  sort_orders[@sort_column_id] *= -1
258
259
  else
@@ -275,6 +276,7 @@ module VDOM
275
276
  end
276
277
 
277
278
  def invalidate
279
+ # debug __FILE__, __LINE__, __method__
278
280
  init_row_models
279
281
  init_sorting
280
282
  invalidate_caption
@@ -78,4 +78,3 @@ module VDOM
78
78
  end
79
79
  end
80
80
  end
81
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vdom-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Gunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-25 00:00:00.000000000 Z
11
+ date: 2016-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal