foreign_office 0.15.9 → 0.15.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ae26382de688baf1b41116375fbe87089f9c09
|
4
|
+
data.tar.gz: 3c4e36de4d98efcd857d43b8302f2c61138b89bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
265
|
-
this
|
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
|
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
|
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.
|
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-
|
12
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|