render_turbo_stream 1.4.10 → 1.4.11

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: 64b60c79e4190078560e1f08d175acfe17563316c6bf6079401841e9ac316198
4
- data.tar.gz: 42d0f14d62ad08acb537658b2b83b113297e464da77ac95a33d41b9667e6da6a
3
+ metadata.gz: 6aaffdee6cb866e03e20f1b6d46e00d187e9f7a63b0d5f26c29b4615fae7b483
4
+ data.tar.gz: b031dbf2eac68543ddf75de146c58715abaf3e6c6e9852119e3beb4f049832cc
5
5
  SHA512:
6
- metadata.gz: b47e40f983bff09126f2307f0b3f40e64a16132899cdb032573b4fcfa6ab1f9fb01256a8237eb15b17ce0c1e250a25e2e9f18af7efbdc14fd94f2ca4882c5b5c
7
- data.tar.gz: 4e0c932e70b68297d69aecdda5259abc5bcd11e0c355c9c12b27dcda204d656f90680b97b5bff2472cda64d9828d0b51c9cadf3e58415acf155f034407a9a95d
6
+ metadata.gz: cec6a8701b17aabe2d76006771bd0441f28617a80bc16e9987d5334c84742d5df93471a7fb89d474b071fa2bd4f2391c78ea96abc3d8da8bc206198cf0268f64
7
+ data.tar.gz: 77afb83d8a217eca87b53cfa0aee768cdd8272052540758976c266d72f7d532119e9260473d761743b57de64e252ba41c48ef927685ee90122a0ee0300749a46
data/README.md CHANGED
@@ -48,7 +48,7 @@ config.x.render_turbo_stream.flash_id = 'flash-box'
48
48
  config.x.render_turbo_stream.flash_action = 'prepend'
49
49
  ```
50
50
 
51
- The corresponding partials for flashes could look [like this](https://gitlab.com/sedl/renderturbostream/-/wikis/flashes)
51
+ The corresponding partials for flashes could look [like this](https://gitlab.com/sedl/renderturbostream/-/wikis/Flashes-example)
52
52
 
53
53
  **Translations**
54
54
 
@@ -142,13 +142,12 @@ Under the hood, inside a `*.turbo_stream.erb` template, it does the following: `
142
142
 
143
143
  **WORKAROUND for redirects inside frame**
144
144
 
145
- Suppose you have a CRUD controller that should do all its actions inside a turbo frame. Classic redirect_to, along with a Flash message, would raise «Render and/or redirect were called multiple times in this action». See [issue](https://gitlab.com/sedl/renderturbostream/-/issues/3).
145
+ Suppose you have a CRUD controller that should do all its actions inside a turbo frame. Classic redirect_to, together with a turbo_stream action on the same response, would raise «Render and/or redirect were called multiple times in this action». See [issue](https://gitlab.com/sedl/renderturbostream/-/issues/3).
146
146
 
147
- You can handle this by reloading the parent frame's src attribute. The code might look like this:
147
+ A workaround is to use the src attribute of the parent frame. `turbo_frame_set_src` comes from turbo_power. The code could look like this:
148
148
 
149
149
  ```ruby
150
150
  def update
151
- @car = Car.find(params['id'])
152
151
  turbo_stream_save(
153
152
  @car.update(car_params),
154
153
  streams_on_success: [
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "1.4.10"
2
+ VERSION = "1.4.11"
3
3
  end
@@ -159,10 +159,9 @@ module RenderTurboStream
159
159
 
160
160
  ary = []
161
161
  array.each do |pr|
162
- if !pr.present?
163
- a = 1
164
- elsif pr.is_a?(Hash)
162
+ if pr.is_a?(Hash)
165
163
  props = pr.symbolize_keys
164
+ raise "missing attribute :id in #{props}" if !props[:id].present?
166
165
  part = (props[:partial].present? ? props[:partial] : props[:id]).gsub('-', '_')
167
166
  partial = (part.to_s.include?('/') ? part : [controller_path, part].join('/'))
168
167
  r = props
@@ -170,6 +169,7 @@ module RenderTurboStream
170
169
  r[:partial] = partial
171
170
  ary.push(r)
172
171
  elsif pr.is_a?(Array)
172
+ raise "array has to contain at least one element: #{pr}" unless pr.first.present?
173
173
  ary.push(pr)
174
174
  else
175
175
  raise "ERROR render_turbo_stream invalid type: Only hash or array allowed"
@@ -289,7 +289,7 @@ module RenderTurboStream
289
289
  :append,
290
290
  :prepend
291
291
  ]
292
- (config.present? ? config : default).map{|m|m.to_sym}.include?(method.to_sym)
292
+ (config.present? ? config : default).map { |m| m.to_sym }.include?(method.to_sym)
293
293
  end
294
294
 
295
295
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_turbo_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.10
4
+ version: 1.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian