cubism 0.1.0.pre2 → 0.1.0.pre3
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 +4 -4
- data/README.md +1 -1
- data/app/channels/cubism/presence_channel.rb +6 -2
- data/app/helpers/cubism_helper.rb +2 -2
- data/app/helpers/cubism_helper.rb~ +6 -3
- data/lib/cubism/version.rb +1 -1
- data/lib/cubism/version.rb~ +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 552b9be661b93fdddc9ded1d3b95316ef341fc750ea9950edf6d3d5e84f7ae46
|
4
|
+
data.tar.gz: 58e4f47f505d94f1f23294699208746cb344ea36b1858aef4596a06396f71838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1c8117ba4c9c31db45a293678ac38f8427c392cde8e7ac7cc2c46eb5a7801195917ac78db78e2e0a528d6059fcc15c6db5df415edb0d671a4d12b0bc3230935
|
7
|
+
data.tar.gz: 682f88933c469912f8f36b3188942d4a88a4aa78229194c5936116edc285e846dc1a3ad3db829efb1b3654343f0ea9168751899c299d1d2773cd4efc7e3c01d3
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Using the `cubicle_for` helper, you can set up a presence indicator. It will
|
|
44
44
|
2. accept a "template" using the attributes safelisted above. Elements marked with `data-cubicle-attribute=` will have their `innerHTML` replaced by Cubism.
|
45
45
|
|
46
46
|
```erb
|
47
|
-
<%= cubicle_for @project do %>
|
47
|
+
<%= cubicle_for @project, current_user do %>
|
48
48
|
<span class="avatar">
|
49
49
|
<span data-cubicle-attribute="email"></span>
|
50
50
|
</span>
|
@@ -4,7 +4,7 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
|
|
4
4
|
def subscribed
|
5
5
|
if resource.present?
|
6
6
|
stream_for resource
|
7
|
-
resource.present_users.add(
|
7
|
+
resource.present_users.add(user.id)
|
8
8
|
else
|
9
9
|
reject
|
10
10
|
end
|
@@ -13,7 +13,7 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
|
|
13
13
|
def unsubscribed
|
14
14
|
return unless resource.present?
|
15
15
|
|
16
|
-
resource.present_users.remove(
|
16
|
+
resource.present_users.remove(user.id)
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
@@ -22,4 +22,8 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
|
|
22
22
|
locator = verified_stream_identifier(params[:identifier])
|
23
23
|
GlobalID::Locator.locate(locator)
|
24
24
|
end
|
25
|
+
|
26
|
+
def user
|
27
|
+
GlobalID::Locator.locate_signed(params[:user])
|
28
|
+
end
|
25
29
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module CubismHelper
|
2
2
|
include CableReady::StreamIdentifier
|
3
3
|
|
4
|
-
def cubicle_for(resource, html_options: {}, &block)
|
4
|
+
def cubicle_for(resource, user, html_options: {}, &block)
|
5
5
|
template = capture(&block)
|
6
6
|
|
7
|
-
tag.cubicle_element({identifier: signed_stream_identifier(resource.to_global_id.to_s)}) do
|
7
|
+
tag.cubicle_element({identifier: signed_stream_identifier(resource.to_global_id.to_s), user: user.to_sgid.to_s}) do
|
8
8
|
content_tag(:template, template, {slot: "template"})
|
9
9
|
end
|
10
10
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module CubismHelper
|
2
|
-
include CableReady::Compoundable
|
3
2
|
include CableReady::StreamIdentifier
|
4
3
|
|
5
|
-
def cubicle_for(
|
6
|
-
|
4
|
+
def cubicle_for(resource, html_options: {}, &block)
|
5
|
+
template = capture(&block)
|
6
|
+
|
7
|
+
tag.cubicle_element({identifier: signed_stream_identifier(resource.to_global_id.to_s)}) do
|
8
|
+
content_tag(:template, template, {slot: "template"})
|
9
|
+
end
|
7
10
|
end
|
8
11
|
end
|
data/lib/cubism/version.rb
CHANGED
data/lib/cubism/version.rb~
CHANGED