corn_starch 1.3.11 → 1.3.12
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5fde93c833724e8c8a589f6a5690c65deaaa5aa
|
4
|
+
data.tar.gz: 2551d3a504e747318e6b2a97b5684246f8700a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
|
data/lib/corn_starch/version.rb
CHANGED