caboose-cms 0.3.51 → 0.3.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWQ1MzE3NDYzYTI1Mzg1Njg4ZTVkYWJiZjQ5MGNmNmNjZjg5ZWU0YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjMyYzUxYjI5Mjk1MjJiZWZlYTk0NzJjNWUzZWJkMjZjODA0ZTFlOQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmNmZGRkNzVmNzkxZDVhNTJlYThiMzQyMDIxNGVmNmNkOThiNDg4YTNmMGFh
|
10
|
+
NjMyMzQ3MWI5MDg1YzdmMGFjNWI3OWU1YjkyOTRkMTNhOWI3ZTEzNDI5MDJi
|
11
|
+
Y2YwNDNkNDZhZGE0NzMxMjc4ODU3ZjIzYThkNGQwNjJiODljYjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGRlYzNlYjJlZGIxZmUwZjI2YzEwNWU1YWFhM2I3ZTc1NTAxODAzZTg2Y2Qy
|
14
|
+
NjA2MzI5MTI1NTZiMTQ3YTA0ZTUyZGI5ZDM5YmRiZjE5Y2FlNGI4YzM5ZjM2
|
15
|
+
ODNhYjcwYTQwMTg0ZWEzNDJiZDQyNDk3NjE4YTA2MDRkMjE4MGU=
|
@@ -80,28 +80,27 @@ module Caboose
|
|
80
80
|
if @options['sort']
|
81
81
|
@options['sort'].split(',').each do |col|
|
82
82
|
tbl_col = col.split('.')
|
83
|
-
if tbl_col && tbl_col.count > 1
|
84
|
-
@options['includes'].each do |field, arr|
|
85
|
-
associations << arr[0] if table_name_of_association(arr[0]) == tbl_col[0]
|
86
|
-
end
|
87
|
-
end
|
83
|
+
associations << association_for_table_name(tbl_col[0]) if tbl_col && tbl_col.count > 1
|
88
84
|
end
|
89
85
|
end
|
90
86
|
# See if any parameters are listed in a table_name.column_name format
|
91
87
|
@params.each do |k,v|
|
92
88
|
k.split('_concat_').each do |col,v2|
|
93
89
|
tbl_col = col.split('.')
|
94
|
-
if tbl_col && tbl_col.count > 1
|
95
|
-
@options['includes'].each do |field, arr|
|
96
|
-
associations << arr[0] if table_name_of_association(arr[0]) == tbl_col[0]
|
97
|
-
end
|
98
|
-
end
|
90
|
+
associations << association_for_table_name(tbl_col[0]) if tbl_col && tbl_col.count > 1
|
99
91
|
end
|
100
92
|
end
|
101
93
|
associations.uniq.each { |assoc| m = m.includes(assoc) }
|
102
94
|
return m
|
103
95
|
end
|
104
96
|
|
97
|
+
def association_for_table_name(table_name)
|
98
|
+
@options['includes'].each do |field, arr|
|
99
|
+
return arr[0] if table_name_of_association(arr[0]) == table_name
|
100
|
+
end
|
101
|
+
return false
|
102
|
+
end
|
103
|
+
|
105
104
|
def table_name_of_association(assoc)
|
106
105
|
ap assoc
|
107
106
|
return @options['model'].constantize.reflect_on_association(assoc.to_sym).class_name.constantize.table_name
|
@@ -17,5 +17,23 @@ class Caboose::PageBlockFieldValue < ActiveRecord::Base
|
|
17
17
|
#do_not_validate_attachment_file_type :image
|
18
18
|
|
19
19
|
attr_accessible :id, :page_block_id, :page_block_field_id, :value
|
20
|
-
|
20
|
+
|
21
|
+
after_initialize do |fv|
|
22
|
+
# Do whatever we need to do to set the value to be correct for the field type we have.
|
23
|
+
# Most field types are fine with the raw value in the database
|
24
|
+
case fv.page_block_field.field_type
|
25
|
+
when 'checkbox' then fv.value = (fv.value == 1 || fv.value == '1' || fv.value == true ? true : false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
before_save :caste_value
|
30
|
+
def caste_value
|
31
|
+
case self.page_block_field.field_type
|
32
|
+
when 'checkbox'
|
33
|
+
if self.value.nil? then self.value = false
|
34
|
+
else self.value = (self.value == 1 || self.value == '1' || self.value == true ? 1 : 0)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
21
39
|
end
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|