corn_starch 1.1.28 → 1.1.29

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: 8450b658f3a7ed9d59dbf8ed811267587391bbf8
4
- data.tar.gz: c1e4deca76bcf0fb9d81ac881cddeae235a5e6ed
3
+ metadata.gz: c1f37a1cfabdef11f3e988c6d0448845acc95500
4
+ data.tar.gz: 341cbd345a63aebc9b6454c236d4ca5b0cb76a8a
5
5
  SHA512:
6
- metadata.gz: 49f83dac344f3d7f60294d1cfe307295cb0fdd0415aed2b2b4d930b4633e6e67f1f3936bd533fe2b57cd186c02db3e7c7dd69646f8ad9961e802c9223206ec32
7
- data.tar.gz: 8b87cdf328219a7a38c48c09e3057df60c35d8b73561b1e4ac54d3d9152ba9765024e00bde2ba5fc132c94a349df2549a3ec0c138038ee30571384aacfbacab7
6
+ metadata.gz: da221456ae55916d8f5d8153f0831e6d43a24ef660f61973c2a2d5442aaa64fd0231f4cc50647bd412137032693aa1462bcabb56d8df78dacabba917e5270d34
7
+ data.tar.gz: f01e223cb548173fba91fa3b0eb48a4884acbca59346d75d9c392c3e9a06cb647484e16226e0080e6574b86b1b94e1948c13852e9f85fee7582983c4d4bfc9db
@@ -50,21 +50,21 @@ module CornStarch
50
50
  def pagination_filter
51
51
 
52
52
  # Create Pagination
53
- @pagination ||= {}
53
+ @cs_pagination ||= {}
54
54
 
55
55
  # Set Records Per Page from Request Arguments
56
56
  session[:pagination][:recs_per_page] = params[:records_per_page].to_i if params[:records_per_page]
57
57
 
58
58
  # Init Pagination Vars
59
- @pagination[:current] = 0
60
- @pagination[:links] = []
61
- @pagination[:pg_count] = 0
59
+ @cs_pagination[:current] = 0
60
+ @cs_pagination[:links] = []
61
+ @cs_pagination[:pg_count] = 0
62
62
 
63
63
  # Acquire Records per Page from Session / Configuration
64
- @pagination[:recs_per_page] = (session[:pagination][:recs_per_page] || CORNSTARCH_CONF[:pagination][:records_per_page][:default]).to_i
64
+ @cs_pagination[:recs_per_page] = (session[:pagination][:recs_per_page] || CORNSTARCH_CONF[:pagination][:records_per_page][:default]).to_i
65
65
 
66
66
  # DEBUG
67
- puts "================== FILTER : #{@pagination.inspect}"
67
+ puts "================== FILTER : #{@cs_pagination.inspect}"
68
68
 
69
69
  end
70
70
 
@@ -100,7 +100,7 @@ module CornStarch
100
100
 
101
101
  # Get Records
102
102
  def get_records model, params
103
- paginate unisearch(model, params[:search]), params
103
+ cs_paginate unisearch(model, params[:search]), params
104
104
  end
105
105
 
106
106
  # Universal Search
@@ -149,30 +149,30 @@ module CornStarch
149
149
  end
150
150
 
151
151
  # Paginate
152
- def paginate collection, params
152
+ def cs_paginate collection, params
153
153
 
154
154
  # Acquire Current Page
155
155
  current = (params[:current_page] || 0).to_i
156
156
 
157
157
  # Compute Page Count
158
158
  total = collection.count
159
- @pagination[:pg_count] = (total / @pagination[:recs_per_page]) + (((total % @pagination[:recs_per_page]) > 0) ? 1 : 0)
159
+ @cs_pagination[:pg_count] = (total / @cs_pagination[:recs_per_page]) + (((total % @cs_pagination[:recs_per_page]) > 0) ? 1 : 0)
160
160
 
161
161
  # DEBUG
162
- puts "================== PAGINATION : #{@pagination.inspect}"
162
+ puts "================== PAGINATION : #{@cs_pagination.inspect}"
163
163
 
164
164
  # Compute Page Range
165
165
  range_start = current - (CORNSTARCH_CONF[:pagination][:page_range] / 2)
166
166
  range_start = 0 if range_start < 0
167
167
  range_end = current + (CORNSTARCH_CONF[:pagination][:page_range] / 2)
168
- range_end = @pagination[:pg_count] - 1 if range_end >= @pagination[:pg_count]
168
+ range_end = @cs_pagination[:pg_count] - 1 if range_end >= @cs_pagination[:pg_count]
169
169
 
170
170
  # Create Page Links
171
- @pagination[:links] = range_start .. range_end
172
- @pagination[:current] = current
171
+ @cs_pagination[:links] = range_start .. range_end
172
+ @cs_pagination[:current] = current
173
173
 
174
174
  # Fetch Records
175
- collection.limit(@pagination[:recs_per_page]).offset current * @pagination[:recs_per_page]
175
+ collection.limit(@cs_pagination[:recs_per_page]).offset current * @cs_pagination[:recs_per_page]
176
176
  end
177
177
 
178
178
  # Generic Notice Messages
@@ -1,3 +1,3 @@
1
1
  module CornStarch
2
- VERSION = '1.1.28'
2
+ VERSION = '1.1.29'
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.28
4
+ version: 1.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse