thin_man 0.11.11 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/thin_man.js +10 -0
- data/lib/thin_man/ajax_helper.rb +7 -3
- data/lib/thin_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba47d38fc3fa0d524b3302c6db4bf88142650343
|
4
|
+
data.tar.gz: c812b60ada3e2e2fa587446024ed8dacaecaa88b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c74f246b1a4a1111e415891d02eabbe91cfa76f94c87e1d439b54e59bf651ebcb52876e807c957a7e42ac1b4771806389a8291deb71ec10c969e87caf391dac3
|
7
|
+
data.tar.gz: c98cf1bb2fda8efa60b2a745b13477516f95a4a7241d00ac0982370e1df9397b1f7774d0372bea805a23cbf313fb2d9998919fc8c5260bc8a29e5ff7d21b2ce2
|
@@ -354,6 +354,16 @@ var initThinMan = function(){
|
|
354
354
|
return new FormData(this.jq_obj[0]);
|
355
355
|
}
|
356
356
|
},
|
357
|
+
ajaxSuccess: function(data,textStatus,jqXHR){
|
358
|
+
this._super(data,textStatus,jqXHR)
|
359
|
+
if(this.resetOnSuccess()){
|
360
|
+
this.jq_obj[0].reset();
|
361
|
+
$(this.jq_obj).find('input[type=text],textarea,select').filter(':visible:first').focus();
|
362
|
+
}
|
363
|
+
},
|
364
|
+
resetOnSuccess: function(){
|
365
|
+
return this.jq_obj.data('reset-on-success')
|
366
|
+
},
|
357
367
|
getProcessData: function() {
|
358
368
|
if(this.getAjaxType().toLowerCase() == 'get'){
|
359
369
|
return true;
|
data/lib/thin_man/ajax_helper.rb
CHANGED
@@ -28,7 +28,7 @@ module ThinMan
|
|
28
28
|
html_options.merge(ajax_options))
|
29
29
|
end
|
30
30
|
|
31
|
-
def ajax_delete(name, options, html_options, target, sub_class: nil, replace_response: false, no_confirm: false)
|
31
|
+
def ajax_delete(name, options, html_options, target, sub_class: nil, replace_response: false, no_confirm: false, custom_progress: nil)
|
32
32
|
ajax_options = {
|
33
33
|
'data-ajax-delete' => true,
|
34
34
|
'data-ajax-target' => target
|
@@ -36,12 +36,13 @@ module ThinMan
|
|
36
36
|
ajax_options.merge!('data-sub-type' => sub_class) if sub_class.present?
|
37
37
|
ajax_options.merge!('data-replace-response' => true) if replace_response
|
38
38
|
ajax_options.merge!('data-no-confirm' => true) if no_confirm
|
39
|
+
ajax_options.merge!('data-custom-progress' => custom_progress) if custom_progress.present?
|
39
40
|
link_to(name,
|
40
41
|
options,
|
41
42
|
html_options.merge(ajax_options))
|
42
43
|
end
|
43
44
|
|
44
|
-
def ajax_form_hash(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, container: nil)
|
45
|
+
def ajax_form_hash(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, reset_on_success: nil, container: nil, custom_progress: nil)
|
45
46
|
ajax_options = {
|
46
47
|
'data-ajax-form' => true,
|
47
48
|
'data-ajax-target' => target
|
@@ -51,14 +52,17 @@ module ThinMan
|
|
51
52
|
ajax_options.merge!('data-container' => container) if container.present?
|
52
53
|
ajax_options.merge!('data-error-target' => error_target) if error_target.present?
|
53
54
|
ajax_options.merge!('data-empty-on-success' => empty_on_success) if empty_on_success.present?
|
55
|
+
ajax_options.merge!('data-reset-on-success' => reset_on_success) if reset_on_success.present?
|
56
|
+
ajax_options.merge!('data-custom-progress' => custom_progress) if custom_progress.present?
|
54
57
|
ajax_options
|
55
58
|
end
|
56
59
|
|
57
|
-
def ajax_form_attrs(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil)
|
60
|
+
def ajax_form_attrs(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil, reset_on_success: nil)
|
58
61
|
data_attrs = "data-ajax-form=true data-ajax-target=#{target}"
|
59
62
|
data_attrs += " data-insert-method=#{insert_method}" if insert_method
|
60
63
|
data_attrs += " data-sub-type=#{sub_class}" if sub_class
|
61
64
|
data_attrs += " data-empty-on-success=#{empty_on_success}" if empty_on_success
|
65
|
+
data_attrs += " data-reset-on-success=#{reset_on_success}" if reset_on_success
|
62
66
|
data_attrs += " data-error-target=#{error_target}" if error_target
|
63
67
|
data_attrs
|
64
68
|
end
|
data/lib/thin_man/version.rb
CHANGED
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.
|
4
|
+
version: 0.12.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-11-
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|