ultimate_turbo_modal 3.2.1 → 3.4.0

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.
@@ -8,6 +8,29 @@ require "ultimate_turbo_modal/helpers/stream_helper"
8
8
 
9
9
  module UltimateTurboModal
10
10
  class Railtie < Rails::Railtie
11
+ # Absolute path to the stylesheets shipped with the gem. Exposed so that
12
+ # apps and tooling can locate `ultimate_turbo_modal.css` without guessing.
13
+ def self.stylesheets_path
14
+ File.expand_path("../../app/assets/stylesheets", __dir__)
15
+ end
16
+
17
+ # Make `ultimate_turbo_modal.css` available to the asset pipeline so that
18
+ # `stylesheet_link_tag "ultimate_turbo_modal"` works under Propshaft and
19
+ # Sprockets alike, regardless of whether the app uses importmaps or a
20
+ # JavaScript bundler.
21
+ initializer "ultimate_turbo_modal.assets" do |app|
22
+ next unless app.config.respond_to?(:assets)
23
+ next unless app.config.assets.respond_to?(:paths)
24
+
25
+ app.config.assets.paths << UltimateTurboModal::Railtie.stylesheets_path
26
+
27
+ # Sprockets only precompiles what it is told about; Propshaft compiles
28
+ # everything on its load path and ignores this list.
29
+ if defined?(Sprockets) && app.config.assets.respond_to?(:precompile)
30
+ app.config.assets.precompile << "ultimate_turbo_modal.css"
31
+ end
32
+ end
33
+
11
34
  initializer "ultimate_turbo_modal.action_controller" do
12
35
  ActiveSupport.on_load(:action_controller_base) do
13
36
  include UltimateTurboModal::Helpers::ControllerHelper
@@ -16,6 +16,10 @@ module UltimateTurboModal
16
16
  modal_class.new(**)
17
17
  end
18
18
 
19
+ def confirm(**)
20
+ modal_class.new(confirm: true, **)
21
+ end
22
+
19
23
  def modal_class
20
24
  "UltimateTurboModal::Flavors::#{flavor.to_s.classify}".constantize
21
25
  rescue NameError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultimate_turbo_modal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl Mercier
@@ -139,6 +139,7 @@ files:
139
139
  - Rakefile
140
140
  - UPGRADING.md
141
141
  - VERSION
142
+ - app/assets/stylesheets/ultimate_turbo_modal.css
142
143
  - lefthook.yml
143
144
  - lib/generators/ultimate_turbo_modal/base.rb
144
145
  - lib/generators/ultimate_turbo_modal/install_generator.rb