thin_man 0.20.6 → 0.20.7
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 +7 -0
- data/lib/thin_man/ajax_helper.rb +12 -6
- data/lib/thin_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f14546b73fd65c440fe329c8ad0a3965d31483661266439d7b33924f6ed3400
|
4
|
+
data.tar.gz: 3a86b97d1e6af62d6856d137921bff56effc66c2c25d77708466fadee4494f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b22b547ca991d78621809dc346adc04c062009bcc8946b2349869c4860dd13ff9c326854dc6b3050e3e09d52b7609ec3094345b24aaa148345b160b5f76b2e0
|
7
|
+
data.tar.gz: 56eb860f19ebfc88fa0318ef085a978b5f26394c8c0b08cdecb127bfbf341e6020f870d451ce538bc5c4e5e91f97781826cf638d4810745ca53837d011ad0b3a
|
@@ -191,6 +191,13 @@ var initThinMan = function() {
|
|
191
191
|
if ($('[data-thin-man-offset]').length > 0) {
|
192
192
|
extra_offset = $('[data-thin-man-offset]').outerHeight()
|
193
193
|
}
|
194
|
+
if(this.jq_obj.data('scroll-center')){
|
195
|
+
var window_height = window.innerHeight
|
196
|
+
var target_height = this.target.outerHeight()
|
197
|
+
if(window_height > target_height){
|
198
|
+
extra_offset = (window_height - target_height)/2
|
199
|
+
}
|
200
|
+
}
|
194
201
|
$('html, body').animate({
|
195
202
|
scrollTop: this.target.offset().top - extra_offset
|
196
203
|
}, 1000);
|
data/lib/thin_man/ajax_helper.rb
CHANGED
@@ -4,7 +4,7 @@ module ThinMan
|
|
4
4
|
sub_class: nil, insert_method: nil, empty_on_success: nil, remove_on_success: nil,
|
5
5
|
http_method: nil, no_mouse_click: nil, progress_target: nil,
|
6
6
|
mask_target: nil, mask_message: nil, replacement_path: nil, push_path: nil,
|
7
|
-
progress_color: nil, scroll_to: nil)
|
7
|
+
progress_color: nil, scroll_to: nil, scroll_center: nil)
|
8
8
|
ajax_options = {
|
9
9
|
'data-ajax-link' => true,
|
10
10
|
'data-ajax-target' => target
|
@@ -20,6 +20,7 @@ module ThinMan
|
|
20
20
|
ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
|
21
21
|
ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
|
22
22
|
ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
|
23
|
+
ajax_options.merge!('data-scroll-center' => true) if scroll_center.present?
|
23
24
|
ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
|
24
25
|
ajax_options.merge!('data-push-path' => push_path) if push_path.present?
|
25
26
|
link_to(name,
|
@@ -32,7 +33,7 @@ module ThinMan
|
|
32
33
|
http_method: nil, no_mouse_click: nil, progress_target: nil,
|
33
34
|
progress_color: nil, mask_target: nil, mask_message: nil,
|
34
35
|
sequence_group: nil, sequence_number: nil, replacement_path: nil, push_path: nil,
|
35
|
-
search_path: nil, search_params: nil, scroll_to: nil)
|
36
|
+
search_path: nil, search_params: nil, scroll_to: nil, scroll_center: nil)
|
36
37
|
ajax_options = {
|
37
38
|
'data-ajax-link-now' => true,
|
38
39
|
'data-ajax-target' => target
|
@@ -52,6 +53,7 @@ module ThinMan
|
|
52
53
|
ajax_options.merge!('data-search-path' => search_path) if search_path.present?
|
53
54
|
ajax_options.merge!('data-search-params' => search_params) if search_params.present?
|
54
55
|
ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
|
56
|
+
ajax_options.merge!('data-scroll-center' => true) if scroll_center.present?
|
55
57
|
ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
|
56
58
|
ajax_options.merge!('data-push-path' => push_path) if push_path.present?
|
57
59
|
|
@@ -84,7 +86,7 @@ module ThinMan
|
|
84
86
|
def ajax_form_hash(target, sub_class: nil, insert_method: nil,
|
85
87
|
error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
|
86
88
|
container: nil, custom_progress: nil, no_mouse_click: nil,
|
87
|
-
mask_target: nil, mask_message: nil, scroll_to: nil, replacement_path: nil, push_path: nil,
|
89
|
+
mask_target: nil, mask_message: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil,
|
88
90
|
progress_target: nil, progress_color: nil)
|
89
91
|
ajax_options = {
|
90
92
|
'data-ajax-form' => true,
|
@@ -104,6 +106,7 @@ module ThinMan
|
|
104
106
|
ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
|
105
107
|
ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
|
106
108
|
ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
|
109
|
+
ajax_options.merge!('data-scroll-center' => true) if scroll_center.present?
|
107
110
|
ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
|
108
111
|
ajax_options.merge!('data-push-path' => push_path) if push_path.present?
|
109
112
|
ajax_options
|
@@ -139,7 +142,7 @@ module ThinMan
|
|
139
142
|
def ajax_form_attrs(target, sub_class: nil,
|
140
143
|
insert_method: nil, error_target: nil, remove_on_success: nil,
|
141
144
|
empty_on_success: nil, reset_on_success: nil, no_mouse_click: nil,
|
142
|
-
progress_target: nil, progress_color: nil, scroll_to: nil, replacement_path: nil, push_path: nil,
|
145
|
+
progress_target: nil, progress_color: nil, scroll_to: nil, scroll_center: nil, replacement_path: nil, push_path: nil,
|
143
146
|
mask_target: nil, mask_message: nil )
|
144
147
|
data_attrs = "data-ajax-form=true data-ajax-target=#{target}"
|
145
148
|
data_attrs += " data-insert-method=#{insert_method}" if insert_method
|
@@ -154,6 +157,7 @@ module ThinMan
|
|
154
157
|
data_attrs += " data-mask-target=#{mask_target}" if mask_target
|
155
158
|
data_attrs += " data-mask-message=#{mask_message}" if mask_message
|
156
159
|
data_attrs += " data-scroll-to=#{scroll_to}" if scroll_to
|
160
|
+
data_attrs += " data-scroll-center=true" if scroll_center
|
157
161
|
data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
|
158
162
|
data_attrs += " data-push-path=#{push_path}" if push_path
|
159
163
|
data_attrs
|
@@ -185,7 +189,7 @@ module ThinMan
|
|
185
189
|
http_method: nil, no_mouse_click: nil, progress_target: nil,
|
186
190
|
progress_color: nil, replacement_path: nil, push_path: nil,
|
187
191
|
mask_target: nil, mask_message: nil,
|
188
|
-
scroll_to: nil)
|
192
|
+
scroll_to: nil, scroll_center: nil)
|
189
193
|
data_attrs = "data-ajax-link=true data-ajax-target=#{target}"
|
190
194
|
data_attrs += " data-insert-method=#{insert_method}" if insert_method
|
191
195
|
data_attrs += " data-ajax-method=#{http_method}" if http_method
|
@@ -196,6 +200,7 @@ module ThinMan
|
|
196
200
|
data_attrs += " data-progress-target=#{progress_target}" if progress_target
|
197
201
|
data_attrs += " data-progress-color=#{progress_color}" if progress_color
|
198
202
|
data_attrs += " data-scroll-to=#{scroll_to}" if scroll_to
|
203
|
+
data_attrs += " data-scroll-center=true" if scroll_center
|
199
204
|
data_attrs += " data-mask-target=#{mask_target}" if mask_target
|
200
205
|
data_attrs += " data-mask-message=#{mask_message}" if mask_message
|
201
206
|
data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
|
@@ -208,7 +213,7 @@ module ThinMan
|
|
208
213
|
http_method: nil, no_mouse_click: nil, progress_target: nil,
|
209
214
|
progress_color: nil, replacement_path: nil, push_path: nil,
|
210
215
|
mask_target: nil, mask_message: nil,
|
211
|
-
scroll_to: nil)
|
216
|
+
scroll_to: nil, scroll_center: nil)
|
212
217
|
ajax_options = {
|
213
218
|
'data-ajax-link' => true,
|
214
219
|
'data-ajax-target' => target
|
@@ -223,6 +228,7 @@ module ThinMan
|
|
223
228
|
ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
|
224
229
|
ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
|
225
230
|
ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
|
231
|
+
ajax_options.merge!('data-scroll-center' => true) if scroll_center.present?
|
226
232
|
ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
|
227
233
|
ajax_options.merge!('data-push-path' => push_path) if push_path.present?
|
228
234
|
ajax_options
|
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.20.
|
4
|
+
version: 0.20.7
|
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: 2019-01-
|
11
|
+
date: 2019-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|