corn_starch 1.2.7 → 1.3.0

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: e8b861eef819c096245fbca543346ea27b8fbf37
4
- data.tar.gz: abbb4acce59ab11524526314d5b10e2639f57226
3
+ metadata.gz: b7aad1d72bcdfd4126b0c1f5127dbfbbf44f1fbd
4
+ data.tar.gz: 4c9309ac8656a5cb0dd56b7f7c874fe4686f1b8c
5
5
  SHA512:
6
- metadata.gz: b7a32619d2d2900f9751854bf5ee6f0b92328176f3cc32d97dd1370d12dde0bfdac1eed034415b03c2ad12eaf1ba40976ed7b7da15f701defac16111c364ed2b
7
- data.tar.gz: 81181019157a421560fd22b68fa239388143d6b216fa8b5900dd88aa93773f4a877d2e7bf3bef2207e08596fd29a4b0e157b4b2b4951c62efcebfc791d8ce33a
6
+ metadata.gz: 9d90d47f012f0da8ba1cd5e8d80a726089b1ce59661fd1f6b9411c2872fedb77fd409750bfb950b7809cb423018fbbb1b6ecfa9149f1720de8d879259fe23204
7
+ data.tar.gz: d0d3a3759049607c5044816ed778693da9379abe3274332ba08f7eaaa4c7cf5793392ad40844da7dd4a1b2b2f75e5fa0748193444ed9b0ba98a648529134dc1f
@@ -0,0 +1,30 @@
1
+ # CornStarch
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # InfiniScroll JS
5
+
6
+ # InfiniScroll
7
+ infiniscroll = (container) ->
8
+
9
+ # Acquire Container
10
+ c = $("##{container}")
11
+
12
+ # Acquire Path & Next
13
+ path = c.attr 'infiniscroll-trgt'
14
+ args = c.attr 'infiniscroll-args'
15
+ next = c.attr 'infiniscroll-next'
16
+
17
+ # Construct URL
18
+ full_path = "#{path}?#{args}&current_page=#{next}"
19
+
20
+ # Fetch Data
21
+ $.ajax(url: full_path).done(data) ->
22
+
23
+ # Parse JSON Data
24
+ data = JSON.parse data
25
+
26
+ # Update Next
27
+ c.attr 'infiniscroll-next', data['next']
28
+
29
+ # Insert Data into Container
30
+ $("##{container}").append data['content']
@@ -11,17 +11,6 @@ module CornStarch
11
11
  extend ActionView::Helpers
12
12
  extend ActionView::Context
13
13
 
14
- # Gravatar Image
15
- def gravatar_img email, size = 64, options = {}
16
- image_tag gravatar_url(email, size), options
17
- end
18
-
19
- # Gravatar URL
20
- def gravatar_url email, size = 64
21
- gravatar_id = Digest::MD5.hexdigest(email.downcase)
22
- "http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
23
- end
24
-
25
14
  # Icon Link
26
15
  def icon_link_to target, icon, extra = nil
27
16
  link_to target, extra do
@@ -0,0 +1,21 @@
1
+ # CornStarch
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # CornStarch Module
5
+ module CornStarch
6
+
7
+ # Gravatar Helper
8
+ module GravatarHelper
9
+
10
+ # Gravatar Image
11
+ def gravatar_img email, size = 64, options = {}
12
+ image_tag gravatar_url(email, size), options
13
+ end
14
+
15
+ # Gravatar URL
16
+ def gravatar_url email, size = 64
17
+ gravatar_id = Digest::MD5.hexdigest(email.downcase)
18
+ "http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,33 @@
1
+ # CornStarch
2
+ # by Eresse <eresse@eresse.net>
3
+
4
+ # CornStarch Module
5
+ module CornStarch
6
+
7
+ # InfiniScroll Helper
8
+ module InfiniscrollHelper
9
+
10
+ # InfiniScroll Container
11
+ def infiniscroll_container id, params, target, n, &block
12
+
13
+ # Prep Args
14
+ first = true
15
+ args = ''
16
+
17
+ # Include Search Params
18
+ if params[:search]
19
+ args = args + (first ? '?' : '&') + "search=#{params[:search]}"
20
+ first = false
21
+ end
22
+
23
+ # Include Pagination - Records Per Page
24
+ if params[:records_per_page]
25
+ args = args + (first ? '?' : '&') + "records_per_page=#{params[:records_per_page]}"
26
+ first = false
27
+ end
28
+
29
+ # Produce Container
30
+ div_tag id: id, 'infiniscroll-trgt' => target, 'infiniscroll-args' => args, 'infiniscroll-next' => n, &block
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module CornStarch
2
- VERSION = '1.2.7'
2
+ VERSION = '1.3.0'
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.2.7
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eresse
@@ -50,9 +50,12 @@ files:
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - Rakefile
53
+ - app/assets/javascripts/corn_starch/infiniscroll.js.coffee
53
54
  - app/controllers/corn_starch/corn_starch_controller.rb
54
55
  - app/controllers/corn_starch/sessions_controller.rb
55
56
  - app/helpers/corn_starch/corn_starch_helper.rb
57
+ - app/helpers/corn_starch/gravatar_helper.rb
58
+ - app/helpers/corn_starch/infiniscroll_helper.rb
56
59
  - app/views/corn_starch/layouts/_notifications.html.erb
57
60
  - app/views/corn_starch/layouts/_pagination.html.erb
58
61
  - bin/console