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 +4 -4
- data/lib/locomotive/mongoid/patches.rb +22 -0
- data/lib/locomotive/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: a6acc9d2e0d4cd3e9cf7d3f8e67c1821bb63d727a95494b6f67d3b417a21d36f
|
4
|
+
data.tar.gz: 8c57132ce3fb4c4a2d0fb057a8c5b2cb290dabe8a98d00540afef80c732ce4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/locomotive/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|