ajax_pagination 0.5.0 → 0.5.1
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.
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +30 -3
- data/Rakefile +10 -0
- data/ajax_pagination.gemspec +1 -1
- data/lib/ajax_pagination/version.rb +1 -1
- data/lib/generators/ajax_pagination/assets_generator.rb +37 -0
- data/spec/R30PORT +1 -0
- data/spec/ajax_pagination/integration/ajaxpaginate_spec.rb +85 -75
- data/spec/ajax_pagination/integration/rails30_spec.rb +35 -0
- data/spec/rails30_app/.gitignore +8 -0
- data/spec/rails30_app/Gemfile +28 -0
- data/spec/rails30_app/Gemfile.lock +96 -0
- data/spec/rails30_app/Rakefile +7 -0
- data/spec/rails30_app/app/controllers/application_controller.rb +13 -0
- data/spec/rails30_app/app/controllers/changelog_controller.rb +12 -0
- data/spec/rails30_app/app/controllers/pages_controller.rb +28 -0
- data/spec/rails30_app/app/controllers/sessions_controller.rb +9 -0
- data/spec/rails30_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails30_app/app/helpers/posts_helper.rb +2 -0
- data/spec/rails30_app/app/mailers/.gitkeep +0 -0
- data/spec/rails30_app/app/models/.gitkeep +0 -0
- data/spec/rails30_app/app/models/changelog.rb +19 -0
- data/spec/rails30_app/app/views/changelog/_page.html.erb +10 -0
- data/spec/rails30_app/app/views/changelog/index.html.erb +3 -0
- data/spec/rails30_app/app/views/layouts/ajax.html.erb +8 -0
- data/spec/rails30_app/app/views/layouts/application.html.erb +49 -0
- data/spec/rails30_app/app/views/layouts/flash.html.erb +7 -0
- data/spec/rails30_app/app/views/pages/about.html.erb +4 -0
- data/spec/rails30_app/app/views/pages/readme.html.erb +4 -0
- data/spec/rails30_app/app/views/pages/warnings.html.erb +43 -0
- data/spec/rails30_app/app/views/pages/welcome.html.erb +6 -0
- data/spec/rails30_app/app/views/sessions/count.html.erb +7 -0
- data/spec/rails30_app/config.ru +4 -0
- data/spec/rails30_app/config/application.rb +53 -0
- data/spec/rails30_app/config/boot.rb +10 -0
- data/spec/rails30_app/config/database.yml +25 -0
- data/spec/rails30_app/config/environment.rb +6 -0
- data/spec/rails30_app/config/environments/development.rb +25 -0
- data/spec/rails30_app/config/environments/production.rb +43 -0
- data/spec/rails30_app/config/environments/test.rb +30 -0
- data/spec/rails30_app/config/initializers/ajax_pagination.rb +12 -0
- data/spec/rails30_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails30_app/config/initializers/inflections.rb +15 -0
- data/spec/rails30_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails30_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails30_app/config/initializers/session_store.rb +8 -0
- data/spec/rails30_app/config/locales/en.yml +5 -0
- data/spec/rails30_app/config/routes.rb +71 -0
- data/spec/rails30_app/log/.gitkeep +0 -0
- data/spec/rails30_app/public/404.html +26 -0
- data/spec/rails30_app/public/422.html +26 -0
- data/spec/rails30_app/public/500.html +25 -0
- data/spec/rails30_app/public/favicon.ico +0 -0
- data/spec/rails30_app/public/images/ajax-loader.gif +0 -0
- data/spec/rails30_app/public/javascripts/ajax_pagination.js +380 -0
- data/spec/rails30_app/public/javascripts/history.js +4 -0
- data/spec/rails30_app/public/javascripts/history_adapter_jquery.js +77 -0
- data/spec/rails30_app/public/javascripts/history_core.js +1943 -0
- data/spec/rails30_app/public/javascripts/history_html4.js +621 -0
- data/spec/rails30_app/public/javascripts/jquery-ui.js +11767 -0
- data/spec/rails30_app/public/javascripts/jquery-ui.min.js +791 -0
- data/spec/rails30_app/public/javascripts/jquery.ba-bbq.js +18 -0
- data/spec/rails30_app/public/javascripts/jquery.js +9266 -0
- data/spec/rails30_app/public/javascripts/jquery.min.js +4 -0
- data/spec/rails30_app/public/javascripts/jquery.url.js +160 -0
- data/spec/rails30_app/public/javascripts/jquery_ujs.js +373 -0
- data/spec/rails30_app/public/javascripts/json2.js +487 -0
- data/spec/rails30_app/public/stylesheets/ajax_pagination.css +24 -0
- data/spec/rails30_app/public/stylesheets/application.css +12 -0
- data/spec/rails30_app/public/stylesheets/scaffold.css +56 -0
- data/spec/rails30_app/script/rails +6 -0
- data/spec/rails_app/Gemfile.lock +107 -0
- data/spec/spec_helper.rb +16 -1
- metadata +72 -10
- data/spec/rails_app/test/fixtures/posts.yml +0 -9
- data/spec/rails_app/test/functional/posts_controller_test.rb +0 -49
- data/spec/rails_app/test/unit/helpers/posts_helper_test.rb +0 -4
- data/spec/rails_app/test/unit/post_test.rb +0 -7
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## v0.5.1
|
|
2
|
+
* Added generator for assets (so asset pipeline is no longer required).
|
|
3
|
+
* Added tests for a Rails 3.0.x application.
|
|
4
|
+
|
|
1
5
|
## v0.5.0
|
|
2
6
|
This release has no new features, however, it is backwards incompatible because several methods have been renamed for clarity.
|
|
3
7
|
|
data/README.md
CHANGED
|
@@ -7,12 +7,12 @@ Handles AJAX pagination for you, by hooking up the links you want to load conten
|
|
|
7
7
|
|
|
8
8
|
Basically, there is a helper function to use to create a section in your webpage, where content can be changed. Links can reference the section, and thus load new content into it.
|
|
9
9
|
|
|
10
|
-
This gem currently assumes you are using Rails 3.1+, and the assets pipeline for the javascript and css files.
|
|
11
|
-
|
|
12
10
|
For more, see [Introduction and Background](https://github.com/ronalchn/ajax_pagination/wiki/Introduction-and-Background).
|
|
13
11
|
|
|
12
|
+
This gem requires Rails 3.0+. When using the asset pipeline in Rails 3.1+, follow the general installation instructions. Otherwise, use the ajax_pagination:assets generator, which puts the assets into the public/ directory.
|
|
13
|
+
|
|
14
14
|
## Installation
|
|
15
|
-
|
|
15
|
+
Assuming, you are using the asset pipeline, add to your Gemfile:
|
|
16
16
|
|
|
17
17
|
gem 'ajax_pagination'
|
|
18
18
|
|
|
@@ -34,6 +34,33 @@ Then add to your asset manifests,
|
|
|
34
34
|
*/
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
To use this on Rails 3.0, or without using the asset pipeline, read [Installation without the Asset Pipeline](https://github.com/ronalchn/ajax_pagination/wiki/Installing-without-the-Asset-Pipeline) guide.
|
|
38
|
+
|
|
39
|
+
## Basic Usage
|
|
40
|
+
In the ActionView, use ajax_section to declare a section, and ajax_link_to to create a link loading content into the section:
|
|
41
|
+
|
|
42
|
+
```erb
|
|
43
|
+
<%= ajax_link_to "Link", link_url, :pagination => "section_name" %>
|
|
44
|
+
<%= ajax_section :pagination => "section_name", :render => "mypartial" %>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then, in the ActionController, use ajax_respond to render only the partial when an AJAX request is made:
|
|
48
|
+
|
|
49
|
+
```ruby
|
|
50
|
+
Class ObjectsController < ApplicationController
|
|
51
|
+
def index
|
|
52
|
+
...
|
|
53
|
+
respond_to do |format|
|
|
54
|
+
format.html # index.html.erb
|
|
55
|
+
ajax_respond format, :pagination => "section_name", :render => "_mypartial"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
...
|
|
59
|
+
end
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Much more information can be found in the wiki.
|
|
63
|
+
|
|
37
64
|
## Getting Started
|
|
38
65
|
To learn how to use this gem, read one of the usage guides below (found in the wiki):
|
|
39
66
|
|
data/Rakefile
CHANGED
|
@@ -6,6 +6,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
6
6
|
task :travis do
|
|
7
7
|
serverport = IO.read(File.expand_path("../spec/PORT",__FILE__)).strip # port number that we are using
|
|
8
8
|
serverslowport = IO.read(File.expand_path("../spec/SLOWPORT",__FILE__)).strip # port number that we are using
|
|
9
|
+
r30serverport = IO.read(File.expand_path("../spec/R30PORT",__FILE__)).strip # port number that we are using
|
|
9
10
|
|
|
10
11
|
system("cp spec/rails_app/db/development.sqlite3 spec/rails_app/db/test.sqlite3") # take a copy of the development database
|
|
11
12
|
system("mkdir -p spec/rails_app/vendor/assets/javascripts") # directory to plonk javascripts from dependent gems
|
|
@@ -14,15 +15,24 @@ task :travis do
|
|
|
14
15
|
system("cp `bundle show jquery-rails`/vendor/assets/javascripts/* spec/rails_app/vendor/assets/javascripts/")
|
|
15
16
|
system("cp `bundle show jquery-historyjs`/vendor/assets/javascripts/* spec/rails_app/vendor/assets/javascripts/")
|
|
16
17
|
|
|
18
|
+
# recreate assets for rails 3.0 app - delete them first
|
|
19
|
+
system("mkdir -p spec/rails30_app/public/javascripts")
|
|
20
|
+
system("cp `bundle show jquery-rails`/vendor/assets/javascripts/* spec/rails30_app/public/javascripts/")
|
|
21
|
+
system("cp `bundle show jquery-historyjs`/vendor/assets/javascripts/* spec/rails30_app/public/javascripts/")
|
|
22
|
+
system("(cd spec/rails30_app/ && bundle exec rails generate ajax_pagination:assets --force)")
|
|
23
|
+
|
|
17
24
|
# startup test servers
|
|
18
25
|
system("(cd spec/rails_app/ && RAILS_ENV=test bundle exec rails server -d --port=#{serverport})") # daemonized rails server
|
|
19
26
|
system("(cd spec/rails_app/ && RAILS_ENV=test AJAX_DELAY=1.5 bundle exec rails server -d --port=#{serverslowport})") # daemonized rails server
|
|
27
|
+
system("(cd spec/rails30_app/ && RAILS_ENV=test AJAX_DELAY=1.5 bundle exec rails server -d --port=#{r30serverport})") # daemonized rails server
|
|
20
28
|
system("bundle exec rake spec")
|
|
21
29
|
unless $?.exitstatus == 0
|
|
22
30
|
system("kill -9 `lsof -i :#{serverport} -t`") # kills rails server
|
|
23
31
|
system("kill -9 `lsof -i :#{serverslowport} -t`") # kills rails server
|
|
32
|
+
system("kill -9 `lsof -i :#{r30serverport} -t`") # kills rails server
|
|
24
33
|
raise "spec failed!"
|
|
25
34
|
end
|
|
26
35
|
system("kill -9 `lsof -i :#{serverport} -t`") # kills rails server
|
|
27
36
|
system("kill -9 `lsof -i :#{serverslowport} -t`") # kills rails server
|
|
37
|
+
system("kill -9 `lsof -i :#{r30serverport} -t`") # kills rails server
|
|
28
38
|
end
|
data/ajax_pagination.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.add_development_dependency "will_paginate"
|
|
26
26
|
s.add_development_dependency "capybara"
|
|
27
27
|
|
|
28
|
-
s.add_runtime_dependency "rails", '>= 3.
|
|
28
|
+
s.add_runtime_dependency "rails", '>= 3.0'
|
|
29
29
|
s.add_runtime_dependency "jquery-rails", '>= 1.0.17' # require jQuery 1.7+
|
|
30
30
|
s.add_runtime_dependency "jquery-historyjs"
|
|
31
31
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'rails'
|
|
2
|
+
require 'erb'
|
|
3
|
+
|
|
4
|
+
# Supply generator for Rails 3.0.x or if asset pipeline is not enabled
|
|
5
|
+
if true #::Rails.version < "3.1" || !::Rails.application.config.assets.enabled
|
|
6
|
+
module AjaxPagination
|
|
7
|
+
module Generators
|
|
8
|
+
class AssetsGenerator < Rails::Generators::Base
|
|
9
|
+
source_root File.expand_path("../../../../",__FILE__)
|
|
10
|
+
|
|
11
|
+
desc "Fetches the ajax_pagination assets - javascript asset is processed based on current environment"
|
|
12
|
+
|
|
13
|
+
def js
|
|
14
|
+
jstemplate = ERB.new IO.read(File.expand_path("../../../assets/javascripts/ajax_pagination.js.erb",__FILE__))
|
|
15
|
+
|
|
16
|
+
Dir.mkdir("public/javascripts") unless File.exists?("public/javascripts")
|
|
17
|
+
|
|
18
|
+
create_file "public/javascripts/ajax_pagination.js", jstemplate.result(binding)
|
|
19
|
+
copy_file "vendor/assets/javascripts/jquery.ba-bbq.js", "public/javascripts/jquery.ba-bbq.js"
|
|
20
|
+
copy_file "vendor/assets/javascripts/jquery.url.js", "public/javascripts/jquery.url.js"
|
|
21
|
+
end
|
|
22
|
+
def css
|
|
23
|
+
copy_file "lib/assets/stylesheets/ajax_pagination.css", "public/stylesheets/ajax_pagination.css"
|
|
24
|
+
end
|
|
25
|
+
def img
|
|
26
|
+
copy_file "lib/assets/images/ajax-loader.gif", "public/images/ajax-loader.gif"
|
|
27
|
+
end
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def asset_path(filename)
|
|
31
|
+
"/images/" + filename
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
data/spec/R30PORT
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3003
|
|
@@ -1,68 +1,76 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe 'paginating with javascript on', :js => true do
|
|
4
|
+
include Retryable
|
|
5
|
+
|
|
4
6
|
def ajaxCount
|
|
5
7
|
page.evaluate_script("document.getElementById('countajaxloading').innerHTML").to_i # using javascript to get content because selenium cannot get content of non-visible elements
|
|
6
8
|
end
|
|
7
9
|
|
|
8
10
|
it 'displays a loading image' do
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
retry_exceptions do
|
|
12
|
+
# following 3 lines to warm up loading image
|
|
13
|
+
visit("http://localhost:#{SERVERSLOWPORT}") # goes to welcome page
|
|
14
|
+
sleep(3)
|
|
15
|
+
click_link 'Changelog'
|
|
16
|
+
sleep(3)
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
visit("http://localhost:#{SERVERSLOWPORT}") # goes to welcome page
|
|
19
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
20
|
+
sleep(1.5)
|
|
21
|
+
click_link 'About'
|
|
22
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
23
|
+
sleep(1.5)
|
|
24
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
25
|
+
click_link 'Readme'
|
|
26
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
27
|
+
sleep(1.5)
|
|
28
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
29
|
+
end
|
|
26
30
|
end
|
|
27
31
|
it 'displays a loading image with nested and multiple paginated sections' do
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
retry_exceptions do
|
|
33
|
+
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
|
34
|
+
sleep(2)
|
|
35
|
+
page.should have_selector('#changelogpagetitle')
|
|
36
|
+
find('#_paginated_section').find('.next_page').click
|
|
37
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
38
|
+
sleep(1.5)
|
|
39
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
40
|
+
find('#signin').click
|
|
41
|
+
sleep(2)
|
|
42
|
+
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
|
43
|
+
sleep(2)
|
|
44
|
+
page.should have_selector('#postspagetitle')
|
|
45
|
+
find('#page_paginated_section').find('.next_page').click
|
|
46
|
+
sleep(0.5) # failed once on travis rbx without sleep
|
|
47
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
48
|
+
sleep(1.5)
|
|
49
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
50
|
+
find('#upcomingpage_paginated_section').find('.next_page').click
|
|
51
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
52
|
+
sleep(1.5)
|
|
53
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
54
|
+
end
|
|
48
55
|
end
|
|
49
56
|
it 'shows the configured loading image' do
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
retry_exceptions do
|
|
58
|
+
# warmup images
|
|
59
|
+
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
|
60
|
+
find('#page_paginated_section').find('.next_page').click
|
|
61
|
+
sleep(3)
|
|
62
|
+
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
|
63
|
+
find('#page_paginated_section').find('.next_page').click
|
|
64
|
+
sleep(3)
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
|
67
|
+
find('#page_paginated_section').find('.next_page').click
|
|
68
|
+
page.should have_xpath("//img[@class='ajaxpagination-loader' and @src = '/assets/myajax-loader.gif']")
|
|
69
|
+
sleep(1.5)
|
|
70
|
+
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
|
71
|
+
find('#page_paginated_section').find('.next_page').click
|
|
72
|
+
page.should have_xpath("//img[@class='ajaxpagination-loader' and @src = '/assets/ajax-loader.gif']")
|
|
73
|
+
end
|
|
66
74
|
end
|
|
67
75
|
it 'works with browser back and forward buttons' do
|
|
68
76
|
visit("http://localhost:#{SERVERPORT}/pages/about") # warmup serverport
|
|
@@ -156,31 +164,33 @@ describe 'paginating with javascript on', :js => true do
|
|
|
156
164
|
page.current_url.should == myurl # url remains the same (so history has not changed)
|
|
157
165
|
end
|
|
158
166
|
it 'submits ajax_form_for form via POST and DELETE link' do
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
retry_exceptions do
|
|
168
|
+
visit("http://localhost:#{SERVERPORT}")
|
|
169
|
+
find('#signin').click
|
|
170
|
+
click_link("Posts")
|
|
171
|
+
sleep(1)
|
|
172
|
+
page.should have_content("New Post")
|
|
173
|
+
myurl = page.current_url # to get the canonical url
|
|
174
|
+
visit("http://localhost:#{SERVERPORT}/posts/new")
|
|
175
|
+
sleep(1)
|
|
176
|
+
within("#new_post") do
|
|
177
|
+
fill_in 'Title', :with => 'very unique title for test'
|
|
178
|
+
fill_in 'Content', :with => 'my supercontent'
|
|
179
|
+
end
|
|
180
|
+
count = ajaxCount
|
|
181
|
+
click_button("Create Post");
|
|
182
|
+
sleep(2)
|
|
183
|
+
page.should have_content("Post was successfully created.")
|
|
184
|
+
ajaxCount.should == count + 1
|
|
185
|
+
page.current_url.should_not == myurl # means we have gotten redirected
|
|
177
186
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
count = ajaxCount
|
|
188
|
+
click_link("Destroy");
|
|
189
|
+
page.driver.browser.switch_to.alert.accept
|
|
190
|
+
sleep(2)
|
|
191
|
+
page.should have_content("Post destroyed.")
|
|
192
|
+
ajaxCount.should == count + 1
|
|
193
|
+
end
|
|
184
194
|
end
|
|
185
195
|
## This spec does not work in rbx on travis.
|
|
186
196
|
## Tested to work in rbx-1.2.4 on local machine. Also works using MRI ruby on travis.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'rails3.0 support', :type => :request, :driver => :selenium do
|
|
4
|
+
include Retryable
|
|
5
|
+
it 'displays a loading image' do
|
|
6
|
+
retry_exceptions do
|
|
7
|
+
visit("http://localhost:#{R30SERVERPORT}") # goes to welcome page
|
|
8
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
9
|
+
sleep(1.5)
|
|
10
|
+
click_link 'About'
|
|
11
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
12
|
+
sleep(1.5)
|
|
13
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
14
|
+
click_link 'Readme'
|
|
15
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
16
|
+
sleep(1.5)
|
|
17
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
18
|
+
click_link 'Changelog'
|
|
19
|
+
sleep(2)
|
|
20
|
+
page.should have_selector('#changelogpagetitle')
|
|
21
|
+
find('#_paginated_section').find('.next_page').click
|
|
22
|
+
page.should have_selector('.ajaxpagination-loader')
|
|
23
|
+
sleep(1.5)
|
|
24
|
+
page.should have_no_selector('.ajaxpagination-loader')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
it 'submits ajax_form_tag form via post' do
|
|
28
|
+
visit("http://localhost:#{R30SERVERPORT}/pages/about")
|
|
29
|
+
count = page.find("#submits").html.to_i
|
|
30
|
+
click_button("Submit")
|
|
31
|
+
sleep(1.5)
|
|
32
|
+
page.should have_content("#{count+1} submit")
|
|
33
|
+
page.should have_selector('#aboutpagetitle') # ensures loading was via AJAX Pagination
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'rails', '~> 3.0.0'
|
|
4
|
+
|
|
5
|
+
# Bundle edge Rails instead:
|
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
|
7
|
+
|
|
8
|
+
gem 'json'
|
|
9
|
+
|
|
10
|
+
gem 'jquery-rails'
|
|
11
|
+
gem 'jquery-historyjs'
|
|
12
|
+
gem 'will_paginate'
|
|
13
|
+
gem 'ajax_pagination', :path => "../.."
|
|
14
|
+
|
|
15
|
+
# To use ActiveModel has_secure_password
|
|
16
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
|
17
|
+
|
|
18
|
+
# To use Jbuilder templates for JSON
|
|
19
|
+
# gem 'jbuilder'
|
|
20
|
+
|
|
21
|
+
# Use unicorn as the web server
|
|
22
|
+
# gem 'unicorn'
|
|
23
|
+
|
|
24
|
+
# Deploy with Capistrano
|
|
25
|
+
# gem 'capistrano'
|
|
26
|
+
|
|
27
|
+
# To use debugger
|
|
28
|
+
# gem 'ruby-debug' # requires MRI Ruby
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ../..
|
|
3
|
+
specs:
|
|
4
|
+
ajax_pagination (0.5.1)
|
|
5
|
+
jquery-historyjs
|
|
6
|
+
jquery-rails (>= 1.0.17)
|
|
7
|
+
rails (>= 3.0)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
abstract (1.0.0)
|
|
13
|
+
actionmailer (3.0.12)
|
|
14
|
+
actionpack (= 3.0.12)
|
|
15
|
+
mail (~> 2.2.19)
|
|
16
|
+
actionpack (3.0.12)
|
|
17
|
+
activemodel (= 3.0.12)
|
|
18
|
+
activesupport (= 3.0.12)
|
|
19
|
+
builder (~> 2.1.2)
|
|
20
|
+
erubis (~> 2.6.6)
|
|
21
|
+
i18n (~> 0.5.0)
|
|
22
|
+
rack (~> 1.2.5)
|
|
23
|
+
rack-mount (~> 0.6.14)
|
|
24
|
+
rack-test (~> 0.5.7)
|
|
25
|
+
tzinfo (~> 0.3.23)
|
|
26
|
+
activemodel (3.0.12)
|
|
27
|
+
activesupport (= 3.0.12)
|
|
28
|
+
builder (~> 2.1.2)
|
|
29
|
+
i18n (~> 0.5.0)
|
|
30
|
+
activerecord (3.0.12)
|
|
31
|
+
activemodel (= 3.0.12)
|
|
32
|
+
activesupport (= 3.0.12)
|
|
33
|
+
arel (~> 2.0.10)
|
|
34
|
+
tzinfo (~> 0.3.23)
|
|
35
|
+
activeresource (3.0.12)
|
|
36
|
+
activemodel (= 3.0.12)
|
|
37
|
+
activesupport (= 3.0.12)
|
|
38
|
+
activesupport (3.0.12)
|
|
39
|
+
arel (2.0.10)
|
|
40
|
+
builder (2.1.2)
|
|
41
|
+
erubis (2.6.6)
|
|
42
|
+
abstract (>= 1.0.0)
|
|
43
|
+
i18n (0.5.0)
|
|
44
|
+
jquery-historyjs (0.2.3)
|
|
45
|
+
railties (>= 3.0)
|
|
46
|
+
thor (>= 0.14)
|
|
47
|
+
jquery-rails (1.0.19)
|
|
48
|
+
railties (~> 3.0)
|
|
49
|
+
thor (~> 0.14)
|
|
50
|
+
json (1.6.5)
|
|
51
|
+
mail (2.2.19)
|
|
52
|
+
activesupport (>= 2.3.6)
|
|
53
|
+
i18n (>= 0.4.0)
|
|
54
|
+
mime-types (~> 1.16)
|
|
55
|
+
treetop (~> 1.4.8)
|
|
56
|
+
mime-types (1.17.2)
|
|
57
|
+
polyglot (0.3.3)
|
|
58
|
+
rack (1.2.5)
|
|
59
|
+
rack-mount (0.6.14)
|
|
60
|
+
rack (>= 1.0.0)
|
|
61
|
+
rack-test (0.5.7)
|
|
62
|
+
rack (>= 1.0)
|
|
63
|
+
rails (3.0.12)
|
|
64
|
+
actionmailer (= 3.0.12)
|
|
65
|
+
actionpack (= 3.0.12)
|
|
66
|
+
activerecord (= 3.0.12)
|
|
67
|
+
activeresource (= 3.0.12)
|
|
68
|
+
activesupport (= 3.0.12)
|
|
69
|
+
bundler (~> 1.0)
|
|
70
|
+
railties (= 3.0.12)
|
|
71
|
+
railties (3.0.12)
|
|
72
|
+
actionpack (= 3.0.12)
|
|
73
|
+
activesupport (= 3.0.12)
|
|
74
|
+
rake (>= 0.8.7)
|
|
75
|
+
rdoc (~> 3.4)
|
|
76
|
+
thor (~> 0.14.4)
|
|
77
|
+
rake (0.9.2.2)
|
|
78
|
+
rdoc (3.12)
|
|
79
|
+
json (~> 1.4)
|
|
80
|
+
thor (0.14.6)
|
|
81
|
+
treetop (1.4.10)
|
|
82
|
+
polyglot
|
|
83
|
+
polyglot (>= 0.3.1)
|
|
84
|
+
tzinfo (0.3.32)
|
|
85
|
+
will_paginate (3.0.3)
|
|
86
|
+
|
|
87
|
+
PLATFORMS
|
|
88
|
+
ruby
|
|
89
|
+
|
|
90
|
+
DEPENDENCIES
|
|
91
|
+
ajax_pagination!
|
|
92
|
+
jquery-historyjs
|
|
93
|
+
jquery-rails
|
|
94
|
+
json
|
|
95
|
+
rails (~> 3.0.0)
|
|
96
|
+
will_paginate
|