tramway-core 1.17.7 → 1.17.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/tramway/core/inputs_helper.rb +20 -19
- data/lib/tramway/core/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: ace598a77cdbc2c4227978563ee8e51f86751e38114e19322e1a4dae06185d41
|
4
|
+
data.tar.gz: a5f1e7e9a031f55a34427ac989dd81d504c71c7835c6c729c3871e5b6d49e829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bd0649874a75ba26c56c6babf43ac53599feeee708f07b16259cdfe4b69f51a2537669ec01749457d9df8ab77646c57c0da6902197bcc01899efead8cf89ca5
|
7
|
+
data.tar.gz: bd713b69cabb604ad37404bb73daf1f046cf13833ff4e2442fc0ba34c570695fc169da7074380bb972cc5026e52d7f21d7a0289b2df5bf1bfe4be6116807209e
|
@@ -19,9 +19,9 @@ module Tramway::Core::InputsHelper
|
|
19
19
|
options: options.merge(
|
20
20
|
as: :select,
|
21
21
|
label_method: ->(obj) { "#{obj.class.model_name.human} | #{obj.name}" },
|
22
|
-
value_method: lambda
|
22
|
+
value_method: lambda { |obj|
|
23
23
|
"#{obj.class.to_s.underscore.sub(/_decorator$/, '')}_#{obj.id}"
|
24
|
-
|
24
|
+
}
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
@@ -63,27 +63,28 @@ module Tramway::Core::InputsHelper
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def simple_params(**options)
|
66
|
-
builded_options = {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
66
|
+
builded_options = { as: options[:type], label: false,
|
67
|
+
input_html: {
|
68
|
+
name: "#{options[:object]}[#{options[:property]}]",
|
69
|
+
id: "#{options[:object]}_#{options[:property]}",
|
70
|
+
value: build_simple_value(
|
71
|
+
*options.values_at(:form_object, :property, :value),
|
72
|
+
options.dig(:options, :input_html, :value)
|
73
|
+
)
|
74
|
+
} }
|
75
|
+
merge_with_user_options builded_options, options
|
76
|
+
end
|
77
|
+
|
78
|
+
def build_simple_value(form_object, property, value, input_html_value)
|
79
|
+
value_to_add = input_html_value || value
|
80
|
+
value_to_add || form_object.send(property)
|
81
|
+
end
|
82
|
+
|
83
|
+
def merge_with_user_options(builded_options, options)
|
78
84
|
if options[:options].present?
|
79
85
|
options[:options].dig(:input_html)&.delete(:value)
|
80
86
|
builded_options.merge!(options) || {}
|
81
87
|
end
|
82
88
|
builded_options
|
83
89
|
end
|
84
|
-
|
85
|
-
def build_simple_value(form_object, property, value, input_html_value)
|
86
|
-
value_to_add = input_html_value ? input_html_value : value
|
87
|
-
value_to_add || form_object.send(property)
|
88
|
-
end
|
89
90
|
end
|
data/lib/tramway/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.17.7
|
4
|
+
version: 1.17.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: audited
|