thin_man 0.3.0 → 0.4.0

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: 238921f2707b795300e3d1bc15ac620e4745ea31
4
- data.tar.gz: 9751296904c99b41841b8803decf3500dfaa7a8b
3
+ metadata.gz: 6d59918aacb9231e5137e3381c7d75005463ca32
4
+ data.tar.gz: 00e5a610ba4939e0d39e038445bfe14f6522b332
5
5
  SHA512:
6
- metadata.gz: 32a5f3215e3ccb6602c85765d0a3ebd334e2592c1e709458fdb88152495792195adc2b40c012badfae60695aadf8f9f3ca0c9f9fb52e6fe803d7121ab1a9b9ff
7
- data.tar.gz: 18773c6115e53078ab7239d364e9e04f2cb83b32e8b3a2a2c9b2864572ea03540fd7c17c1badf05017622196dfb29751336f6c6422da9644844e57c4d17abacb
6
+ metadata.gz: 731f872d5217d28f8ad3494720aae2576590030cf0c156ab366ace4a41c56795bad64091ae9bbcba5e061e38e993da30a5988d1c8c0428c4eeba93d69362a537
7
+ data.tar.gz: d39ef7ff7d292a2ef58fe875b9878f7b10fac4c0514126e50e15ebf61a8be6f2a27f9b70d8d8bbb3dc9e436be6e2590341a5e60ce20aa89cc144501b338d18ca
@@ -1,12 +1,13 @@
1
1
  module ThinMan
2
2
  module AjaxHelper
3
- def ajax_link(name, options, html_options, target, sub_class: nil, insert_method: nil)
3
+ def ajax_link(name, options, html_options, target, sub_class: nil, insert_method: nil, empty_on_success: nil)
4
4
  ajax_options = {
5
5
  'data-ajax-link' => true,
6
6
  'data-ajax-target' => target
7
7
  }
8
8
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
9
9
  ajax_options.merge!('data-insert-method' => insert_method) if insert_method.present?
10
+ ajax_options.merge!('data-empty-on-success' => empty_on_success) if empty_on_success.present?
10
11
  link_to(name,
11
12
  options,
12
13
  html_options.merge(ajax_options))
@@ -23,20 +24,23 @@ module ThinMan
23
24
  html_options.merge(ajax_options))
24
25
  end
25
26
 
26
- def ajax_form_hash(target, sub_class: nil, insert_method: 'html')
27
+ def ajax_form_hash(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil)
27
28
  ajax_options = {
28
29
  'data-ajax-form' => true,
29
- 'data-ajax-target' => target,
30
- 'data-insert-method' => insert_method
30
+ 'data-ajax-target' => target
31
31
  }
32
+ ajax_options.merge!('data-insert-method' => insert_method) if insert_method.present?
32
33
  ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
34
+ ajax_options.merge!('data-error-target' => error_target) if error_target.present?
35
+ ajax_options.merge!('data-empty-on-success' => empty_on_success) if empty_on_success.present?
33
36
  ajax_options
34
37
  end
35
38
 
36
- def ajax_link_attrs(target, insert_method: nil, sub_type: nil)
39
+ def ajax_link_attrs(target, insert_method: nil, sub_type: nil, empty_on_success: nil)
37
40
  data_attrs = "data-ajax-link=true data-ajax-target=#{target}"
38
41
  data_attrs += " data-insert-method=#{insert_method}" if insert_method
39
- data_attrs += " data-insert-method=#{sub_type}" if sub_type
42
+ data_attrs += " data-sub-type=#{sub_type}" if sub_type
43
+ data_attrs += " data-empty-on-success=#{empty_on_success}" if empty_on_success
40
44
  data_attrs
41
45
  end
42
46
 
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut, Adam Bialek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-25 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails