render_turbo_stream 1.4.13 → 1.4.14

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: f7bcd60dee638218b100db8304ddda17a1d7c87df5c46d721cb541913a424abc
4
- data.tar.gz: 6e606363c60175378ac3cf4a652560d44e5d3b49d98a77c6a0557ff679df67fa
3
+ metadata.gz: c2c84aacdaefecd60e436ebd13e68801e87d02d3318ded429a643605b2ec94a3
4
+ data.tar.gz: 1b6089600ec4abe349d2cae88a1802f258a535e2303f9289cc29ec0e7c09bf66
5
5
  SHA512:
6
- metadata.gz: e7ca3b5b395709063ebd1c30577280527e064bff16e9dc4bcf114a1a0d1a60bda33bfe105a76f0f497a8fcc39fcf59cc0f877ca05a7688666d228fa577f9d85d
7
- data.tar.gz: 0704ce40c37540bd5135f108668348b4b86fc21cef1d8a5e94ee41a7f5e1da593fd2ec82ea9b3f7e9d7a0c47e8432716cd094beb3dcb1de2e133487d146b047c
6
+ metadata.gz: 83b71f6a084d9da96a09d710bc64c46506a424a8d704838ed0b91b54853cf799d3c1c336c2059bfd23f8ec70581f850c87341bbc03419efe2627c762fee94ff3
7
+ data.tar.gz: a623f4b6acf363a224adfbf4e4e246bec3fcd3f3cc267452ee66bb8bdd6067d0c50a94de45611edbd1640ab25c567d05a9a4853d24d2fbe885a8e2427c336454
@@ -0,0 +1,4 @@
1
+ module RenderTurboStream
2
+ class CableStream < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ class CableStreams < ActiveRecord::Migration[7.0]
2
+ def change
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ class CreateRenderTurboStreamCableStreams < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :render_turbo_stream_cable_streams do |t|
4
+ t.string :request_id, limit: 80
5
+ t.text :locals
6
+ t.string :action, limit: 80
7
+ t.string :arguments
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ module RenderTurboStream
2
+ module TurboCableHelpers
3
+
4
+
5
+ def turbo_cable_to_authenticated
6
+
7
+ end
8
+
9
+ def turbo_cable_to_current_user(target, action, *args, partial: nil, locals: nil)
10
+ if [:append, :prepend, :replace].include?(action.to_sym)
11
+ Turbo::StreamsChannel.send("broadcast_#{action}_to", "current_user_#{helpers.current_user.id}", *args, target: target, partial: partial, locals: locals)
12
+ else
13
+ # Turbo::StreamsChannel.broadcast_action_to(
14
+ # "current_user_#{helpers.current_user.id}",
15
+ # action:'toggle_css_class',
16
+ # 'colored-element'
17
+ # )
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module RenderTurboStream
2
+ module TurboCableViewHelpers
3
+
4
+ def turbo_cable_from_current_user
5
+ if current_user
6
+ turbo_stream_from "current_user_#{current_user.id}"
7
+ end
8
+ end
9
+
10
+ def turbo_cable_from_authenticated_users
11
+ if user_signed_in?
12
+ turbo_stream_from "authenticated_users"
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "1.4.13"
2
+ VERSION = "1.4.14"
3
3
  end
@@ -3,6 +3,8 @@ require "render_turbo_stream/railtie"
3
3
  require 'render_turbo_stream/engine'
4
4
  require 'render_turbo_stream/test/request_helpers'
5
5
  require 'render_turbo_stream/test/rspec_request_helpers'
6
+ require 'render_turbo_stream/turbo_cable_helpers'
7
+ require 'render_turbo_stream/turbo_cable_view_helpers'
6
8
 
7
9
  module RenderTurboStream
8
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_turbo_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.13
4
+ version: 1.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-26 00:00:00.000000000 Z
11
+ date: 2023-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,13 +38,18 @@ files:
38
38
  - README.md
39
39
  - Rakefile
40
40
  - app/controllers/render_turbo_stream/application_controller.rb
41
+ - app/models/render_turbo_stream/cable_stream.rb
41
42
  - app/views/render_turbo_stream.html.erb
42
43
  - app/views/render_turbo_stream.turbo_stream.erb
44
+ - db/migrate/20230428115511_cable_streams.rb
45
+ - db/migrate/20230428115724_create_render_turbo_stream_cable_streams.rb
43
46
  - lib/render_turbo_stream.rb
44
47
  - lib/render_turbo_stream/engine.rb
45
48
  - lib/render_turbo_stream/railtie.rb
46
49
  - lib/render_turbo_stream/test/request_helpers.rb
47
50
  - lib/render_turbo_stream/test/rspec_request_helpers.rb
51
+ - lib/render_turbo_stream/turbo_cable_helpers.rb
52
+ - lib/render_turbo_stream/turbo_cable_view_helpers.rb
48
53
  - lib/render_turbo_stream/version.rb
49
54
  - lib/tasks/render_turbo_stream_tasks.rake
50
55
  homepage: https://gitlab.com/sedl/renderturbostream