corn_starch 1.3.11 → 1.3.12

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: 30fdf76f314fe608b6895c22fc64c318bf70ce5e
4
- data.tar.gz: 2188d16b000a339e1c9a4bf4e9e8588db4ed8169
3
+ metadata.gz: a5fde93c833724e8c8a589f6a5690c65deaaa5aa
4
+ data.tar.gz: 2551d3a504e747318e6b2a97b5684246f8700a68
5
5
  SHA512:
6
- metadata.gz: 4c9c9945807fe22b490f5f03ce3e7aa909c01607e53412d134ccbca23b05e4d9cc22f1ebdfcb4ec06cf623d4ee6ac8906b4c09a31c1e7099c026d65bfffa2082
7
- data.tar.gz: 9dfb90d4b97d933587ee8f0e1176b548fa5115a12f5f985c3b0dfee5f16dbb9e5c5d195922e84b61f737afd3928d90c116ca658cb27d2ca30c54900e4b290b1f
6
+ metadata.gz: ebe73f80998d95c556933bab0ec7a459426d614dba7ff032451c1d17342838cc6f7c30f91a386ef67d16b585c8cbde3407e02188271caddc1892293d94bffdf2
7
+ data.tar.gz: 79e99f5753c7bceb984895f6485570318a833a12145cd6a03cd67810e8dd25ab389f463f6ee9e6855d82bfef8f55dcb03e695a5acf86dc71cc08bee1cd5cbe68
@@ -75,6 +75,9 @@ module CornStarch
75
75
  @infiniscroll ||= {}
76
76
  @infiniscroll[:params] ||= {}
77
77
 
78
+ # Compute Next
79
+ @infiniscroll[:next] = (@pagination[:current] < (@pagination[:pg_count] - 1)) ? @pagination[:current] + 1 : :none
80
+
78
81
  # Set Search
79
82
  @infiniscroll[:params][:search] = params[:search] if params[:search]
80
83
 
@@ -117,6 +120,11 @@ module CornStarch
117
120
  paginate unisearch(model, params[:search]), params
118
121
  end
119
122
 
123
+ # Render InfiniScroll Data
124
+ def infiniscroll_data template
125
+ { json: { next: @infiniscroll[:next], content: render_to_string(template, layout: false) } }
126
+ end
127
+
120
128
  # Universal Search
121
129
  def unisearch model, search
122
130
 
@@ -8,21 +8,21 @@ module CornStarch
8
8
  module InfiniscrollHelper
9
9
 
10
10
  # InfiniScroll Container
11
- def infiniscroll_container id, params, target, n = 1, &block
11
+ def infiniscroll_container id, target, n = 1, &block
12
12
 
13
13
  # Prep Args
14
14
  first = true
15
15
  args = ''
16
16
 
17
17
  # Include Search Params
18
- if params[:search]
19
- args = args + (first ? '?' : '&') + "search=#{params[:search]}"
18
+ if @infiniscroll[:params][:search]
19
+ args = args + (first ? '?' : '&') + "search=#{@infiniscroll[:params][:search]}"
20
20
  first = false
21
21
  end
22
22
 
23
23
  # Include Pagination - Records Per Page
24
- if params[:records_per_page]
25
- args = args + (first ? '?' : '&') + "records_per_page=#{params[:records_per_page]}"
24
+ if @infiniscroll[:params][:records_per_page]
25
+ args = args + (first ? '?' : '&') + "records_per_page=#{@infiniscroll[:params][:records_per_page]}"
26
26
  first = false
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module CornStarch
2
- VERSION = '1.3.11'
2
+ VERSION = '1.3.12'
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.3.11
4
+ version: 1.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse