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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 285d3d9bb85b4e424646223cfca5b0e8b9ee1bc3d7140a51ba951fc7b67237cd
4
- data.tar.gz: 70579c946d1c0bb5d2e5176355ac953c887368d51f8568abced88efbf5c7fd71
3
+ metadata.gz: 552b9be661b93fdddc9ded1d3b95316ef341fc750ea9950edf6d3d5e84f7ae46
4
+ data.tar.gz: 58e4f47f505d94f1f23294699208746cb344ea36b1858aef4596a06396f71838
5
5
  SHA512:
6
- metadata.gz: fec2a6f41b350167bf2e0349cad1b43cd535ee280bcd4b9102a9976890fb26e6839549d8bec301a60074eca6d6df0c541846a5ee8f173e010cfda6030267869b
7
- data.tar.gz: 24e7ab307ad8abc9528b42016bd57e4e05000e21beddb97698015a4d0c727504babb8cab958d99952a161adb536e32aa0760b364b9e58a585c422ce83c449df5
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(current_user.id)
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(current_user.id)
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(*keys, html_options: {})
6
- tag.cubicle_element({identifier: signed_stream_identifier(compound(keys))})
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
@@ -1,3 +1,3 @@
1
1
  module Cubism
2
- VERSION = "0.1.0.pre2"
2
+ VERSION = "0.1.0.pre3"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Cubism
2
- VERSION = "0.1.0.pre1"
2
+ VERSION = "0.1.0.pre2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cubism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
4
+ version: 0.1.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch