custom_fields 2.4.0.rc3 → 2.4.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/custom_fields.rb +1 -0
- data/lib/custom_fields/field.rb +1 -1
- data/lib/custom_fields/target.rb +2 -2
- data/lib/custom_fields/types/color.rb +55 -0
- data/lib/custom_fields/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8162bf466478ef2edd666967a9b5b719925456ad
|
4
|
+
data.tar.gz: 663b7c71aa66a5aea37d513b72ef5bcf1df0f56d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8e5465400c8ad36381c687b8466bd1f0f8778e3f06d8b91ee01d85e35c2da46982fb2714503763d9ba843dd96747aaa367982994a375f3e20e7de851b860cc4
|
7
|
+
data.tar.gz: 7d72957c190985562b8a3b92a13c8e8df599b4fd9a3488d4fe4fddff6da63f3f5556821cf67858a889c15add3dc052d87bf80c05bbe7e672096f6efab075860f
|
data/lib/custom_fields.rb
CHANGED
data/lib/custom_fields/field.rb
CHANGED
@@ -6,7 +6,7 @@ module CustomFields
|
|
6
6
|
include ::Mongoid::Timestamps
|
7
7
|
|
8
8
|
AVAILABLE_TYPES = %w(default string text email date date_time boolean file select float integer
|
9
|
-
money tags relationship_default belongs_to has_many many_to_many)
|
9
|
+
money tags color relationship_default belongs_to has_many many_to_many)
|
10
10
|
|
11
11
|
## types ##
|
12
12
|
AVAILABLE_TYPES.each do |type|
|
data/lib/custom_fields/target.rb
CHANGED
@@ -7,8 +7,8 @@ module CustomFields
|
|
7
7
|
included do
|
8
8
|
|
9
9
|
## types ##
|
10
|
-
%w(default string text email date date_time boolean file select
|
11
|
-
|
10
|
+
%w(default string text email date date_time boolean file select
|
11
|
+
float integer money color belongs_to has_many many_to_many tags).each do |type|
|
12
12
|
include "CustomFields::Types::#{type.camelize}::Target".constantize
|
13
13
|
end
|
14
14
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module CustomFields
|
2
|
+
|
3
|
+
module Types
|
4
|
+
|
5
|
+
module Color
|
6
|
+
|
7
|
+
module Field; end
|
8
|
+
|
9
|
+
module Target
|
10
|
+
|
11
|
+
extend ActiveSupport::Concern
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
# Add a color field
|
16
|
+
#
|
17
|
+
# @param [ Class ] klass The class to modify
|
18
|
+
# @param [ Hash ] rule It contains the name of the field and if it is required or not
|
19
|
+
#
|
20
|
+
def apply_color_custom_field(klass, rule)
|
21
|
+
apply_custom_field(klass, rule)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Build a hash storing the raw value for
|
25
|
+
# a color custom field of an instance.
|
26
|
+
#
|
27
|
+
# @param [ Object ] instance An instance of the class enhanced by the custom_fields
|
28
|
+
# @param [ String ] name The name of the color custom field
|
29
|
+
#
|
30
|
+
# @return [ Hash ] field name => raw value
|
31
|
+
#
|
32
|
+
def color_attribute_get(instance, name)
|
33
|
+
self.default_attribute_get(instance, name)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Set the value for the instance and the color field specified by
|
37
|
+
# the 2 params.
|
38
|
+
#
|
39
|
+
# @param [ Object ] instance An instance of the class enhanced by the custom_fields
|
40
|
+
# @param [ String ] name The name of the color custom field
|
41
|
+
# @param [ Hash ] attributes The attributes used to fetch the values
|
42
|
+
#
|
43
|
+
def color_attribute_set(instance, name, attributes)
|
44
|
+
self.default_attribute_set(instance, name, attributes)
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.0.
|
4
|
+
version: 2.4.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06
|
11
|
+
date: 2015-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/custom_fields/target_helpers.rb
|
228
228
|
- lib/custom_fields/types/belongs_to.rb
|
229
229
|
- lib/custom_fields/types/boolean.rb
|
230
|
+
- lib/custom_fields/types/color.rb
|
230
231
|
- lib/custom_fields/types/date.rb
|
231
232
|
- lib/custom_fields/types/date_time.rb
|
232
233
|
- lib/custom_fields/types/default.rb
|
@@ -263,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
264
|
version: '2.4'
|
264
265
|
requirements: []
|
265
266
|
rubyforge_project:
|
266
|
-
rubygems_version: 2.
|
267
|
+
rubygems_version: 2.4.5
|
267
268
|
signing_key:
|
268
269
|
specification_version: 4
|
269
270
|
summary: Custom fields extension for Mongoid.
|