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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eea06d5f7f409a050c8ab276951527339aff43908982b4877c47a71de28bfaf6
4
- data.tar.gz: 588cdb9a1b4e27bc6bb192f17eda678abfc58c0a9538f25c030331682630a377
3
+ metadata.gz: d648dcd53d5b73daa45fcd1762e4fcbbff04f23f4a1bba3ac12dddf8afc307fe
4
+ data.tar.gz: cad308cde28cf3bb0768f10b55e22f4d12ae6f5fa688b624515ddef5950e7df2
5
5
  SHA512:
6
- metadata.gz: 2599ffd51032afaeea169def98bea6bb72e521433ffa4717d5ce2c8f7bdda94f13679789e47873182ae4383e351fcab5b131cb4e20545cdf6ccbc57700ab8525
7
- data.tar.gz: 0ff0eb7dec6ab092c8e512420a49a9be2024e23e5577240d67c769b9bea2770238254ad7d8a3d6b9b61e9e9af2b19df1db56a756f0bde5d91a3c4a7d4e63654f
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
  [![Gem Version](https://badge.fury.io/rb/moderntw_confirms.svg)](https://badge.fury.io/rb/moderntw_confirms)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
+ ![ModerntwConfirms demo](demo.gif)
9
+
8
10
  ## Features
9
11
 
10
12
  - **Zero Configuration** - Works with your existing Rails code immediately
@@ -1,5 +1,5 @@
1
1
  <% config = ModerntwConfirms.config %>
2
- <% enable_on_mobile = config.fetch(:enable_on_mobile, false) %>
2
+ <% enable_on_mobile = config.enable_on_mobile %>
3
3
 
4
4
  <div id="moderntw-confirm-modal"
5
5
  class="hidden fixed inset-0 z-[99999] overflow-y-auto"
@@ -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[:backdrop_class] = "bg-black bg-opacity-50"
6
+ config.backdrop_class = "bg-black bg-opacity-50"
7
7
 
8
8
  # Modal container classes
9
- config[:modal_class] = "bg-white rounded-lg shadow-xl"
9
+ config.modal_class = "bg-white rounded-lg shadow-xl"
10
10
 
11
11
  # Confirm button classes
12
- config[:confirm_button_class] = "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded"
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[:cancel_button_class] = "bg-gray-300 hover:bg-gray-400 text-gray-800 font-semibold py-2 px-4 rounded"
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[:delete_confirm_button_class] = "bg-red-500 hover:bg-red-600 text-white font-semibold py-2 px-4 rounded"
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[:enable_on_mobile] = true
23
+ # config.enable_on_mobile = true
24
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ModerntwConfirms
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
@@ -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
- mattr_accessor :config
12
- self.config = {
13
- backdrop_class: "bg-black bg-opacity-50",
14
- modal_class: "bg-white rounded-lg shadow-xl",
15
- confirm_button_class: "bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded",
16
- cancel_button_class: "bg-gray-300 hover:bg-gray-400 text-gray-800 font-semibold py-2 px-4 rounded",
17
- enable_on_mobile: false
18
- }
19
-
20
- def self.configure
21
- yield config
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.0
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-10-24 00:00:00.000000000 Z
11
+ date: 2025-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails