foreign_office 0.12.3 → 0.13.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21cc8423d3c2968af39056f4d38ab4fe9b6f1595
|
4
|
+
data.tar.gz: ce68f970618fdf2942424c28ff59785a69d9880b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b5253d0ecbcae1e0dbfcf455a57f5e1015d634426dbb0b29defe8c0712a0e41a5b224d729eddea74be2e7a05f24e4927116c338838acf355a2725eb7f7098f4
|
7
|
+
data.tar.gz: 08d8f94809996bea13066400747bc241c7fc26b809d9869230b76b2e6dabad8145f526c15471adfed6af19a9fe0f6247217c283d27ae51edcc9c4095fe3c913b
|
@@ -111,6 +111,7 @@ var ForeignOfficeListener = Class.extend({
|
|
111
111
|
this.reveal_hide = $listener.data('reveal-hide');
|
112
112
|
this.object_key = $listener.data('key');
|
113
113
|
this.delete_key = $listener.data('delete-key');
|
114
|
+
this.href_target = $listener.data('href-target')
|
114
115
|
this.channel = $listener.data('channel');
|
115
116
|
if(this.$listener.data('progress-indicator')){
|
116
117
|
this.progress_indicator = new thin_man.AjaxProgress(this.$listener);
|
@@ -131,7 +132,7 @@ var ForeignOfficeListener = Class.extend({
|
|
131
132
|
})
|
132
133
|
}
|
133
134
|
if (m.object[this.delete_key] == true) {
|
134
|
-
$listener.remove;
|
135
|
+
$listener.remove();
|
135
136
|
}
|
136
137
|
}else if(this.reveal_hide){
|
137
138
|
var current_value = m.object[this.object_key];
|
@@ -141,16 +142,22 @@ var ForeignOfficeListener = Class.extend({
|
|
141
142
|
this.$listener.removeClass('hidden');
|
142
143
|
this.$listener.show();
|
143
144
|
}
|
145
|
+
}else if(this.href_target){
|
146
|
+
this.$listener.attr('href',m.object[this.object_key])
|
144
147
|
}else{
|
145
148
|
var new_value = m.object[this.object_key];
|
146
149
|
switch(this.$listener.get(0).nodeName.toLowerCase()){
|
147
|
-
case 'input':
|
150
|
+
case 'input':
|
148
151
|
if(this.$listener.attr('type') == 'checkbox'){
|
149
152
|
this.$listener.prop('checked', new_value);
|
150
153
|
} else {
|
151
154
|
this.$listener.val(new_value);
|
152
155
|
}
|
153
156
|
break;
|
157
|
+
case 'select':
|
158
|
+
this.$listener.find('option[value="' + new_value + '"]').attr('selected','selected')
|
159
|
+
this.$listener.trigger("chosen:updated")
|
160
|
+
break;
|
154
161
|
|
155
162
|
case 'img':
|
156
163
|
this.$listener.prop('src',new_value);
|
@@ -175,6 +182,8 @@ var ForeignOfficeListener = Class.extend({
|
|
175
182
|
window.location = new_value;
|
176
183
|
}
|
177
184
|
}
|
185
|
+
}else if (m.object[this.delete_key] == true) {
|
186
|
+
$listener.remove();
|
178
187
|
}else{
|
179
188
|
this.$listener.html(new_value);
|
180
189
|
}
|
@@ -1,26 +1,58 @@
|
|
1
1
|
module ForeignOffice
|
2
2
|
module ForeignOfficeHelper
|
3
|
-
def listener_attrs(resource, key, reveal_hide: false, endpoint: nil, trigger: nil)
|
4
|
-
data_attrs = "data-listener=true data-channel=#{resource.class.name}#{resource.id}
|
3
|
+
def listener_attrs(resource, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil)
|
4
|
+
data_attrs = "data-listener=true data-channel=#{resource.class.name}#{resource.id}"
|
5
|
+
if delete
|
6
|
+
data_attrs += " data-delete-key=#{key}"
|
7
|
+
else
|
8
|
+
data_attrs += " data-key=#{key}"
|
9
|
+
end
|
5
10
|
data_attrs += " data-reveal-hide=true" if reveal_hide
|
6
11
|
data_attrs += " data-endpoint=#{endpoint}" if endpoint
|
7
12
|
data_attrs += " data-trigger-on-message=true" if trigger
|
13
|
+
data_attrs += " data-href-target=true" if href_target
|
8
14
|
data_attrs
|
9
15
|
end
|
10
16
|
|
11
|
-
def listener_attrs_raw(channel, key, reveal_hide: false, endpoint: nil, trigger: nil)
|
12
|
-
data_attrs = "data-listener=true data-channel=#{channel}
|
17
|
+
def listener_attrs_raw(channel, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil)
|
18
|
+
data_attrs = "data-listener=true data-channel=#{channel}"
|
19
|
+
if delete
|
20
|
+
data_attrs += " data-delete-key=#{key}"
|
21
|
+
else
|
22
|
+
data_attrs += " data-key=#{key}"
|
23
|
+
end
|
13
24
|
data_attrs += " data-reveal-hide=true" if reveal_hide
|
14
25
|
data_attrs += " data-endpoint=#{endpoint}" if endpoint
|
15
26
|
data_attrs += " data-trigger-on-message=true" if trigger
|
27
|
+
data_attrs += " data-href-target=true" if href_target
|
16
28
|
data_attrs
|
17
29
|
end
|
18
30
|
|
19
|
-
def listener_hash(resource, key, reveal_hide: false, endpoint: nil, trigger: nil)
|
20
|
-
hash = {listener: true, channel: resource.class.name + resource.id.to_s
|
31
|
+
def listener_hash(resource, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil)
|
32
|
+
hash = {listener: true, channel: resource.class.name + resource.id.to_s}
|
33
|
+
if delete
|
34
|
+
hash[:delete_key] = key
|
35
|
+
else
|
36
|
+
hash[:key] = key
|
37
|
+
end
|
21
38
|
hash[:reveal_hide] = true if reveal_hide
|
22
39
|
hash[:endpoint] = endpoint if endpoint
|
23
40
|
hash[:trigger_on_message] = true if trigger
|
41
|
+
hash[:href_target] = true if href_target
|
42
|
+
hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def listener_hash_raw(channel, key, reveal_hide: false, endpoint: nil, trigger: nil, delete: nil, href_target: nil)
|
46
|
+
hash = {listener: true, channel: channel}
|
47
|
+
if delete
|
48
|
+
hash[:delete_key] = key
|
49
|
+
else
|
50
|
+
hash[:key] = key
|
51
|
+
end
|
52
|
+
hash[:reveal_hide] = true if reveal_hide
|
53
|
+
hash[:endpoint] = endpoint if endpoint
|
54
|
+
hash[:trigger_on_message] = true if trigger
|
55
|
+
hash[:href_target] = true if href_target
|
24
56
|
hash
|
25
57
|
end
|
26
58
|
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.
|
4
|
+
version: 0.13.0
|
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:
|
12
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|