foreign_office 0.15.9 → 0.15.10

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: 7e2cd672c374052a2b0a0153495886ca4aaf8cb2
4
- data.tar.gz: 963f3ea6bf287ce82fd4e728b50f660eedf05aab
3
+ metadata.gz: 41ae26382de688baf1b41116375fbe87089f9c09
4
+ data.tar.gz: 3c4e36de4d98efcd857d43b8302f2c61138b89bd
5
5
  SHA512:
6
- metadata.gz: 3b520c6fffb6aafb80a46942a087686cbb29600a6a143ada7b03c5f86b5df9c9d600428a1b3c0908f6a46a6cc04bc654ba0d9025e395d891eadf54329043a05b
7
- data.tar.gz: c28e7a6151ee08d158ffe4561b66c3ad173e6f6bde4fdd55fdffc562f6daaeeede3c04f0807f42dbc7b4cb13216d97ad4c7b5bde3d6358e1ea9f9bb9900a5230
6
+ metadata.gz: cbbbd265379d9b2d179aa7489aeb971c5e4f7ecfe0eba8c7ea920a4729538405a157bde0677129bb245ba218b8b98e823baed24b2ac706aaedcfacdcfe05ae4a
7
+ data.tar.gz: cdce665b19bc083eff699169a1caddcfad53c01f33796851c17622c3ba3c8c6e5b359f8c8933ed0fef4b6219331fe2700edce829d8ee5b2c32f862a5813b1796
@@ -153,14 +153,14 @@ var ForeignOfficeListener = Class.extend({
153
153
  return true
154
154
  }
155
155
  if(this.endpoint){
156
- let $progress_target = null
156
+ var $progress_target = null
157
157
  if($listener.data('progress-target')){
158
158
  $progress_target = $($listener.data('progress-target'))
159
159
  } else {
160
160
  $progress_target = []
161
161
  }
162
162
  if (m.object[this.object_key] == true) {
163
- let progress_indicator = new thin_man.AjaxProgress($progress_target,$listener,'black')
163
+ var progress_indicator = new thin_man.AjaxProgress($progress_target,$listener,'black')
164
164
  $.get(this.endpoint, function(data){
165
165
  $listener.html(data);
166
166
  }).always(function(){
@@ -169,7 +169,7 @@ var ForeignOfficeListener = Class.extend({
169
169
  }else if(m.object[this.object_key] == false) {
170
170
  $listener.empty();
171
171
  }else if(typeof(m.object[this.object_key]) == 'string'){
172
- let progress_indicator = new thin_man.AjaxProgress($progress_target,$listener,'black')
172
+ var progress_indicator = new thin_man.AjaxProgress($progress_target,$listener,'black')
173
173
  $.get(m.object[this.object_key], function(data){
174
174
  $listener.html(data);
175
175
  }).always(function(){
@@ -223,7 +223,7 @@ var ForeignOfficeListener = Class.extend({
223
223
  break;
224
224
 
225
225
  default:
226
- if(this.$listener.data('trigger-on-message')){
226
+ if(this.$listener.data('trigger-on-message') || this.$listener.data('download')){
227
227
  if(new_value && (new_value != 'false')){
228
228
  if((new_value != true) && (new_value != 'true')){
229
229
  this.$listener.attr('href',new_value);
@@ -235,6 +235,8 @@ var ForeignOfficeListener = Class.extend({
235
235
  this.$listener.trigger('apiclick');
236
236
  }else if(this.$listener.data('ajax-form')){
237
237
  this.$listener.trigger('apisubmit');
238
+ }else if(this.$listener.data('download')){
239
+ window.open(new_value);
238
240
  }else{
239
241
  window.location = new_value;
240
242
  }
@@ -252,20 +254,16 @@ var ForeignOfficeListener = Class.extend({
252
254
  },
253
255
  getForeignOfficeProgressIndicator: function(){
254
256
  var this_listener = this;
255
- $('[data-foreign-office-progress-indicator="' + this.channel + '"]').each(function(){
256
- this_listener.foreign_office_progress_indicator = $(this).data('foreign-office-progress-indicator-object');
257
- this_listener.foreign_office_flash = $(this).data('ajax-foreign-office-flash').notice;
257
+ $('[data-foreign-office-progress-indicator][data-channel="' + this.channel + '"][data-key="' + this.object_key + '"]').each(function(){
258
+ this_listener.$foreign_office_progress_indicator = $(this);
258
259
  })
259
260
  },
260
261
  getChannelObject: function(){
261
262
  return foreign_office.channels_by_name[this.channel];
262
263
  },
263
264
  removeProgressIndicator: function(){
264
- if(this.foreign_office_progress_indicator){
265
- this.foreign_office_progress_indicator.stop();
266
- if(this.foreign_office_flash){
267
- new AjaxFlash('success',this.foreign_office_flash,this.$listener);
268
- }
265
+ if(this.$foreign_office_progress_indicator){
266
+ this.$foreign_office_progress_indicator.remove()
269
267
  }
270
268
  }
271
269
  });
@@ -1,6 +1,6 @@
1
1
  module ForeignOffice
2
2
  module ForeignOfficeHelper
3
- def listener_attrs(resource, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
3
+ def listener_attrs(resource, key, reveal_hide: false, endpoint: nil, download: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
4
4
  data_attrs = "data-listener=true data-channel=#{resource.class.name}#{resource.id}"
5
5
  if delete
6
6
  data_attrs += " data-delete-key=#{key}"
@@ -10,13 +10,19 @@ module ForeignOffice
10
10
  data_attrs += " data-reveal-hide=true" if reveal_hide
11
11
  data_attrs += " data-endpoint=#{endpoint}" if endpoint
12
12
  data_attrs += " data-trigger-on-message=true" if trigger
13
+ data_attrs += " data-download=true" if download
13
14
  data_attrs += " data-href-target=true" if href_target
14
15
  data_attrs += " data-progress-target=#{progress_target}" if progress_target
15
16
  data_attrs += " data-create-modal=#{create_modal}" if create_modal
16
17
  data_attrs
17
18
  end
18
19
 
19
- def listener_attrs_raw(channel, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
20
+ def progress_indicator_attrs(resource, key)
21
+ data_attrs = "data-foreign-office-progress-indicator=true data-channel=#{resource.class.name}#{resource.id}"
22
+ data_attrs += " data-key=#{key}"
23
+ end
24
+
25
+ def listener_attrs_raw(channel, key, reveal_hide: false, endpoint: nil, download: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
20
26
  data_attrs = "data-listener=true data-channel=#{channel}"
21
27
  if delete
22
28
  data_attrs += " data-delete-key=#{key}"
@@ -25,6 +31,7 @@ module ForeignOffice
25
31
  end
26
32
  data_attrs += " data-reveal-hide=true" if reveal_hide
27
33
  data_attrs += " data-endpoint=#{endpoint}" if endpoint
34
+ data_attrs += " data-download=true" if download
28
35
  data_attrs += " data-trigger-on-message=true" if trigger
29
36
  data_attrs += " data-href-target=true" if href_target
30
37
  data_attrs += " data-progress-target=#{progress_target}" if progress_target
@@ -32,7 +39,7 @@ module ForeignOffice
32
39
  data_attrs
33
40
  end
34
41
 
35
- def listener_hash(resource, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
42
+ def listener_hash(resource, key, reveal_hide: false, endpoint: nil, download: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
36
43
  hash = {listener: true, channel: resource.class.name + resource.id.to_s}
37
44
  if delete
38
45
  hash[:delete_key] = key
@@ -41,6 +48,7 @@ module ForeignOffice
41
48
  end
42
49
  hash[:reveal_hide] = true if reveal_hide
43
50
  hash[:endpoint] = endpoint if endpoint
51
+ hash[:download] = true if download
44
52
  hash[:trigger_on_message] = true if trigger
45
53
  hash[:href_target] = true if href_target
46
54
  hash[:create_modal] = create_modal if create_modal
@@ -48,7 +56,7 @@ module ForeignOffice
48
56
  hash
49
57
  end
50
58
 
51
- def listener_hash_raw(channel, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
59
+ def listener_hash_raw(channel, key, reveal_hide: false, endpoint: nil, download: nil, trigger: nil, delete: nil, href_target: nil, create_modal: nil, progress_target: nil)
52
60
  hash = {listener: true, channel: channel}
53
61
  if delete
54
62
  hash[:delete_key] = key
@@ -57,6 +65,7 @@ module ForeignOffice
57
65
  end
58
66
  hash[:reveal_hide] = true if reveal_hide
59
67
  hash[:endpoint] = endpoint if endpoint
68
+ hash[:download] = true if download
60
69
  hash[:trigger_on_message] = true if trigger
61
70
  hash[:href_target] = true if href_target
62
71
  hash[:create_modal] = create_modal if create_modal
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.15.9"
2
+ VERSION = "0.15.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreign_office
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.9
4
+ version: 0.15.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-20 00:00:00.000000000 Z
12
+ date: 2017-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails