rearmed_rails 1.0.4 → 1.0.5
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 +2 -0
- data/lib/rearmed_rails/monkey_patches/rails/helpers.rb +10 -32
- data/lib/rearmed_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d2e1474fe0711ea54cf256d3954b9254c4e8e01
|
4
|
+
data.tar.gz: 26d6c3cb7c20f65d5568019d4be2c4335af2dabe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 461717a406c59c914ad5f66fa2955efb0678aaf8926a315d733a41f134f40dfaab46433f3a923beec00dc947b626ccd2aa1def8bdfb1f841033af074f6105547
|
7
|
+
data.tar.gz: aa3ce67201167bf2ba223043118fb992db82300c277c021ca14c87d76b3f90daa6aaed0ef19d5200aa63afe935a1581afb06df69efb24a3c4851968806ef829b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
---------
|
3
3
|
|
4
|
+
- **1.0.5 - August 3, 2017**
|
5
|
+
- Fix `options_for_select_include_blank` & `options_for_select_include_blank` for Rails 5.1+ and improved them to patch in safer way
|
4
6
|
- **1.0.4 - July 19, 2017**
|
5
7
|
- Fix error in `find_duplicates` method
|
6
8
|
- **1.0.3 - May 3, 2017**
|
@@ -55,57 +55,35 @@ if defined?(ActionView::Helpers)
|
|
55
55
|
|
56
56
|
if enabled || RearmedRails.dig(RearmedRails.enabled_patches, :rails, :helpers, :options_for_select_include_blank)
|
57
57
|
def options_for_select(container, selected = nil)
|
58
|
-
return container if String === container
|
59
|
-
|
60
58
|
if selected.is_a?(Hash)
|
61
59
|
include_blank = selected[:include_blank] || selected['include_blank']
|
62
60
|
end
|
63
61
|
|
64
|
-
|
65
|
-
Array(r).map(&:to_s)
|
66
|
-
end
|
67
|
-
|
68
|
-
options = []
|
62
|
+
options = super
|
69
63
|
|
70
64
|
if include_blank
|
71
65
|
include_blank = '' if include_blank == true
|
72
|
-
options.push(content_tag_string(:option, include_blank, {value: ''}))
|
73
|
-
end
|
74
66
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
html_attributes[:disabled] ||= disabled && option_value_selected?(value, disabled)
|
81
|
-
html_attributes[:value] = value
|
67
|
+
if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 1
|
68
|
+
str = tag_builder.content_tag_string(:option, include_blank, {value: ''})
|
69
|
+
else
|
70
|
+
str = content_tag_string(:option, include_blank, {value: ''})
|
71
|
+
end
|
82
72
|
|
83
|
-
options.
|
73
|
+
options.prepend(str)
|
84
74
|
end
|
85
75
|
|
86
|
-
options
|
76
|
+
options
|
87
77
|
end
|
88
78
|
end
|
89
79
|
|
90
|
-
if enabled || RearmedRails.dig(RearmedRails.enabled_patches, :rails, :helpers, :
|
80
|
+
if enabled || RearmedRails.dig(RearmedRails.enabled_patches, :rails, :helpers, :options_for_select_include_blank)
|
91
81
|
def options_from_collection_for_select(collection, value_method, text_method, selected = nil)
|
92
82
|
options = collection.map do |element|
|
93
83
|
[value_for_collection(element, text_method), value_for_collection(element, value_method), option_html_attributes(element)]
|
94
84
|
end
|
95
85
|
|
96
|
-
|
97
|
-
include_blank = selected[:include_blank] || selected['include_blank']
|
98
|
-
end
|
99
|
-
|
100
|
-
selected, disabled = extract_selected_and_disabled(selected)
|
101
|
-
|
102
|
-
select_deselect = {
|
103
|
-
selected: extract_values_from_collection(collection, value_method, selected),
|
104
|
-
disabled: extract_values_from_collection(collection, value_method, disabled),
|
105
|
-
include_blank: include_blank
|
106
|
-
}
|
107
|
-
|
108
|
-
options_for_select(options, select_deselect)
|
86
|
+
options_for_select(options, selected)
|
109
87
|
end
|
110
88
|
end
|
111
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rearmed_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weston Ganger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|