cubism 0.1.0.pre5 → 0.1.0.pre6

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
  SHA256:
3
- metadata.gz: 4486331e2d59695363fc4e2019ffe4fe7498a1b8d13e5ced08864b4f8fe1613c
4
- data.tar.gz: a80f6add8477c622884f0f985efcda533e5b7d3a13f50a2ebb39fd4fba1a3f69
3
+ metadata.gz: 10a5083117c16883fd1794f09ed204481d6adfef8143c2f243d56030aa438054
4
+ data.tar.gz: f40048d57269c6bf2d4fc4c8cdfb91f4e4021da157c35fcf0f0b8d46c59f8929
5
5
  SHA512:
6
- metadata.gz: c07214a8095195319734a15296c4a302c59cd9107bb20b8839e52e1994f8447f7cf1065737fe3446b7743c29d0ce15621033a7a8fe44aab3624a467724482e8e
7
- data.tar.gz: e5c9bab8327f4ff0adb46cd6a3465fedb6729597e41eb8dafd5695b870806642a9c28f36b7c3e0e51a0c882c2b42eab6edc6971c2bee34e214b16cf34b17215d
6
+ metadata.gz: 8d6410ee9e19694330c836a8580de898ef4ccb560fcdd562ff1f199d83db357538952809f156d1eb29991f15d7a925dbb4cd97bacf0b498a8e037d2187de537d
7
+ data.tar.gz: 400663fdce10836259b1affe8197e2c57da63358912529b4ff79bddbe052ac16251e1032b904a921467fd1290ea11100b16764c9ce61b6eaaeab9d634cf83401
@@ -3,7 +3,7 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
3
3
 
4
4
  def subscribed
5
5
  if resource.present?
6
- stream_for resource
6
+ stream_from params[:element_id]
7
7
  resource.cubicle_element_ids << element_id
8
8
  resource.excluded_user_id_for_element_id[element_id] = user.id if exclude_current_user?
9
9
  else
@@ -4,7 +4,8 @@ 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(user.id)
7
+ resource.cubicle_element_ids << element_id
8
+ resource.excluded_user_id_for_element_id[element_id] = user.id if exclude_current_user?
8
9
  else
9
10
  reject
10
11
  end
@@ -13,6 +14,16 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
13
14
  def unsubscribed
14
15
  return unless resource.present?
15
16
 
17
+ resource.cubicle_element_ids.remove(element_id)
18
+ resource.excluded_user_id_for_element_id.delete(element_id)
19
+ disappear
20
+ end
21
+
22
+ def appear
23
+ resource.present_users.add(user.id)
24
+ end
25
+
26
+ def disappear
16
27
  resource.present_users.remove(user.id)
17
28
  end
18
29
 
@@ -26,4 +37,16 @@ class Cubism::PresenceChannel < ActionCable::Channel::Base
26
37
  def user
27
38
  GlobalID::Locator.locate_signed(params[:user])
28
39
  end
40
+
41
+ def exclude_current_user?
42
+ params[:exclude_current_user]
43
+ end
44
+
45
+ def element_id
46
+ params[:element_id]
47
+ end
48
+
49
+ def url
50
+ params[:url]
51
+ end
29
52
  end
@@ -18,10 +18,10 @@ module Cubism
18
18
  view_context = Cubism.store[block_key].context
19
19
  html = view_context.capture(users_for(resource, element_id), &block)
20
20
 
21
- cable_ready[Cubism::PresenceChannel].inner_html(
21
+ cable_ready[element_id].inner_html(
22
22
  selector: "cubicle-element##{element_id}[identifier='#{signed_stream_identifier(resource.to_global_id.to_s)}']",
23
23
  html: html
24
- ).broadcast_to(resource)
24
+ ).broadcast
25
25
  end
26
26
  end
27
27
 
@@ -1,3 +1,5 @@
1
+ require "cable_ready"
2
+
1
3
  module Cubism
2
4
  class Broadcaster
3
5
  include CableReady::Broadcaster
@@ -1,3 +1,3 @@
1
1
  module Cubism
2
- VERSION = "0.1.0.pre5"
2
+ VERSION = "0.1.0.pre6"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Cubism
2
- VERSION = "0.1.0.pre4"
2
+ VERSION = "0.1.0.pre5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cubism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre5
4
+ version: 0.1.0.pre6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-16 00:00:00.000000000 Z
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails