caboose-cms 0.2.44 → 0.2.45
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 +8 -8
- data/app/models/caboose/page_bar_generator.rb +14 -14
- data/app/models/caboose/pager.rb +4 -4
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
Y2MzMzVjYTg4M2Q3NzBhZTZlYTZjYzViYjNiMTJjM2IxYTFmOTU3Mw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YjhkMmUwNzUwYmIyZGFlZDQ4ZjQ3NzRiNjEzYWE5NGYzMjQ1MzRmMw==
|
|
7
7
|
!binary "U0hBNTEy":
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
YzJjOTMwOWRiNzkzYzY2MGFmMjNkMjRhMWNiYzkxZTBkNTIwNjYyNzQ5NTI4
|
|
10
|
+
NmRkNTRmYThmNTRkN2Q3MzQzNDI5YmUxODNhMjBiZGE3NDVlNzExZDQxNDM5
|
|
11
|
+
NDI1ZjIxYzU1OTYwOGNkYjEzNmYzZGY1OGVmYzQxMWUyMmYwMzM=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
OTc2NGFiMDNlMGQ2YTdkOTc3MGI4N2U5N2M3ZjdhNzFiZWM0MTU3MGJlZWUw
|
|
14
|
+
ZDczZGFjMGU5OThlZDU5ZmIxODJlMTQxMTJjYjkwYTNlZjk2ZjI4NDlkMjIz
|
|
15
|
+
YjRkZmVlYWY0MjA3MmNhM2JiNDMzMjEzZGE2M2NiODc1ODdlZTI=
|
|
@@ -24,7 +24,7 @@ module Caboose
|
|
|
24
24
|
@options = {
|
|
25
25
|
'model' => '',
|
|
26
26
|
'sort' => '',
|
|
27
|
-
'desc' =>
|
|
27
|
+
'desc' => 0,
|
|
28
28
|
'base_url' => '',
|
|
29
29
|
'page' => 1,
|
|
30
30
|
'item_count' => 0,
|
|
@@ -33,9 +33,10 @@ module Caboose
|
|
|
33
33
|
params.each { |key, val| @params[key] = val }
|
|
34
34
|
options.each { |key, val| @options[key] = val }
|
|
35
35
|
@params.each { |key, val| @params[key] = post_get[key].nil? ? val : post_get[key] }
|
|
36
|
-
@options.each { |key, val| @options[key] = post_get[key].nil? ? val : post_get[key] }
|
|
36
|
+
@options.each { |key, val| @options[key] = post_get[key].nil? ? val : post_get[key] }
|
|
37
|
+
@options['desc'] = @options['desc'].to_i
|
|
37
38
|
@options['item_count'] = @options['model'].constantize.where(where).count
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def ok(val)
|
|
@@ -52,7 +53,7 @@ module Caboose
|
|
|
52
53
|
return true
|
|
53
54
|
end
|
|
54
55
|
|
|
55
|
-
def items
|
|
56
|
+
def items
|
|
56
57
|
return @options['model'].constantize.where(where).limit(limit).offset(offset).reorder(reorder).all
|
|
57
58
|
end
|
|
58
59
|
|
|
@@ -69,8 +70,6 @@ module Caboose
|
|
|
69
70
|
# Variables to make the search form work
|
|
70
71
|
vars = get_vars()
|
|
71
72
|
page = @options["page"].to_i
|
|
72
|
-
|
|
73
|
-
Caboose.log(@options)
|
|
74
73
|
|
|
75
74
|
# Max links to show (must be odd)
|
|
76
75
|
total_links = 5
|
|
@@ -131,10 +130,10 @@ module Caboose
|
|
|
131
130
|
str = ''
|
|
132
131
|
|
|
133
132
|
# key = sort field, value = text to display
|
|
134
|
-
cols.each do |sort, text|
|
|
135
|
-
desc = @options['sort'] == sort
|
|
136
|
-
arrow = @options['sort'] == sort ? (
|
|
137
|
-
link = @options['base_url'] + "?#{vars}&sort=#{sort}&desc
|
|
133
|
+
cols.each do |sort, text|
|
|
134
|
+
desc = @options['sort'] == sort && @options['desc'] == 1 ? 1 : 0
|
|
135
|
+
arrow = @options['sort'] == sort ? (desc == 1 ? ' ↑' : ' ↓') : ''
|
|
136
|
+
link = @options['base_url'] + "?#{vars}&sort=#{sort}&desc=" + (desc == 1 ? "0" : "1")
|
|
138
137
|
str += "<th><a href='#{link}'>#{text}#{arrow}</a></th>\n"
|
|
139
138
|
end
|
|
140
139
|
return str
|
|
@@ -169,8 +168,7 @@ module Caboose
|
|
|
169
168
|
end
|
|
170
169
|
sql_str = sql.join(' and ')
|
|
171
170
|
sql = [sql_str]
|
|
172
|
-
values.each { |v| sql << v }
|
|
173
|
-
Caboose.log(sql)
|
|
171
|
+
values.each { |v| sql << v }
|
|
174
172
|
return sql
|
|
175
173
|
end
|
|
176
174
|
|
|
@@ -183,10 +181,12 @@ module Caboose
|
|
|
183
181
|
end
|
|
184
182
|
|
|
185
183
|
def reorder
|
|
184
|
+
str = "id"
|
|
186
185
|
if (!@options['sort'].nil? && @options['sort'].length > 0)
|
|
187
|
-
|
|
186
|
+
str = "#{@options['sort']}"
|
|
188
187
|
end
|
|
189
|
-
|
|
188
|
+
str << " desc" if @options['desc'] == 1
|
|
189
|
+
return str
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
end
|
data/app/models/caboose/pager.rb
CHANGED
|
@@ -131,10 +131,10 @@ module Caboose
|
|
|
131
131
|
str = ''
|
|
132
132
|
|
|
133
133
|
# key = sort field, value = text to display
|
|
134
|
-
cols.each do |sort, text|
|
|
135
|
-
|
|
136
|
-
arrow = @options['sort'] == sort ? (
|
|
137
|
-
link = @options['base_url'] + "?#{vars}&sort=#{sort}&desc
|
|
134
|
+
cols.each do |sort, text|
|
|
135
|
+
desc = @options['desc'] ? @options['desc'].to_i : 0
|
|
136
|
+
arrow = @options['sort'] == sort ? (desc ? ' ↑' : ' ↓') : ''
|
|
137
|
+
link = @options['base_url'] + "?#{vars}&sort=#{sort}&desc=" + (desc ? "0" : "1")
|
|
138
138
|
str += "<th><a href='#{link}'>#{text}#{arrow}</a></th>\n"
|
|
139
139
|
end
|
|
140
140
|
return str
|
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.2.
|
|
4
|
+
version: 0.2.45
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- William Barry
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-09-
|
|
11
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|