effective_bootstrap 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 59f67d24c6020d651984c5a19fd6a2a37799d9aa
4
- data.tar.gz: d7692884900ceda644145005adebf7501255e826
3
+ metadata.gz: 1c73961161d3573b8a086dceedd1b2b97b5c51d5
4
+ data.tar.gz: 3e73d0c2f628c120064355648474901ccf88d401
5
5
  SHA512:
6
- metadata.gz: c33c48755459bda98cac1b5d7de09d4ba8ed2ba840e94479ebfadcb17e9685cf3907ac8d5f6e9d1790c2f2cfe1eec950b92054deddce1e063dc4357a146aabc1
7
- data.tar.gz: 5a1097b3e04168ac251618daa95b2299ec6e6c90c823c3175fc36a105b653648442051bb32a438c1639d9d6ecdaaa2fb14474d5d2797a876f94d676896357241
6
+ metadata.gz: f50b617e235e67f29da29399ab37e460af5daa2310fbbc9dcbc2b58b6fb8e10fb1be4acaba8f97d226a50ce30c568e1f0ce6af5ab8f5beeed029139e04c7f5ea
7
+ data.tar.gz: 475fc4f1332c039099623dbdfb011d1105b361b651dca036f59ae9f0a879a88161c47ea2c80a40ac2959f60a914886b0b810879fc33465c8b4b8e6939f943574
@@ -126,7 +126,20 @@ module Effective
126
126
  return BLANK if options[:label] == false
127
127
  return BLANK if name.kind_of?(NilClass)
128
128
 
129
- text = (options[:label].delete(:text) || (object.class.human_attribute_name(name) if object) || BLANK)
129
+ text = options[:label].delete(:text)
130
+ name_to_s = name.to_s
131
+
132
+ text ||= (
133
+ if object && name_to_s.ends_with?('_id')
134
+ object.class.human_attribute_name(name_to_s.chomp('_id'))
135
+ elsif object && name_to_s.ends_with?('_ids')
136
+ object.class.human_attribute_name(name_to_s.chomp('_ids').pluralize)
137
+ elsif object
138
+ object.class.human_attribute_name(name)
139
+ else
140
+ BLANK
141
+ end
142
+ )
130
143
 
131
144
  if options[:input][:id]
132
145
  options[:label][:for] = options[:input][:id]
@@ -153,7 +153,7 @@ module Effective
153
153
 
154
154
  def cards? # default false
155
155
  return @cards unless @cards.nil?
156
- @cards= (options.delete(:cards) || false)
156
+ @cards = (options.delete(:cards) || false)
157
157
  end
158
158
 
159
159
  def button_group_id
@@ -59,7 +59,8 @@ module Effective
59
59
 
60
60
  def multiple?
61
61
  return @multiple unless @multiple.nil?
62
- @multiple = (options.delete(:multiple) || false) || tags?
62
+
63
+ @multiple = options.key?(:multiple) ? options.delete(:multiple) : (tags? || name.to_s.ends_with?('_ids'))
63
64
  end
64
65
 
65
66
  def tags?
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  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.2.0
4
+ version: 0.2.1
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: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails