ultimate_turbo_modal 1.6.0 → 1.7.0

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: 19886fb7dd818b59f8aad64fa2c917783e690d63797761b63dd2ef4422ef119a
4
- data.tar.gz: a1c5449b028638a5b7d39b2ea7707accf037d402fc1361ffc8d075b28181bde4
3
+ metadata.gz: d0dc2045f3ba7b76dd83c90130c780c4b3dbd4ecc7500e0d0e12e877ff200f26
4
+ data.tar.gz: 60aa5ecb836ebf21241493d1cb11072f6713650cf13f8818a254e3c3eadbc72c
5
5
  SHA512:
6
- metadata.gz: 8395f4d9a00f83fffcdb0293a967867b52a00e74ad3716bab49b5923f8c541e9a953246f3196abc434ddccc0daa3c8868caf78c6d915154b978ead3900628bc2
7
- data.tar.gz: 17f6c1e20e67e8447fc41f3cbe708d4a2899acf9fcdfbd8ea753960c8daeb2789c572acbc9ee107b6524472ac2e78c1cb77d4b3b18cafa7911028c9336b801e4
6
+ metadata.gz: 2b99ee6d886121bf9a3b483a117dc32f9395be41012da13444ad3890ed1c778c57754bd57b8b2808c28cceae34c1bd16f4e8505c6fb32d422cfe12ae8cd31d5e
7
+ data.tar.gz: 968c2f42bef6103f5b7a4b64bffcaf4ff84c281e9014cbabdbfe9d59ac6609e2953b7cc43852be6550617a08afcd4f07b0b951788c8563dc093e67c0d9952ac3
data/.tool-versions CHANGED
@@ -1,2 +1,2 @@
1
- ruby 3.2.0
1
+ ruby 3.3.0
2
2
  nodejs 18.9.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [1.7.0] - 2024-12-28
2
+
3
+ - Fix Phlex deprecation warning
4
+
5
+ ## [1.6.1] - 2024-01-10
6
+
7
+ - Added ability to specify data attributes for the content div within the modal. Useful to specify a Stimulus controller, for example.
8
+
1
9
  ## [1.6.0] - 2023-12-25
2
10
 
3
11
  - Support for Ruby 3.3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ultimate_turbo_modal (1.6.0)
4
+ ultimate_turbo_modal (1.7.0)
5
5
  phlex-rails (>= 1.0, < 2.0)
6
6
  rails (>= 7)
7
7
  stimulus-rails
@@ -130,7 +130,7 @@ GEM
130
130
  net-smtp (0.4.0)
131
131
  net-protocol
132
132
  nio4r (2.5.9)
133
- nokogiri (1.15.4-arm64-darwin)
133
+ nokogiri (1.16.0-arm64-darwin)
134
134
  racc (~> 1.4)
135
135
  parallel (1.23.0)
136
136
  parser (3.2.2.4)
@@ -146,7 +146,7 @@ GEM
146
146
  zeitwerk (~> 2.6)
147
147
  psych (5.1.1.1)
148
148
  stringio
149
- racc (1.7.1)
149
+ racc (1.7.3)
150
150
  rack (3.0.8)
151
151
  rack-session (2.0.0)
152
152
  rack (>= 3.0.0)
data/README.md CHANGED
@@ -230,7 +230,7 @@ And the following code to `application.js`:
230
230
  addEventListener("turbo:before-frame-render", (event) => {
231
231
  event.detail.render = (currentElement, newElement) => {
232
232
  Idiomorph.morph(currentElement, newElement, {
233
- morphstyle: 'innerHTML'
233
+ morphStyle: 'innerHTML'
234
234
  })
235
235
  }
236
236
  })
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Phlex
4
4
  module DeferredRenderWithMainContent
5
- def template(&block)
5
+ def view_template(&block)
6
6
  output = capture(&block)
7
7
  super { unsafe_raw(output) }
8
8
  end
@@ -11,6 +11,7 @@ class UltimateTurboModal::Base < Phlex::HTML
11
11
  # @param header_divider [Boolean] Whether to show a divider between the header and the main content
12
12
  # @param padding [Boolean] Whether to add padding around the modal content
13
13
  # @param request [ActionDispatch::Request] The current Rails request object
14
+ # @param content_div_data [Hash] `data` attribute for the div where the modal content will be rendered
14
15
  # @param title [String] The title of the modal
15
16
  def initialize(
16
17
  advance: UltimateTurboModal.configuration.advance,
@@ -22,6 +23,7 @@ class UltimateTurboModal::Base < Phlex::HTML
22
23
  header: UltimateTurboModal.configuration.header,
23
24
  header_divider: UltimateTurboModal.configuration.header_divider,
24
25
  padding: UltimateTurboModal.configuration.padding,
26
+ content_div_data: nil,
25
27
  request: nil, title: nil
26
28
  )
27
29
  @advance = !!advance
@@ -34,6 +36,7 @@ class UltimateTurboModal::Base < Phlex::HTML
34
36
  @header = header
35
37
  @header_divider = header_divider
36
38
  @padding = padding
39
+ @content_div_data = content_div_data
37
40
  @request = request
38
41
  @title = title
39
42
 
@@ -46,7 +49,7 @@ class UltimateTurboModal::Base < Phlex::HTML
46
49
  end
47
50
  end
48
51
 
49
- def template(&block)
52
+ def view_template(&block)
50
53
  if turbo_frame?
51
54
  turbo_frame_tag("modal") do
52
55
  modal(&block)
@@ -70,7 +73,7 @@ class UltimateTurboModal::Base < Phlex::HTML
70
73
 
71
74
  private
72
75
 
73
- attr_accessor :request, :allowed_click_outside_selector
76
+ attr_accessor :request, :allowed_click_outside_selector, :content_div_data
74
77
 
75
78
  def padding? = !!@padding
76
79
 
@@ -164,11 +167,12 @@ class UltimateTurboModal::Base < Phlex::HTML
164
167
  end
165
168
 
166
169
  def div_inner(&block)
167
- div(id: "modal-inner", class: self.class::DIV_INNER_CLASSES, &block)
170
+ div(id: "modal-inner", class: self.class::DIV_INNER_CLASSES, data: content_div_data, &block)
168
171
  end
169
172
 
170
173
  def div_content(&block)
171
- div(id: "modal-content", class: self.class::DIV_CONTENT_CLASSES, data: {modal_target: "content"}, &block)
174
+ data = (content_div_data || {}).merge({modal_target: "content"})
175
+ div(id: "modal-content", class: self.class::DIV_CONTENT_CLASSES, data:, &block)
172
176
  end
173
177
 
174
178
  def div_main(&block)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UltimateTurboModal
4
- VERSION = "1.6.0"
4
+ VERSION = "1.7.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultimate_turbo_modal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Mercier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-25 00:00:00.000000000 Z
11
+ date: 2024-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex-rails
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 3.4.1
127
+ rubygems_version: 3.5.7
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: UTMR aims to be the be-all and end-all of Turbo Modals.