light_scroll 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f420eb8d8596e2e15828abc6627cdf655617f31a
4
+ data.tar.gz: 88f050dcf10d5f877e71f13dfd7916274d84a9fc
5
+ SHA512:
6
+ metadata.gz: 260147b3477028cb147982d2a7df499f78c8edfbdedb0cf647aef844b0df565a86af48702bd47aa79e4f64aa3c0d78507ef86bd599bf80e085f03c239b1e58b1
7
+ data.tar.gz: 6ca88ff92b5e4d4c465aa4f68a25d3d0a5826caf4a9fd90695a99a9bac43e59917cc36aade87113d19d27c3df8191b7a7919390fce6c9c3d95a1da18a743671c
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'railties'
4
+
5
+ group :development do
6
+ gem "rspec", '~> 2.10', '> 2.10.0'
7
+ gem "rdoc", '~> 4.0', '> 4.0.0'
8
+ gem "bundler", '~> 1.2', '> 1.2.0'
9
+ gem "jeweler", '~> 1.8', '> 1.8.4'
10
+ gem "simplecov",'~> 0.5'
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,99 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ abstract (1.0.0)
5
+ actionpack (3.0.8)
6
+ activemodel (= 3.0.8)
7
+ activesupport (= 3.0.8)
8
+ builder (~> 2.1.2)
9
+ erubis (~> 2.6.6)
10
+ i18n (~> 0.5.0)
11
+ rack (~> 1.2.1)
12
+ rack-mount (~> 0.6.14)
13
+ rack-test (~> 0.5.7)
14
+ tzinfo (~> 0.3.23)
15
+ activemodel (3.0.8)
16
+ activesupport (= 3.0.8)
17
+ builder (~> 2.1.2)
18
+ i18n (~> 0.5.0)
19
+ activesupport (3.0.8)
20
+ addressable (2.3.5)
21
+ builder (2.1.2)
22
+ diff-lcs (1.2.5)
23
+ erubis (2.6.6)
24
+ abstract (>= 1.0.0)
25
+ faraday (0.8.7)
26
+ multipart-post (~> 1.1)
27
+ git (1.2.5)
28
+ github_api (0.10.1)
29
+ addressable
30
+ faraday (~> 0.8.1)
31
+ hashie (>= 1.2)
32
+ multi_json (~> 1.4)
33
+ nokogiri (~> 1.5.2)
34
+ oauth2
35
+ hashie (2.0.5)
36
+ highline (1.6.19)
37
+ httpauth (0.2.0)
38
+ i18n (0.5.0)
39
+ jeweler (1.8.6)
40
+ builder
41
+ bundler (~> 1.0)
42
+ git (>= 1.2.5)
43
+ github_api (= 0.10.1)
44
+ highline (>= 1.6.15)
45
+ nokogiri (= 1.5.10)
46
+ rake
47
+ rdoc
48
+ json (1.8.1)
49
+ jwt (0.1.8)
50
+ multi_json (>= 1.5)
51
+ multi_json (1.10.1)
52
+ multi_xml (0.5.4)
53
+ multipart-post (1.2.0)
54
+ nokogiri (1.5.10)
55
+ oauth2 (0.9.2)
56
+ faraday (~> 0.8)
57
+ httpauth (~> 0.2)
58
+ jwt (~> 0.1.4)
59
+ multi_json (~> 1.0)
60
+ multi_xml (~> 0.5)
61
+ rack (~> 1.2)
62
+ rack (1.2.8)
63
+ rack-mount (0.6.14)
64
+ rack (>= 1.0.0)
65
+ rack-test (0.5.7)
66
+ rack (>= 1.0)
67
+ railties (3.0.8)
68
+ actionpack (= 3.0.8)
69
+ activesupport (= 3.0.8)
70
+ rake (>= 0.8.7)
71
+ thor (~> 0.14.4)
72
+ rake (10.1.1)
73
+ rdoc (4.1.2)
74
+ json (~> 1.4)
75
+ rspec (2.13.0)
76
+ rspec-core (~> 2.13.0)
77
+ rspec-expectations (~> 2.13.0)
78
+ rspec-mocks (~> 2.13.0)
79
+ rspec-core (2.13.1)
80
+ rspec-expectations (2.13.0)
81
+ diff-lcs (>= 1.1.3, < 2.0)
82
+ rspec-mocks (2.13.0)
83
+ simplecov (0.7.1)
84
+ multi_json (~> 1.0)
85
+ simplecov-html (~> 0.7.1)
86
+ simplecov-html (0.7.1)
87
+ thor (0.14.6)
88
+ tzinfo (0.3.37)
89
+
90
+ PLATFORMS
91
+ ruby
92
+
93
+ DEPENDENCIES
94
+ bundler (~> 1.2, > 1.2.0)
95
+ jeweler (~> 1.8, > 1.8.4)
96
+ railties
97
+ rdoc (~> 4.0, > 4.0.0)
98
+ rspec (~> 2.10, > 2.10.0)
99
+ simplecov (~> 0.5)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Dileep Nandanam
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,23 @@
1
+ module LightScroll
2
+ module Rails
3
+ # add vendor/assets to Rails asset pipeline
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+
8
+ module ActionView
9
+ def light_scroll(collection, path, params)
10
+ params[:page] = params[:page].present? ? params[:page].to_i + 1 : 2
11
+ if collection.next_page
12
+ %{
13
+
14
+ <div class="more-items">
15
+ <a class="view-more" data-remote="true" href="#{path}?#{params.permit(params.keys).to_hash.map{|k,v| "#{k}=#{v}"}.join("&")}" />
16
+ </div>
17
+
18
+ }.html_safe
19
+ end
20
+ end
21
+ ::ActionView::Base.send :include, self
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "light_scroll"
3
+ s.version = "0.2.0"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.require_paths = ["lib"]
7
+ s.authors = ["Dileep Nandanam"]
8
+ s.date = "2014-11-20"
9
+ s.description = "Tiny infinite scroll gem"
10
+ s.email = "dileepsnandanam@gmail.com"
11
+ s.extra_rdoc_files = [
12
+ "LICENSE.txt"
13
+ ]
14
+ s.files = [
15
+ "Gemfile",
16
+ "Gemfile.lock",
17
+ "LICENSE.txt",
18
+ "VERSION",
19
+ "lib/light_scroll.rb",
20
+ "light_scroll.gemspec",
21
+ "vendor/assets/javascripts/light_scroll/light_scroll.js"
22
+ ]
23
+ s.homepage = "http://github.com/dileepnandanam/light_scroll"
24
+ s.licenses = ["MIT"]
25
+ s.rubygems_version = "2.2.2"
26
+ s.summary = "Use light_scroll with rails asset pipeline"
27
+ end
28
+
@@ -0,0 +1,16 @@
1
+ initLightScroll = function() {
2
+ window.onscroll = function() {
3
+ if($(window).height() + 600 + document.documentElement.scrollTop > $('body').height()) {
4
+ Rails.fire($('.view-more')[0], 'click')
5
+ }
6
+ }
7
+ $(document).on('ajax:success', '.view-more', function(e) {
8
+ $(this).closest('.more-items').replaceWith(e.detail[2].responseText)
9
+ })
10
+ }
11
+ $(document).on('turbolinks:load', function() {
12
+ initLightScroll()
13
+ })
14
+ $(document).ready(function(){
15
+ initLightScroll()
16
+ })
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: light_scroll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Dileep Nandanam
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Tiny infinite scroll gem
14
+ email: dileepsnandanam@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files:
18
+ - LICENSE.txt
19
+ files:
20
+ - Gemfile
21
+ - Gemfile.lock
22
+ - LICENSE.txt
23
+ - VERSION
24
+ - lib/light_scroll.rb
25
+ - light_scroll.gemspec
26
+ - vendor/assets/javascripts/light_scroll/light_scroll.js
27
+ homepage: http://github.com/dileepnandanam/light_scroll
28
+ licenses:
29
+ - MIT
30
+ metadata: {}
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubyforge_project:
47
+ rubygems_version: 2.5.2
48
+ signing_key:
49
+ specification_version: 4
50
+ summary: Use light_scroll with rails asset pipeline
51
+ test_files: []