stimulus_reflex 3.4.0.pre7 → 3.4.0.pre8
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.
Potentially problematic release.
This version of stimulus_reflex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -3
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/stimulus_reflex/reflex.rb +5 -4
- data/lib/stimulus_reflex/version.rb +1 -1
- data/package.json +1 -1
- data/test/reflex_test.rb +26 -0
- data/test/tmp/app/reflexes/demo_reflex.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2431b50e027a8144cd11458b3de85f9b09bbfac0e3929eee35f3dc62134c742a
|
4
|
+
data.tar.gz: e766e76490781882ff539785408ebf48c3f9ef931d09c6322c87900c079ad857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2168b3fb2da302b53ce7c4010fad3f5fb83e8a129ab83c6dcd45e0638d2c3e8deebdbfdc7dde43197b143c73bee9703b1fe3b3406a73731a887122f28b04d89
|
7
|
+
data.tar.gz: ea440d1c4ff00a93ab3574042b793406fd470c9c49205a9d9c3106b2cae78718217aa5e4b70d8024ff5db3a130476ac55a2f8117018bb700203e595164e2277f
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,19 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/hopsoft/stimulus_reflex/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.
|
5
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre7...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- DirectUpload URL not set using morphs [\#396](https://github.com/hopsoft/stimulus_reflex/issues/396)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Delegate render to controller [\#397](https://github.com/hopsoft/stimulus_reflex/pull/397) ([hopsoft](https://github.com/hopsoft))
|
14
|
+
|
15
|
+
## [v3.4.0.pre7](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre7) (2020-12-01)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre6...v3.4.0.pre7)
|
6
18
|
|
7
19
|
**Closed issues:**
|
8
20
|
|
@@ -86,6 +98,7 @@
|
|
86
98
|
- Add guard clause to return valid empty form data [\#354](https://github.com/hopsoft/stimulus_reflex/pull/354) ([julianrubisch](https://github.com/julianrubisch))
|
87
99
|
- simplify xpath functions [\#353](https://github.com/hopsoft/stimulus_reflex/pull/353) ([leastbad](https://github.com/leastbad))
|
88
100
|
- pass reflex id to reflex [\#352](https://github.com/hopsoft/stimulus_reflex/pull/352) ([joshleblanc](https://github.com/joshleblanc))
|
101
|
+
- Fix page morphs inside Rails engines [\#344](https://github.com/hopsoft/stimulus_reflex/pull/344) ([leastbad](https://github.com/leastbad))
|
89
102
|
|
90
103
|
## [v3.4.0.pre2](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre2) (2020-11-06)
|
91
104
|
|
@@ -133,7 +146,6 @@
|
|
133
146
|
**Merged pull requests:**
|
134
147
|
|
135
148
|
- \[docs\] StimulusReflex.debug= on left hand side [\#348](https://github.com/hopsoft/stimulus_reflex/pull/348) ([drnic](https://github.com/drnic))
|
136
|
-
- Fix page morphs inside Rails engines [\#344](https://github.com/hopsoft/stimulus_reflex/pull/344) ([leastbad](https://github.com/leastbad))
|
137
149
|
- Use Webpacker folder if available [\#343](https://github.com/hopsoft/stimulus_reflex/pull/343) ([coorasse](https://github.com/coorasse))
|
138
150
|
- feat: create a more robust package.json [\#340](https://github.com/hopsoft/stimulus_reflex/pull/340) ([ParamagicDev](https://github.com/ParamagicDev))
|
139
151
|
- Make StimulusReflex configurable and add an initializer [\#339](https://github.com/hopsoft/stimulus_reflex/pull/339) ([RolandStuder](https://github.com/RolandStuder))
|
@@ -395,6 +407,7 @@
|
|
395
407
|
- Loosen Rails requirement to 5.2 with instructions [\#205](https://github.com/hopsoft/stimulus_reflex/pull/205) ([jasoncharnes](https://github.com/jasoncharnes))
|
396
408
|
- Fix undefined is not an object for Object.keys in log.js [\#201](https://github.com/hopsoft/stimulus_reflex/pull/201) ([marcoroth](https://github.com/marcoroth))
|
397
409
|
- Small typo/grammar fix in quickstart doc. [\#198](https://github.com/hopsoft/stimulus_reflex/pull/198) ([acoffman](https://github.com/acoffman))
|
410
|
+
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
398
411
|
- 147 extract multiple checkbox values [\#175](https://github.com/hopsoft/stimulus_reflex/pull/175) ([julianrubisch](https://github.com/julianrubisch))
|
399
412
|
|
400
413
|
## [v3.2.1](https://github.com/hopsoft/stimulus_reflex/tree/v3.2.1) (2020-05-09)
|
@@ -446,7 +459,6 @@
|
|
446
459
|
|
447
460
|
**Merged pull requests:**
|
448
461
|
|
449
|
-
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
450
462
|
- Some housekeeping [\#189](https://github.com/hopsoft/stimulus_reflex/pull/189) ([hopsoft](https://github.com/hopsoft))
|
451
463
|
- Allow to call stimulate without a reflex target [\#188](https://github.com/hopsoft/stimulus_reflex/pull/188) ([marcoroth](https://github.com/marcoroth))
|
452
464
|
- Fix bug in super documentation [\#174](https://github.com/hopsoft/stimulus_reflex/pull/174) ([silva96](https://github.com/silva96))
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
|
12
12
|
</a>
|
13
13
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
|
14
|
-
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-
|
14
|
+
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1600-brightgreen.svg?style=flat" />
|
15
15
|
</a>
|
16
16
|
<a href="https://docs.stimulusreflex.com/" target="_blank">
|
17
17
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
@@ -49,9 +49,10 @@ class StimulusReflex::Reflex
|
|
49
49
|
alias_method :action_name, :method_name # for compatibility with controller libraries like Pundit that expect an action name
|
50
50
|
|
51
51
|
delegate :connection, :stream_name, to: :channel
|
52
|
-
delegate :flash, :session, to: :request
|
52
|
+
delegate :controller_class, :flash, :session, to: :request
|
53
53
|
delegate :broadcast, :broadcast_message, to: :broadcaster
|
54
54
|
delegate :reflex_id, :reflex_controller, :xpath, :c_xpath, :permanent_attribute_name, to: :client_attributes
|
55
|
+
delegate :render, to: :controller_class
|
55
56
|
|
56
57
|
def initialize(channel, url: nil, element: nil, selectors: [], method_name: nil, params: {}, client_attributes: {})
|
57
58
|
@channel = channel
|
@@ -114,11 +115,11 @@ class StimulusReflex::Reflex
|
|
114
115
|
|
115
116
|
def controller
|
116
117
|
@controller ||= begin
|
117
|
-
|
118
|
+
controller_class.new.tap do |c|
|
118
119
|
c.instance_variable_set :"@stimulus_reflex", true
|
119
120
|
instance_variables.each { |name| c.instance_variable_set name, instance_variable_get(name) }
|
120
|
-
c.
|
121
|
-
c.
|
121
|
+
c.set_request! request
|
122
|
+
c.set_response! controller_class.make_response!(request)
|
122
123
|
end
|
123
124
|
end
|
124
125
|
end
|
data/package.json
CHANGED
data/test/reflex_test.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class StimulusReflex::ReflexTest < ActionCable::Channel::TestCase
|
4
|
+
tests StimulusReflex::Channel
|
5
|
+
|
6
|
+
setup do
|
7
|
+
stub_connection(session_id: SecureRandom.uuid)
|
8
|
+
def connection.env
|
9
|
+
@env ||= {}
|
10
|
+
end
|
11
|
+
@reflex = StimulusReflex::Reflex.new(subscribe, url: "https://test.stimulusreflex.com")
|
12
|
+
@reflex.controller_class.view_paths << Rails.root.join("test/views")
|
13
|
+
end
|
14
|
+
|
15
|
+
test "render plain" do
|
16
|
+
assert @reflex.render(plain: "Some text") == "Some text"
|
17
|
+
end
|
18
|
+
|
19
|
+
test "render template" do
|
20
|
+
assert @reflex.render("/hello_template", assigns: {message: "Testing 123"}) == "<p>Hello from template! Testing 123</p>\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
test "render partial" do
|
24
|
+
assert @reflex.render(partial: "/hello_partial", assigns: {message: "Testing 123"}) == "<p>Hello from partial! Testing 123</p>\n"
|
25
|
+
end
|
26
|
+
end
|
@@ -16,6 +16,7 @@ class DemoReflex < ApplicationReflex
|
|
16
16
|
# - signed - use a signed Global ID to map dataset attribute to a model eg. element.signed[:foo]
|
17
17
|
# - unsigned - use an unsigned Global ID to map dataset attribute to a model eg. element.unsigned[:foo]
|
18
18
|
# - cable_ready - a special cable_ready that can broadcast to the current visitor (no brackets needed)
|
19
|
+
# - reflex_id - a UUIDv4 that uniquely identies each Reflex
|
19
20
|
#
|
20
21
|
# Example:
|
21
22
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus_reflex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.0.
|
4
|
+
version: 3.4.0.pre8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- test/broadcasters/page_broadcaster_test.rb
|
202
202
|
- test/broadcasters/selector_broadcaster_test.rb
|
203
203
|
- test/generators/stimulus_reflex_generator_test.rb
|
204
|
+
- test/reflex_test.rb
|
204
205
|
- test/test_helper.rb
|
205
206
|
- test/tmp/app/reflexes/application_reflex.rb
|
206
207
|
- test/tmp/app/reflexes/demo_reflex.rb
|
@@ -238,6 +239,7 @@ signing_key:
|
|
238
239
|
specification_version: 4
|
239
240
|
summary: Build reactive applications with the Rails tooling you already know and love.
|
240
241
|
test_files:
|
242
|
+
- test/reflex_test.rb
|
241
243
|
- test/test_helper.rb
|
242
244
|
- test/generators/stimulus_reflex_generator_test.rb
|
243
245
|
- test/tmp/app/reflexes/demo_reflex.rb
|