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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9eefb734f64738208d5ebff801e31274167b6a7332001243b24e0612435e2b16
4
- data.tar.gz: 2d26b33208ea81fb18c347d96e7dc7aecf95e4786121dbc9c834dc4e4f17309f
3
+ metadata.gz: ace598a77cdbc2c4227978563ee8e51f86751e38114e19322e1a4dae06185d41
4
+ data.tar.gz: a5f1e7e9a031f55a34427ac989dd81d504c71c7835c6c729c3871e5b6d49e829
5
5
  SHA512:
6
- metadata.gz: bac5a81a3324c4ce8de46df25a375aceaf7b80acbc1a3cc6f56752db1c8d8fb6c464c268b3c7160e13a24eb116d9ca4a93f1a0ae38f71de344e95152ca69131a
7
- data.tar.gz: 8c1b83417ffdcbcd7c3ed79d5d2312d00357d5d48fe26ef4a351168ac0577f9dd3989df440c15707dad688c67204fd6bc7f5f9bac029fe1d96d04ad5da4a6a19
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 do |obj|
22
+ value_method: lambda { |obj|
23
23
  "#{obj.class.to_s.underscore.sub(/_decorator$/, '')}_#{obj.id}"
24
- end
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
- as: options[:type],
68
- label: false,
69
- input_html: {
70
- name: "#{options[:object]}[#{options[:property]}]",
71
- id: "#{options[:object]}_#{options[:property]}",
72
- value: build_simple_value(
73
- *options.values_at(:form_object, :property, :value),
74
- options.dig(:options, :input_html, :value)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Core
5
- VERSION = '1.17.7'
5
+ VERSION = '1.17.7.1'
6
6
  end
7
7
  end
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-08 00:00:00.000000000 Z
12
+ date: 2020-04-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: audited