thin_man 0.19.17 → 0.20.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
  SHA256:
3
- metadata.gz: 24f64ee05bbe5f91c8c729626f02df7a185bfa0fd4a72b792ce29026de5241cd
4
- data.tar.gz: d7fec7bed3a691c5edeaca6c0eea39743b8fd54622526e05e4575e5b86103ea2
3
+ metadata.gz: 753b0b0fb8b86f75d675647ea1930de305c0198dd7bb5c846ba8e1504c0937ec
4
+ data.tar.gz: d508926f118e1e41ac2015c2666ccc613d817d438fc3a1d853d764a6a56cf895
5
5
  SHA512:
6
- metadata.gz: 0edda1e10b3df17ba9e63b26358f6c2626e39ee50b5769555544b69b9a4ebbd2e1de21d7433b57c084a1e392c84d895aaafc13220ab6fe00c08bb9edc1d5e93e
7
- data.tar.gz: 7c307a3a706b2aaec5b7f7b82460fc957d37a9465c2eadbdcd8bdbe74ebac71a09b8f902a2bbaa27a948301d5b6f928c776f788357a2a505daa1c57fa3b6f65b
6
+ metadata.gz: 93becdd2b9c02327b2aabbdc0c43d5832a5c5eddeefef4efaf0be07bc5cfad45f9a927883cac3b1e257624530a46a439c9063fbf451ba8e2aa7e6dcdd694da09
7
+ data.tar.gz: be61b5eb294ae7060e097d47f6468afe1df926cf49332e31b84067b9c59721afe28b70deb495c0464eecfc8c744892e4b18bc58af09d37a1dcf2f198cd8fb134
@@ -256,6 +256,20 @@ var initThinMan = function() {
256
256
  this.jq_obj.find('.error').removeClass('error')
257
257
  this.jq_obj.find('.help-inline').remove()
258
258
  }
259
+ if(this.shouldReplaceHistory()){
260
+ var new_url = [location.protocol, '//', location.host, '/', this.replacement_path].join('')
261
+ history['pushState']({}, null, new_url);
262
+ }
263
+ },
264
+ shouldReplaceHistory: function(){
265
+ this.replacement_path = this.jq_obj.data('replacement-path')
266
+ if(this.replacement_path){
267
+ if('/' === this.replacement_path[0]){
268
+ this.replacement_path = this.replacement_path.slice(1)
269
+ }
270
+ return true
271
+ }
272
+ return false
259
273
  },
260
274
  addWatcher: function(watcher) {
261
275
  if (!this.hasOwnProperty('watchers')) {
@@ -3,7 +3,7 @@ module ThinMan
3
3
  def ajax_link(name, options, html_options, target,
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
- mask_target: nil, mask_message: nil,
6
+ mask_target: nil, mask_message: nil, replacement_path: nil,
7
7
  progress_color: nil, scroll_to: nil)
8
8
  ajax_options = {
9
9
  'data-ajax-link' => true,
@@ -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-replacement-path' => replacement_path) if replacement_path.present?
23
24
  link_to(name,
24
25
  options,
25
26
  html_options.merge(ajax_options))
@@ -29,7 +30,7 @@ module ThinMan
29
30
  sub_class: nil, insert_method: nil, empty_on_success: nil, remove_on_success: nil,
30
31
  http_method: nil, no_mouse_click: nil, progress_target: nil,
31
32
  progress_color: nil, mask_target: nil, mask_message: nil,
32
- sequence_group: nil, sequence_number: nil,
33
+ sequence_group: nil, sequence_number: nil, replacement_path: nil,
33
34
  search_path: nil, search_params: nil)
34
35
  ajax_options = {
35
36
  'data-ajax-link-now' => true,
@@ -49,6 +50,7 @@ module ThinMan
49
50
  ajax_options.merge!('data-sequence-number' => sequence_number) if sequence_number.present?
50
51
  ajax_options.merge!('data-search-path' => search_path) if search_path.present?
51
52
  ajax_options.merge!('data-search-params' => search_params) if search_params.present?
53
+ ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
52
54
 
53
55
  a_tag = link_to(name,
54
56
  options,
@@ -79,7 +81,7 @@ module ThinMan
79
81
  def ajax_form_hash(target, sub_class: nil, insert_method: nil,
80
82
  error_target: nil, empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
81
83
  container: nil, custom_progress: nil, no_mouse_click: nil,
82
- mask_target: nil, mask_message: nil, scroll_to: nil,
84
+ mask_target: nil, mask_message: nil, scroll_to: nil, replacement_path: nil,
83
85
  progress_target: nil, progress_color: nil)
84
86
  ajax_options = {
85
87
  'data-ajax-form' => true,
@@ -99,6 +101,7 @@ module ThinMan
99
101
  ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
100
102
  ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
101
103
  ajax_options.merge!('data-scroll-to' => scroll_to) if scroll_to.present?
104
+ ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
102
105
  ajax_options
103
106
  end
104
107
 
@@ -106,7 +109,7 @@ module ThinMan
106
109
  insert_method: nil, error_target: nil,
107
110
  empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
108
111
  container: nil, custom_progress: nil,
109
- mask_target: nil, mask_message: nil,
112
+ mask_target: nil, mask_message: nil, replacement_path: nil,
110
113
  progress_target: nil, progress_color: nil)
111
114
  ajax_options = {
112
115
  'data-ajax-form-now' => true,
@@ -124,13 +127,14 @@ module ThinMan
124
127
  ajax_options.merge!('data-progress-color' => progress_color) if progress_color.present?
125
128
  ajax_options.merge!('data-mask-target' => mask_target) if mask_target.present?
126
129
  ajax_options.merge!('data-mask-message' => mask_message) if mask_message.present?
130
+ ajax_options.merge!('data-replacement-path' => replacement_path) if replacement_path.present?
127
131
  ajax_options
128
132
  end
129
133
 
130
134
  def ajax_form_attrs(target, sub_class: nil,
131
135
  insert_method: nil, error_target: nil, remove_on_success: nil,
132
136
  empty_on_success: nil, reset_on_success: nil, no_mouse_click: nil,
133
- progress_target: nil, progress_color: nil, scroll_to: nil,
137
+ progress_target: nil, progress_color: nil, scroll_to: nil, replacement_path: nil,
134
138
  mask_target: nil, mask_message: nil )
135
139
  data_attrs = "data-ajax-form=true data-ajax-target=#{target}"
136
140
  data_attrs += " data-insert-method=#{insert_method}" if insert_method
@@ -145,13 +149,14 @@ module ThinMan
145
149
  data_attrs += " data-mask-target=#{mask_target}" if mask_target
146
150
  data_attrs += " data-mask-message=#{mask_message}" if mask_message
147
151
  data_attrs += " data-scroll-to=#{scroll_to}" if scroll_to
152
+ data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
148
153
  data_attrs
149
154
  end
150
155
 
151
156
  def ajax_form_now_attrs(target, sub_class: nil,
152
157
  insert_method: nil, error_target: nil,
153
158
  empty_on_success: nil, reset_on_success: nil, remove_on_success: nil,
154
- progress_target: nil, progress_color: nil,
159
+ progress_target: nil, progress_color: nil, replacement_path: nil,
155
160
  mask_target: nil, mask_message: nil )
156
161
  data_attrs = "data-ajax-form-now=true data-ajax-target=#{target}"
157
162
  data_attrs += " data-insert-method=#{insert_method}" if insert_method
@@ -164,13 +169,14 @@ module ThinMan
164
169
  data_attrs += " data-progress-color=#{progress_color}" if progress_color
165
170
  data_attrs += " data-mask-target=#{mask_target}" if mask_target
166
171
  data_attrs += " data-mask-message=#{mask_message}" if mask_message
172
+ data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
167
173
  data_attrs
168
174
  end
169
175
 
170
176
  def ajax_link_attrs(target,
171
177
  insert_method: nil, sub_type: nil, empty_on_success: nil, remove_on_success: nil,
172
178
  http_method: nil, no_mouse_click: nil, progress_target: nil,
173
- progress_color: nil,
179
+ progress_color: nil, replacement_path: nil,
174
180
  mask_target: nil, mask_message: nil,
175
181
  scroll_to: nil)
176
182
  data_attrs = "data-ajax-link=true data-ajax-target=#{target}"
@@ -185,6 +191,7 @@ module ThinMan
185
191
  data_attrs += " data-scroll-to=#{scroll_to}" if scroll_to
186
192
  data_attrs += " data-mask-target=#{mask_target}" if mask_target
187
193
  data_attrs += " data-mask-message=#{mask_message}" if mask_message
194
+ data_attrs += " data-replacement-path=#{replacement_path}" if replacement_path
188
195
  data_attrs
189
196
  end
190
197
 
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.19.17"
2
+ VERSION = "0.20.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.19.17
4
+ version: 0.20.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: 2018-10-11 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails