moderntw_confirms 1.1.0 → 1.1.1
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +2 -0
- data/lib/generators/moderntw_confirms/install/templates/_moderntw_confirms_modal.html.erb +1 -1
- data/lib/generators/moderntw_confirms/install/templates/moderntw_confirms.rb +6 -6
- data/lib/moderntw_confirms/version.rb +1 -1
- data/lib/moderntw_confirms.rb +26 -13
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d648dcd53d5b73daa45fcd1762e4fcbbff04f23f4a1bba3ac12dddf8afc307fe
|
|
4
|
+
data.tar.gz: cad308cde28cf3bb0768f10b55e22f4d12ae6f5fa688b624515ddef5950e7df2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc13da07aa0c8f4730d6e1c84f961fb01cabccce571ed7d283942d9ad563c46fcbfda9f7f31a00fe73a206cdd12033dedfe5d81a4163f1a6844f8930aa8d507b
|
|
7
|
+
data.tar.gz: 9013a015eb6f1a740dc603dba016f4e2431f0d8eaf0678692ae4760eab8108716814578faf1729bbe0bfed1129f1f1e7c0176132c9c05f9ebdd8b0f5a32ae7f4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.1] - 2025-01-04
|
|
3
4
|
|
|
5
|
+
### Changed
|
|
6
|
+
- **BREAKING (but backwards compatible)**: Refactored configuration to use accessor methods instead of hash keys
|
|
7
|
+
- Old syntax: `config[:backdrop_class] = "..."`
|
|
8
|
+
- New syntax: `config.backdrop_class = "..."`
|
|
9
|
+
- The old hash-based syntax is still supported via the `config` alias for backwards compatibility
|
|
10
|
+
- Removed dependency on ActiveSupport's `mattr_accessor`
|
|
4
11
|
|
|
5
12
|
## [1.1.0] - 2024-05-xx
|
|
6
13
|
- Default to native confirms on mobile with optional opt-in via config[:enable_on_mobile]
|
data/README.md
CHANGED
|
@@ -5,6 +5,8 @@ Beautiful Tailwind CSS confirmation modals for Rails applications. Drop-in repla
|
|
|
5
5
|
[](https://badge.fury.io/rb/moderntw_confirms)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
+

|
|
9
|
+
|
|
8
10
|
## Features
|
|
9
11
|
|
|
10
12
|
- **Zero Configuration** - Works with your existing Rails code immediately
|
|
@@ -3,22 +3,22 @@ ModerntwConfirms.configure do |config|
|
|
|
3
3
|
# These are the default values - modify them to match your design system
|
|
4
4
|
|
|
5
5
|
# Background overlay classes
|
|
6
|
-
config
|
|
6
|
+
config.backdrop_class = "bg-black bg-opacity-50"
|
|
7
7
|
|
|
8
8
|
# Modal container classes
|
|
9
|
-
config
|
|
9
|
+
config.modal_class = "bg-white rounded-lg shadow-xl"
|
|
10
10
|
|
|
11
11
|
# Confirm button classes
|
|
12
|
-
config
|
|
12
|
+
config.confirm_button_class = "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded"
|
|
13
13
|
|
|
14
14
|
# Cancel button classes
|
|
15
|
-
config
|
|
15
|
+
config.cancel_button_class = "bg-gray-300 hover:bg-gray-400 text-gray-800 font-semibold py-2 px-4 rounded"
|
|
16
16
|
|
|
17
17
|
# You can also add custom classes for specific use cases:
|
|
18
18
|
# For delete confirmations, you might want red buttons:
|
|
19
|
-
# config
|
|
19
|
+
# config.delete_confirm_button_class = "bg-red-500 hover:bg-red-600 text-white font-semibold py-2 px-4 rounded"
|
|
20
20
|
|
|
21
21
|
# Use Tailwind modal confirms on mobile devices (defaults to native mobile confirms)
|
|
22
22
|
# Set to true if you prefer the custom modal experience on phones and tablets
|
|
23
|
-
# config
|
|
23
|
+
# config.enable_on_mobile = true
|
|
24
24
|
end
|
data/lib/moderntw_confirms.rb
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "active_support/core_ext/module/attribute_accessors"
|
|
4
|
-
|
|
5
3
|
require_relative "moderntw_confirms/version"
|
|
6
4
|
require_relative "moderntw_confirms/engine" if defined?(Rails)
|
|
7
5
|
|
|
8
6
|
module ModerntwConfirms
|
|
9
7
|
class Error < StandardError; end
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
class Configuration
|
|
10
|
+
attr_accessor :backdrop_class, :modal_class, :confirm_button_class,
|
|
11
|
+
:cancel_button_class, :enable_on_mobile
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
@backdrop_class = "bg-black bg-opacity-50"
|
|
15
|
+
@modal_class = "bg-white rounded-lg shadow-xl"
|
|
16
|
+
@confirm_button_class = "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded"
|
|
17
|
+
@cancel_button_class = "bg-gray-300 hover:bg-gray-400 text-gray-800 font-semibold py-2 px-4 rounded"
|
|
18
|
+
@enable_on_mobile = false
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class << self
|
|
23
|
+
attr_writer :configuration
|
|
24
|
+
|
|
25
|
+
def configuration
|
|
26
|
+
@configuration ||= Configuration.new
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def configure
|
|
30
|
+
yield configuration
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Alias for backwards compatibility
|
|
34
|
+
alias_method :config, :configuration
|
|
22
35
|
end
|
|
23
36
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moderntw_confirms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Ciubotaru
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|