corn_starch 1.1.31 → 1.1.32

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
  SHA1:
3
- metadata.gz: 3aaf9d2c710d5e3f3ad50059133c12afcef33990
4
- data.tar.gz: 1feb33bf48116b33a722d6f66c77ed8141ff2071
3
+ metadata.gz: 16185f8705ad108d7b8eb20cd2f940542bb96ec2
4
+ data.tar.gz: 6cf6c94a3118a276c713a7963af7d3bda5315b24
5
5
  SHA512:
6
- metadata.gz: 4717bedf7e0c2ccb01c98aea6075ba16f202a399eb3558d3fb15e69a428496f52b1750ba1451ec18d9eb76b31595569b9e29fa859e98e4295bb30e17a8fcde3a
7
- data.tar.gz: 1a44826c405c804e8c83c11703f147b44894ee605f475a47d6f30ec4773e169089db83cdb2cc12961979ddf01fa5888ea3d8dcfc7932c874c91da89780b2997b
6
+ metadata.gz: 0ac8f0d0c6b8525a094eca4a2946c12a9fd2953d9073f9df541034e6e560952c03cfbbc0fec5198b4a3bf853802bb34f4a8a75e11ef2e70546559c1101c277e0
7
+ data.tar.gz: 0f9f90f663b225fba0aae66ac47f7e3409c66ddd1130043ba96299026e0c3c964a68df64c903440ca7836e407bd3d8ab56ccffa0f14fec1297261bf8f30c400c
@@ -50,26 +50,19 @@ module CornStarch
50
50
  def pagination_filter
51
51
 
52
52
  # Create Pagination
53
- @cs_pagination ||= {}
53
+ @pagination ||= {}
54
54
  session[:pagination] ||= {}
55
55
 
56
56
  # Set Records Per Page from Request Arguments
57
57
  session[:pagination][:recs_per_page] = params[:records_per_page].to_i if params[:records_per_page]
58
58
 
59
59
  # Init Pagination Vars
60
- @cs_pagination[:current] = 0
61
- @cs_pagination[:links] = []
62
- @cs_pagination[:pg_count] = 0
63
-
64
- # DEBUG
65
- puts "================== FILTER : #{@cs_pagination.inspect} / #{session.inspect} / #{CORNSTARCH_CONF.inspect}"
60
+ @pagination[:current] = 0
61
+ @pagination[:links] = []
62
+ @pagination[:pg_count] = 0
66
63
 
67
64
  # Acquire Records per Page from Session / Configuration
68
- @cs_pagination[:recs_per_page] = (session[:pagination][:recs_per_page] || CORNSTARCH_CONF[:pagination][:records_per_page][:default]).to_i
69
-
70
- # DEBUG
71
- puts "================== FILTER2 : #{@cs_pagination.inspect}"
72
-
65
+ @pagination[:recs_per_page] = (session[:pagination][:recs_per_page] || CORNSTARCH_CONF[:pagination][:records_per_page][:default]).to_i
73
66
  end
74
67
 
75
68
  ##################
@@ -104,7 +97,7 @@ module CornStarch
104
97
 
105
98
  # Get Records
106
99
  def get_records model, params
107
- cs_paginate unisearch(model, params[:search]), params
100
+ paginate unisearch(model, params[:search]), params
108
101
  end
109
102
 
110
103
  # Universal Search
@@ -153,30 +146,27 @@ module CornStarch
153
146
  end
154
147
 
155
148
  # Paginate
156
- def cs_paginate collection, params
149
+ def paginate collection, params
157
150
 
158
151
  # Acquire Current Page
159
152
  current = (params[:current_page] || 0).to_i
160
153
 
161
154
  # Compute Page Count
162
155
  total = collection.count
163
- @cs_pagination[:pg_count] = (total / @cs_pagination[:recs_per_page]) + (((total % @cs_pagination[:recs_per_page]) > 0) ? 1 : 0)
164
-
165
- # DEBUG
166
- puts "================== PAGINATION : #{@cs_pagination.inspect}"
156
+ @pagination[:pg_count] = (total / @pagination[:recs_per_page]) + (((total % @pagination[:recs_per_page]) > 0) ? 1 : 0)
167
157
 
168
158
  # Compute Page Range
169
159
  range_start = current - (CORNSTARCH_CONF[:pagination][:page_range] / 2)
170
160
  range_start = 0 if range_start < 0
171
161
  range_end = current + (CORNSTARCH_CONF[:pagination][:page_range] / 2)
172
- range_end = @cs_pagination[:pg_count] - 1 if range_end >= @cs_pagination[:pg_count]
162
+ range_end = @pagination[:pg_count] - 1 if range_end >= @pagination[:pg_count]
173
163
 
174
164
  # Create Page Links
175
- @cs_pagination[:links] = range_start .. range_end
176
- @cs_pagination[:current] = current
165
+ @pagination[:links] = range_start .. range_end
166
+ @pagination[:current] = current
177
167
 
178
168
  # Fetch Records
179
- collection.limit(@cs_pagination[:recs_per_page]).offset current * @cs_pagination[:recs_per_page]
169
+ collection.limit(@pagination[:recs_per_page]).offset current * @pagination[:recs_per_page]
180
170
  end
181
171
 
182
172
  # Generic Notice Messages
@@ -14,9 +14,6 @@ CORNSTARCH_CONF = YAML::load_file CORNSTARCH_CONF_FILE if File.exist? CORNSTARCH
14
14
  CORNSTARCH_CONF ||= {}
15
15
  CORNSTARCH_CONF.deep_symbolize_keys!
16
16
 
17
- # DEBUG
18
- puts "=========== CONFIG (loaded from file) : #{CORNSTARCH_CONF.inspect}"
19
-
20
17
  ######################
21
18
  # Configure Defaults #
22
19
  ######################
@@ -1,3 +1,3 @@
1
1
  module CornStarch
2
- VERSION = '1.1.31'
2
+ VERSION = '1.1.32'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corn_starch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.31
4
+ version: 1.1.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse