simple_form_extension 1.4.4 → 1.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bc4702ff35a135cc1c1edee65f105adfa8d2280
|
4
|
+
data.tar.gz: 9dad68f004f12782e3a75ed7fa16e54a33b29b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eee90d167eab2a47212a42e7cdf9bf7f6e912612f09a57263c15590661727cb349f290e57608c18319160f67cb1bc22745697b7500ca383705cd3721107dd479
|
7
|
+
data.tar.gz: 3e74a498ec1fd53dbee724ead15764cff4d8b736cf64acbf256e52171a7393d70bf55271fadad329b53ad5a1bc55a8c0744268261c7fa72ec2b30b4e8b0db819
|
@@ -8,9 +8,16 @@ module SimpleFormExtension
|
|
8
8
|
|
9
9
|
eager_autoload do
|
10
10
|
autoload :Translations
|
11
|
+
autoload :ResourceNameHelper
|
11
12
|
autoload :Components
|
12
13
|
autoload :Inputs
|
13
14
|
end
|
15
|
+
|
16
|
+
# Allows overriding which methods are used by the fields that try to fetch
|
17
|
+
# the name of a resource to display it instead of calling #to_s
|
18
|
+
#
|
19
|
+
mattr_accessor :resource_name_methods
|
20
|
+
@@resource_name_methods = [:name, :title]
|
14
21
|
end
|
15
22
|
|
16
23
|
SimpleForm::Inputs::Base.send(:include, SimpleFormExtension::Components::Icons)
|
@@ -2,6 +2,7 @@ module SimpleFormExtension
|
|
2
2
|
module Inputs
|
3
3
|
class SelectizeInput < SimpleForm::Inputs::Base
|
4
4
|
include SimpleFormExtension::Translations
|
5
|
+
include SimpleFormExtension::ResourceNameHelper
|
5
6
|
|
6
7
|
# This field only allows local select options (serialized into JSON)
|
7
8
|
# Searching for remote ones will be implemented later.
|
@@ -151,7 +152,7 @@ module SimpleFormExtension
|
|
151
152
|
end
|
152
153
|
|
153
154
|
def name_for(option)
|
154
|
-
|
155
|
+
resource_name_for(option) || option.to_s
|
155
156
|
end
|
156
157
|
|
157
158
|
def relation
|
@@ -190,7 +191,7 @@ module SimpleFormExtension
|
|
190
191
|
end
|
191
192
|
|
192
193
|
def text_from(resource)
|
193
|
-
|
194
|
+
resource_name_for(resource)
|
194
195
|
end
|
195
196
|
|
196
197
|
# Retrieve actual model class even when the form object is a proxy like
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glyph-fr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/simple_form_extension/inputs/selectize_input.rb
|
133
133
|
- lib/simple_form_extension/inputs/slider_input.rb
|
134
134
|
- lib/simple_form_extension/railtie.rb
|
135
|
+
- lib/simple_form_extension/resource_name_helper.rb
|
135
136
|
- lib/simple_form_extension/translations.rb
|
136
137
|
- lib/simple_form_extension/version.rb
|
137
138
|
- simple_form_extension.gemspec
|