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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4f40b8746726ba79f619098c650ed3177caea5a2699f8a40622eb993aa26999
4
- data.tar.gz: 649874801db8cbf0c956cdea969d473ad515a2daec9a99baf385397f76caa253
3
+ metadata.gz: 9f14546b73fd65c440fe329c8ad0a3965d31483661266439d7b33924f6ed3400
4
+ data.tar.gz: 3a86b97d1e6af62d6856d137921bff56effc66c2c25d77708466fadee4494f36
5
5
  SHA512:
6
- metadata.gz: 66ca8d0a2aa3fee31b31ef87414ecbf0ae36b2084dd96fd512b48320195772fb14cdd7f2fe09d6d949968cd1b352c2ad016a146ba15d2f5de613db8997c76c23
7
- data.tar.gz: 6d38c26667cbbb947d0e3fc1d0eb2bced1ed0dcf54e8a528aad1b3b70cef1290d1b36abe61556cc3da797e46d25b0fa22a67e473ac93ea6099e0d4ab5aaf2e81
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);
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.20.6"
2
+ VERSION = "0.20.7"
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.20.6
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 00:00:00.000000000 Z
11
+ date: 2019-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails