locomotivecms 4.2.0.alpha1 → 4.2.0.alpha2

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: 125c005edc4d73f9bcf75bf02e36e36786d47d27a55e3d858afce33ec04eef34
4
- data.tar.gz: e337583e4f49f352c4ff5b1b94cb417cc4845e5483e2e2b184f4164a29ef5d46
3
+ metadata.gz: a6acc9d2e0d4cd3e9cf7d3f8e67c1821bb63d727a95494b6f67d3b417a21d36f
4
+ data.tar.gz: 8c57132ce3fb4c4a2d0fb057a8c5b2cb290dabe8a98d00540afef80c732ce4be
5
5
  SHA512:
6
- metadata.gz: 6ff8971a009e04c1fa4ed523e85a9b940a89c8b5acfef33ab9c5b11d9c69180f8d1ede1c992463e55f14cff967eb575d40d48f92856225fc0b06290168187a94
7
- data.tar.gz: c9b63ae75baa1ede9821cb8b62cf6e27e0a5f7b1b2f4b0350f7a9be932abbfa6fa563251742b3b682f4436e88a672c13aa9e4ebe227d0ca2047f9c02e7ca486a
6
+ metadata.gz: 16670cae9c6cfdc39093965a0c98851dfb44bbacca1f98287ada5bd64d85828cb005c70b4487d9850b85121dfbb44819969e9ad114f1359896230c6bc8e2b469
7
+ data.tar.gz: d347dd0116761ea81390523c57fab97ae9dd5e3f7f3223302f8fb103469992291e8f56da22087e7b28fc4cd6f50c85fa184e2d99330ecf5a19fccdc64a8c2803
@@ -19,6 +19,28 @@ end
19
19
 
20
20
  module Mongoid #:nodoc:
21
21
 
22
+ module Fields
23
+ module ClassMethods
24
+ alias_method :add_field_without_locomotive_patch, :add_field
25
+
26
+ def add_field(name, options = {})
27
+ # FIXME: The Rails ActionView inputs get the value of a field from the <FIELD>_before_type_cast method if it exists.
28
+ # In Mongoid 7, the Mongoid core team implemented the `_before_type_cast?` / `_before_type_cast`
29
+ # for ALL the fields including the localized ones.
30
+ # Incidentally, it breaks the form inputs for localized fields.
31
+ # This patch restores the old behavior for localized fiels by implementing the X_came_from_user? method
32
+ # which makes the form inputs use the translated value of a field.
33
+ generated_methods.module_eval do
34
+ re_define_method("#{name}_came_from_user?") do
35
+ false
36
+ end
37
+ end if options[:localize]
38
+
39
+ add_field_without_locomotive_patch(name, options)
40
+ end
41
+ end
42
+ end
43
+
22
44
  # FIXME: the Origin (used by Steam) and Mongoid gems both modify the Symbol class
23
45
  # to allow writing queries like .where(:position.lt => 1)
24
46
  # By convention, Origin::Key will be the one. So we need to make sure it doesn't
@@ -1,3 +1,3 @@
1
1
  module Locomotive
2
- VERSION = '4.2.0.alpha1'
2
+ VERSION = '4.2.0.alpha2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0.alpha1
4
+ version: 4.2.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-22 00:00:00.000000000 Z
11
+ date: 2024-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails