notifiably_audited 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/audited-activerecord.gemspec +1 -1
- data/audited.gemspec +1 -1
- data/lib/assets/javascripts/private_pub.js +72 -0
- data/lib/notifiably_audited/helper.rb +16 -2
- data/notifiably_audited-1.0.3.gem +0 -0
- data/notifiably_audited-1.0.4.gem +0 -0
- data/notifiably_audited-activerecord-1.0.3.gem +0 -0
- data/notifiably_audited-activerecord-1.0.4.gem +0 -0
- metadata +6 -2
- data/lib/assets/javascripts/notifiably_audited.js +0 -14
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTAyNzkyYjZiYzgwOGJmZTNiZDcyYmU3NTkzMjkxMmI5YmIyM2ZhNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGE3ZmU1NjY4NGRiNTAzYzhiMGVlOGU2ZWQ3NDQwNTQwMTJmMGJmZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTBhMzgyNzQ3ZjkzZWVkM2NiMjZkMmYxZjQwNWVmYmQwYjNkOTQ1ZmYzY2Fi
|
10
|
+
MmI0N2ZjNGJmOWZkZjgwYTMyOGNmYWMyOGVkZGJiYmJjYWE5MTYzOWJkODJk
|
11
|
+
NzU3YTFhYzczYmUwODI3OTU5OGI2NmRlY2VjNTk4ZDFiZmQwODg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTM4NDdkNDRiNjRlMmFkNzgwYmFjOGEwNWVjNDZmNWJmYWEzZjFiMmMxYTcw
|
14
|
+
ZTlkOTcxZmExMTYzNGVlMDIxOTllMWI4MjFjMWI0MjA1OThlOGFlODA0MGIw
|
15
|
+
OTBmMWMxODY4ZjJhMjczZTY4NjljZTE4ZjIwMzdmOTEwMmJhOGU=
|
data/audited.gemspec
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
function buildPrivatePub(doc) {
|
2
|
+
var self = {
|
3
|
+
connecting: false,
|
4
|
+
fayeClient: null,
|
5
|
+
fayeCallbacks: [],
|
6
|
+
subscriptions: {},
|
7
|
+
subscriptionCallbacks: {},
|
8
|
+
|
9
|
+
faye: function(callback) {
|
10
|
+
if (self.fayeClient) {
|
11
|
+
callback(self.fayeClient);
|
12
|
+
} else {
|
13
|
+
self.fayeCallbacks.push(callback);
|
14
|
+
if (self.subscriptions.server && !self.connecting) {
|
15
|
+
self.connecting = true;
|
16
|
+
var script = doc.createElement("script");
|
17
|
+
script.type = "text/javascript";
|
18
|
+
script.src = self.subscriptions.server + ".js";
|
19
|
+
script.onload = self.connectToFaye;
|
20
|
+
doc.documentElement.appendChild(script);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
},
|
24
|
+
|
25
|
+
connectToFaye: function() {
|
26
|
+
self.fayeClient = new Faye.Client(self.subscriptions.server);
|
27
|
+
self.fayeClient.addExtension(self.fayeExtension);
|
28
|
+
for (var i=0; i < self.fayeCallbacks.length; i++) {
|
29
|
+
self.fayeCallbacks[i](self.fayeClient);
|
30
|
+
};
|
31
|
+
},
|
32
|
+
|
33
|
+
fayeExtension: {
|
34
|
+
outgoing: function(message, callback) {
|
35
|
+
if (message.channel == "/meta/subscribe") {
|
36
|
+
// Attach the signature and timestamp to subscription messages
|
37
|
+
var subscription = self.subscriptions[message.subscription];
|
38
|
+
if (!message.ext) message.ext = {};
|
39
|
+
message.ext.private_pub_signature = subscription.signature;
|
40
|
+
message.ext.private_pub_timestamp = subscription.timestamp;
|
41
|
+
}
|
42
|
+
callback(message);
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
sign: function(options) {
|
47
|
+
if (!self.subscriptions.server) {
|
48
|
+
self.subscriptions.server = options.server;
|
49
|
+
}
|
50
|
+
self.subscriptions[options.channel] = options;
|
51
|
+
self.faye(function(faye) {
|
52
|
+
faye.subscribe(options.channel, self.handleResponse);
|
53
|
+
});
|
54
|
+
},
|
55
|
+
|
56
|
+
handleResponse: function(message) {
|
57
|
+
if (message.eval) {
|
58
|
+
eval(message.eval);
|
59
|
+
}
|
60
|
+
if (callback = self.subscriptionCallbacks[message.channel]) {
|
61
|
+
callback(message.data, message.channel);
|
62
|
+
}
|
63
|
+
},
|
64
|
+
|
65
|
+
subscribe: function(channel, callback) {
|
66
|
+
self.subscriptionCallbacks[channel] = callback;
|
67
|
+
}
|
68
|
+
};
|
69
|
+
return self;
|
70
|
+
}
|
71
|
+
|
72
|
+
var PrivatePub = buildPrivatePub(document);
|
@@ -1,7 +1,21 @@
|
|
1
1
|
module NotifiablyAudited
|
2
2
|
module NotifiablyAuditedHelpers
|
3
|
-
def notifiably_audited(
|
4
|
-
|
3
|
+
def notifiably_audited(script)
|
4
|
+
user_id = current_user.id rescue nil
|
5
|
+
|
6
|
+
html = '<script>
|
7
|
+
|
8
|
+
PrivatePub.subscribe("/notifiably_audited/'
|
9
|
+
|
10
|
+
html += user_id.to_s
|
11
|
+
|
12
|
+
html += '", function(data, channel) {'
|
13
|
+
|
14
|
+
html += script
|
15
|
+
|
16
|
+
html += '});</script>'
|
17
|
+
|
18
|
+
html += subscribe_to "/notifiably_audited/#{user_id}"
|
5
19
|
end
|
6
20
|
end
|
7
21
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiably_audited
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- senthil kumar
|
@@ -129,7 +129,7 @@ files:
|
|
129
129
|
- gemfiles/rails30.gemfile
|
130
130
|
- gemfiles/rails31.gemfile
|
131
131
|
- gemfiles/rails32.gemfile
|
132
|
-
- lib/assets/javascripts/
|
132
|
+
- lib/assets/javascripts/private_pub.js
|
133
133
|
- lib/notifiably_audited-activerecord.rb
|
134
134
|
- lib/notifiably_audited.rb
|
135
135
|
- lib/notifiably_audited/audit.rb
|
@@ -141,9 +141,13 @@ files:
|
|
141
141
|
- notifiably_audited-1.0.0.gem
|
142
142
|
- notifiably_audited-1.0.1.gem
|
143
143
|
- notifiably_audited-1.0.2.gem
|
144
|
+
- notifiably_audited-1.0.3.gem
|
145
|
+
- notifiably_audited-1.0.4.gem
|
144
146
|
- notifiably_audited-activerecord-1.0.0.gem
|
145
147
|
- notifiably_audited-activerecord-1.0.1.gem
|
146
148
|
- notifiably_audited-activerecord-1.0.2.gem
|
149
|
+
- notifiably_audited-activerecord-1.0.3.gem
|
150
|
+
- notifiably_audited-activerecord-1.0.4.gem
|
147
151
|
- spec/audited_spec_helpers.rb
|
148
152
|
- spec/rails_app/config/application.rb
|
149
153
|
- spec/rails_app/config/database.yml
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
SeeMore (for jQuery)
|
3
|
-
version: 0.1.0 (16/03/2014)
|
4
|
-
@requires jQuery
|
5
|
-
|
6
|
-
By Senthil Kumar Muthamzihan
|
7
|
-
Examples at http://beckproducts.com
|
8
|
-
|
9
|
-
Licensed under the MIT:
|
10
|
-
http://www.opensource.org/licenses/mit-license.php
|
11
|
-
|
12
|
-
*/
|
13
|
-
//
|
14
|
-
//= require private_pub
|