tao_form 0.1.6 → 0.1.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: a18d71951470969052ba69f555372147c3cfda5e
4
- data.tar.gz: 4aaa0ee030e0dff122ae174f827e253153e0446e
3
+ metadata.gz: 83d90b3525b49b6b8255b3b63f226c9ac99d0c90
4
+ data.tar.gz: 64d8b5cceb9d36961cb5f65f4583c356ae91da2f
5
5
  SHA512:
6
- metadata.gz: 84a379df38b149e8529540d19ffdf1c1d39a345510b7ac45bd29c433e9cee3972a7180669448afff7e05039ed4ab3b95dc5f70cbac5c8731d4d8e103d39e6179
7
- data.tar.gz: 0407113bca1f6cd55c74288b4bc8e35bd2f20e0dc8fd464675832129f9638d21236006e1d286c5885d50dffcb02355e711ff9db0f7363aa65c88ba79b257bf86
6
+ metadata.gz: 06e00b140ebb057161661b08d740e4c15331a8f9fc6bfc67ad05856225dfb72744895c0a9ae9a8936248e6e8e19f61ad858f2b36665a39eb72d0176115b8dd5e
7
+ data.tar.gz: c710aae81181adbf7062ba89a85adff27c4559bfcdb74bb135f85515910f2a2cc7ca857c8a3f7eb848f2189b4f8053bc4672cd4afd0b2283f8c5a3b6bef16817
@@ -19,6 +19,9 @@ class Tao.Form.DatetimePicker extends TaoComponent
19
19
  @timePicker = @findComponent 'tao-time-picker'
20
20
  @_bind()
21
21
 
22
+ _disconnected: ->
23
+ @off()
24
+
22
25
  _bind: ->
23
26
  @on 'tao:change', '.moment-picker', (e, m) =>
24
27
  @_syncMoment()
@@ -11,6 +11,9 @@ class Tao.Form.MomentPicker.SegmentListBase extends TaoComponent
11
11
 
12
12
  @_bind()
13
13
 
14
+ _disconnected: ->
15
+ @off()
16
+
14
17
  _bind: ->
15
18
  @on 'click', '.segment-label', (e) =>
16
19
  segment = $(e.currentTarget).data('segment')
@@ -11,6 +11,9 @@ class Tao.Form.MomentPicker.SegmentBase extends TaoComponent
11
11
  @momentData = {}
12
12
  @_bind()
13
13
 
14
+ _disconnected: ->
15
+ @off()
16
+
14
17
  _bind: ->
15
18
 
16
19
  setMomentData: (momentData) ->
@@ -10,10 +10,13 @@ class MomentPicker.DateSegment extends MomentPicker.SegmentBase
10
10
 
11
11
  dateFormat: 'YYYY-MM-DD'
12
12
 
13
+ _init: ->
14
+ super
15
+ @_renderWeekdays()
16
+
13
17
  _connected: ->
14
18
  super
15
19
  @momentData = {}
16
- @_renderWeekdays()
17
20
 
18
21
  _bind: ->
19
22
  @on 'click', '.day', (e) =>
@@ -86,7 +89,7 @@ class MomentPicker.DateSegment extends MomentPicker.SegmentBase
86
89
  startDate.add 1, 'days'
87
90
 
88
91
  _renderWeekdays: ->
89
- $head = @jq.find('.weekdays')
92
+ $head = @jq.find('.weekdays').empty()
90
93
  $.each moment.weekdaysMin(true), (i, weekdayName) ->
91
94
  $('<span>', class: 'weekday', text: weekdayName)
92
95
  .appendTo $head
@@ -1,6 +1,6 @@
1
1
  @import './globals';
2
2
 
3
- tao-form {
3
+ .tao-form {
4
4
  display: block;
5
5
  margin: 2em 0 0 0;
6
6
 
@@ -1,6 +1,6 @@
1
1
  @import './globals';
2
2
 
3
- tao-form {
3
+ .tao-form {
4
4
  display: block;
5
5
 
6
6
  form {
@@ -7,11 +7,15 @@ module TaoForm
7
7
  def initialize view, record, options
8
8
  super view, options
9
9
  @record = record
10
- @html_options = transform_html_options(@options.delete(:html) || {})
10
+ @html_options = transform_html_options(@options.delete(:html) || {}, default_html_options)
11
11
  end
12
12
 
13
13
  def render &block
14
- view.content_tag tag_name, view.simple_form_for(record, options, &block), html_options
14
+ if block_given?
15
+ view.content_tag tag_name, view.simple_form_for(record, options, &block), html_options
16
+ else
17
+ super
18
+ end
15
19
  end
16
20
 
17
21
  def self.component_name
@@ -27,6 +31,10 @@ module TaoForm
27
31
  }
28
32
  end
29
33
 
34
+ def default_html_options
35
+ {class: 'tao-form'}
36
+ end
37
+
30
38
  end
31
39
  end
32
40
  end
@@ -1,3 +1,3 @@
1
1
  module TaoForm
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tao_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - your name
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tao_on_rails