effective_bootstrap 0.9.44 → 0.9.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/form_input.rb +16 -1
- data/lib/effective_bootstrap/version.rb +1 -1
- 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: 33fc32e5f8a20002ec07cc4cab552f7bd2e7386b162ce3043b9d2ba73771d2cb
|
4
|
+
data.tar.gz: d28055c2b76376a8efb83c2d89632883c4c599ccca5b5337eabb42f1242d8e6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b748f7cabd901caa3b9626c5bf4a0bc5d00cbc8269c8db15b809708895ac4e08104ec9f75cdf0dd5da0314c8182d882212beedb1aaf9ef72e0c9db43ad8dc0dc
|
7
|
+
data.tar.gz: 6c8259a2cf99443611d197da78129382d1a6c4f870d7678458bf71a49f3ed60cbc64c7c8876482fa93244fdb2b139cb9396af4b8276fa0b858d25431cfad766f
|
@@ -371,7 +371,22 @@ module Effective
|
|
371
371
|
when String
|
372
372
|
defaults.merge(text: obj)
|
373
373
|
when Hash
|
374
|
-
obj.
|
374
|
+
html_classes = ((obj[:class] || '').split(' ') + (defaults[:class] || '').split(' ')).uniq
|
375
|
+
|
376
|
+
# Try to smart merge bootstrap classes
|
377
|
+
if (exclusive = html_classes.select { |c| c.include?('-') }).length > 1
|
378
|
+
EXCLUSIVE_CLASS_PREFIXES.each do |prefix|
|
379
|
+
prefixed = exclusive.select { |c| c.start_with?(prefix) }
|
380
|
+
prefixed[1..-1].each { |c| html_classes.delete(c) } if prefixed.length > 1
|
381
|
+
end
|
382
|
+
|
383
|
+
suffixed = exclusive.select { |c| EXCLUSIVE_CLASS_SUFFIXES.any? { |suffix| c.end_with?(suffix) } }
|
384
|
+
suffixed[1..-1].each { |c| html_classes.delete(c) } if suffixed.length > 1
|
385
|
+
end
|
386
|
+
|
387
|
+
obj[:class] = html_classes.join(' ') if html_classes.present?
|
388
|
+
obj.reverse_merge!(defaults)
|
389
|
+
obj
|
375
390
|
else
|
376
391
|
defaults.merge(text: obj.to_s)
|
377
392
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|