foreign_office 0.4.0 → 0.5.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: 55270150e750fa6f209103448c796f3b34f8a762
4
- data.tar.gz: 660fa594f55b965d17b480a021a32befe632ef33
3
+ metadata.gz: 612064b876d728a15430046d4f247a756862135c
4
+ data.tar.gz: 34eb73938ba695edbd8d4551ca51de5591d83bf5
5
5
  SHA512:
6
- metadata.gz: 1a50cf24779141b53d93f9d3ac96c40f006e4e3720d497e0c765e89364f17f9eb9c47299160e8990ea9d0cc512c3456ef69081ece4e212fe90a4d3cf9df28e51
7
- data.tar.gz: afb139d91e662406f4755090e8b408e003f8beb45f5a8b477db756c3c58f38d47e0abcdd3ff18ecdaa08619ac8e3a32bb0ee79079819d3fa99153cf3906d2ddb
6
+ metadata.gz: 89f21b878d416a1bc283b9b7e343f8979f5f604a08ff0a691569ebe3db19b613fee57b0fd9d828b76113f113d6f6234d6b350895fe5de021971f03283523160b
7
+ data.tar.gz: 5c8660a7b65ff6e35564965f68d03298ed6ad6b177fa0a1231f12d8ec8b86e2198e825a8da1b0e5d12d8bb2e9aed68cedb3dbd4747dcdd1116f5ff5ad8e0a371
@@ -71,6 +71,7 @@ var ForeignOfficeListener = Class.extend({
71
71
  init: function($listener){
72
72
  this.$listener = $listener;
73
73
  this.endpoint = $listener.data('endpoint');
74
+ this.reveal_hide = $listener.data('reveal-hide');
74
75
  this.object_key = $listener.data('key');
75
76
  this.delete_key = $listener.data('delete-key');
76
77
  this.channel = $listener.data('channel');
@@ -89,6 +90,14 @@ var ForeignOfficeListener = Class.extend({
89
90
  if (m.object[this.delete_key] == true) {
90
91
  $listener.remove;
91
92
  }
93
+ }else if(this.reveal_hide){
94
+ var current_value = m.object[this.object_key];
95
+ if(!current_value || current_value == 'false' || current_value == 'hide'){
96
+ this.$listener.hide();
97
+ } else if(current_value == true || current_value == 'true' || current_value == 'show'){
98
+ this.$listener.removeClass('hidden');
99
+ this.$listener.show();
100
+ }
92
101
  }else{
93
102
  var new_value = m.object[this.object_key];
94
103
  switch(this.$listener.get(0).nodeName.toLowerCase()){
@@ -148,18 +157,6 @@ var ForeignOfficeNewListItems = ForeignOfficeListener.extend({
148
157
  }
149
158
  });
150
159
 
151
- var ForeignOfficeRevealer = ForeignOfficeListener.extend({
152
- handleMessage: function(m){
153
- var current_value = m.object[this.object_key];
154
- if(!current_value || current_value == 'false' || current_value == 'hide'){
155
- this.$listener.hide();
156
- } else if(current_value == true || current_value == 'true' || current_value == 'show'){
157
- this.$listener.removeClass('hidden');
158
- this.$listener.show();
159
- }
160
- }
161
- });
162
-
163
160
  var ForeignOfficeColor = ForeignOfficeListener.extend({
164
161
  handleMessage: function(m){
165
162
  var new_value = m.object[this.object_key];
@@ -12,4 +12,11 @@ module ForeignOffice
12
12
  data_attrs
13
13
  end
14
14
  end
15
+
16
+ def listener_hash(resource, key, reveal_hide: false)
17
+ hash = {listener: true, channel: resource.class.name + resource.id.to_s, key: key}
18
+ hash[:reveal_hide] = true if reveal_hide
19
+ hash
20
+ end
21
+
15
22
  end
@@ -1,3 +1,3 @@
1
1
  module ForeignOffice
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
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.4.0
4
+ version: 0.5.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: 2015-02-25 00:00:00.000000000 Z
12
+ date: 2015-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -123,8 +123,6 @@ files:
123
123
  - test/dummy/config/locales/en.yml
124
124
  - test/dummy/config/routes.rb
125
125
  - test/dummy/config/secrets.yml
126
- - test/dummy/db/test.sqlite3
127
- - test/dummy/log/test.log
128
126
  - test/dummy/public/404.html
129
127
  - test/dummy/public/422.html
130
128
  - test/dummy/public/500.html
@@ -185,8 +183,6 @@ test_files:
185
183
  - test/dummy/config/routes.rb
186
184
  - test/dummy/config/secrets.yml
187
185
  - test/dummy/config.ru
188
- - test/dummy/db/test.sqlite3
189
- - test/dummy/log/test.log
190
186
  - test/dummy/public/404.html
191
187
  - test/dummy/public/422.html
192
188
  - test/dummy/public/500.html
File without changes
@@ -1,22 +0,0 @@
1
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
2
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
3
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
4
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
5
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
6
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is another test"}}
7
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
8
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
9
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
10
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
11
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
12
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
13
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
14
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
15
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
16
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
17
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
18
- ForeignOffice#publish! attempt: 1 message: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}
19
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
20
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is another test"}}
21
- ForeignOffice.publish: {:channel=>"TestMe", :object=>{:this=>"is a test"}}
22
- ForeignOffice.publish: {:channel=>"TestMeAgain", :object=>{:this=>"is another test"}}