ajax_pagination 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.gitignore +1 -1
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +15 -0
  4. data/README.md +5 -5
  5. data/lib/ajax_pagination/controller_additions.rb +48 -31
  6. data/lib/ajax_pagination/helper_additions.rb +48 -24
  7. data/lib/ajax_pagination/rails.rb +0 -7
  8. data/lib/ajax_pagination/version.rb +1 -1
  9. data/lib/assets/javascripts/ajax_pagination.js.erb +11 -14
  10. data/spec/ajax_pagination/controller_additions_spec.rb +15 -3
  11. data/spec/ajax_pagination/helper_additions_spec.rb +1 -1
  12. data/spec/ajax_pagination/integration/ajaxpaginate_spec.rb +10 -9
  13. data/spec/ajax_pagination/integration/nojavascript_spec.rb +7 -7
  14. data/spec/ajax_pagination/integration/paginate_spec.rb +8 -8
  15. data/spec/ajax_pagination/integration/rails30_spec.rb +1 -1
  16. data/spec/rails30_app/app/controllers/application_controller.rb +2 -2
  17. data/spec/rails30_app/app/controllers/changelog_controller.rb +1 -1
  18. data/spec/rails30_app/app/controllers/pages_controller.rb +2 -9
  19. data/spec/rails30_app/app/views/changelog/_page.html.erb +6 -2
  20. data/spec/rails30_app/app/views/changelog/index.html.erb +1 -1
  21. data/spec/rails30_app/app/views/layouts/application.html.erb +5 -5
  22. data/spec/rails30_app/app/views/sessions/count.html.erb +1 -1
  23. data/spec/rails30_app/public/javascripts/ajax_pagination.js +12 -15
  24. data/spec/rails_app/app/controllers/application_controller.rb +2 -2
  25. data/spec/rails_app/app/controllers/changelog_controller.rb +1 -1
  26. data/spec/rails_app/app/controllers/pages_controller.rb +3 -3
  27. data/spec/rails_app/app/controllers/posts_controller.rb +3 -3
  28. data/spec/rails_app/app/views/changelog/_page.html.erb +6 -2
  29. data/spec/rails_app/app/views/changelog/index.html.erb +1 -1
  30. data/spec/rails_app/app/views/layouts/application.html.erb +5 -5
  31. data/spec/rails_app/app/views/pages/warnings.html.erb +8 -7
  32. data/spec/rails_app/app/views/posts/_page.html.erb +9 -5
  33. data/spec/rails_app/app/views/posts/_upcomingpage.html.erb +6 -2
  34. data/spec/rails_app/app/views/posts/index.html.erb +2 -2
  35. data/spec/rails_app/app/views/posts/show.html.erb +1 -1
  36. data/spec/rails_app/app/views/sessions/count.html.erb +1 -1
  37. metadata +86 -132
  38. data/spec/rails30_app/Gemfile.lock +0 -96
  39. data/spec/rails30_app/app/views/pages/warnings.html.erb +0 -43
  40. data/spec/rails_app/Gemfile.lock +0 -107
@@ -1,4 +1,6 @@
1
- <%= will_paginate @changelogs, :params => { :pagination => nil } %>
1
+ <%= ajax_links :section_id => "page" do %>
2
+ <%= will_paginate @changelogs %>
3
+ <% end %>
2
4
  <%= ajax_loadzone do %>
3
5
  <% @changelogs.each do |changelog| %>
4
6
  <%= content_tag :div, :style => "border-bottom: 1px solid black;" do %>
@@ -7,4 +9,6 @@
7
9
  <% end %>
8
10
  <% end %>
9
11
  <% end %>
10
- <%= will_paginate @changelogs, :params => { :pagination => nil } %>
12
+ <%= ajax_links :section_id => "page" do %>
13
+ <%= will_paginate @changelogs %>
14
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  <h2 id="changelogpagetitle">Changelog</h2>
2
2
 
3
- <%= ajax_section %>
3
+ <%= ajax_section :id => "page" %>
@@ -27,12 +27,12 @@ $(document).ready(function () {
27
27
  <% end %>
28
28
  </div>
29
29
  <div style="float: right; min-width: 150px;">
30
- <%= ajax_section :pagination => "count", :history => false do %>
30
+ <%= ajax_section :id => "count", :history => false do %>
31
31
  <%= render :template => "sessions/count" %>
32
32
  <% end %>
33
33
  </div>
34
- <h1><%= ajax_link_to "AJAX Pagination Example Application", "broken link", :pagination => "" %><!-- note the broken link is intentional, for testing purposes --></h1>
35
- <div class="ajaxpagination menu" data-pagination="">
34
+ <h1><%= ajax_link_to "AJAX Pagination Example Application", "broken link", :section_id => "global" %><!-- note the broken link is intentional, for testing purposes --></h1>
35
+ <%= ajax_links :section_id => "global", :class => "menu" do %>
36
36
  <ul>
37
37
  <li><%= link_to "Home", root_url %></li>
38
38
  <li><%= link_to "Posts", posts_url %></li>
@@ -41,8 +41,8 @@ $(document).ready(function () {
41
41
  <li><%= link_to "Warnings", pages_warnings_url %></li>
42
42
  <li><%= link_to "About", pages_about_url %></li>
43
43
  </ul>
44
- </div>
45
- <%= ajax_section :pagination => "", :reload => {:urlpart => "path", :urlregex => "^.*$"}, :loadzone => true do %>
44
+ <% end %>
45
+ <%= ajax_section :reload => {:urlpart => "path", :urlregex => "^.*$"}, :loadzone => true do %>
46
46
  <%= render :template => "layouts/flash" %>
47
47
  <% end %>
48
48
  </body>
@@ -2,10 +2,10 @@
2
2
  This page gives examples of the warnings that may be given, from AJAX Pagination, when some configuration or otherwise is suboptimal, or prevents proper functioning of the gem.
3
3
 
4
4
  <%= content_tag :div, :style => "display: inline-block; width: 300px; height: 100px; border: 1px solid black; margin: 10px; padding: 10px; vertical-align: middle;" do %>
5
- <%= ajax_section do %>
5
+ <%= ajax_section :id => "page" do %>
6
6
  <p>You are on page <%= params[:page] ||= 1 %>.</p>
7
7
 
8
- <p><%= ajax_link_to "Reload whole page just to refresh this content", pages_warnings_path(:page => (params[:page].to_i+1)), :pagination => "page", :id => "fullpagelink" %></p>
8
+ <p><%= ajax_link_to "Reload whole page just to refresh this content", pages_warnings_path(:page => (params[:page].to_i+1)), :section_id => "page", :id => "fullpagelink" %></p>
9
9
  <% end %>
10
10
  <% end %>
11
11
 
@@ -21,23 +21,24 @@ This page gives examples of the warnings that may be given, from AJAX Pagination
21
21
  <% end %>
22
22
 
23
23
  <%= content_tag :div, :style => "display: inline-block; width: 300px; height: 100px; border: 1px solid black; margin: 10px; padding: 10px; vertical-align: middle;" do %>
24
- <p>AJAX Links need to reference a valid pagination section, otherwise AJAX Pagination doesn't know where the new content should go.</p>
25
- <p><%= ajax_link_to "Link without valid AJAX Pagination section", pages_warnings_path, :pagination => "RANDOM", :id => "nosectionlink" %></p>
24
+ <p>AJAX Links need to reference a valid section, otherwise AJAX Pagination doesn't know where the new content should go.</p>
25
+ <p><%= ajax_link_to "Link without valid AJAX Pagination section", pages_warnings_path, :section_id => "RANDOM", :id => "nosectionlink" %></p>
26
26
  <% end %>
27
27
 
28
28
  <%= content_tag :div, :style => "display: inline-block; width: 300px; height: 100px; border: 1px solid black; margin: 10px; padding: 10px; vertical-align: middle;" do %>
29
29
  <%= content_tag :div, :style => "border: 1px solid black; margin: 10px;" do %>
30
- <%= ajax_section :pagination => "double" do %>My section name is "double".<% end %>
30
+ <%= ajax_section :id => "double" do %>My section name is "double".<% end %>
31
31
  <% end %>
32
32
  <%= content_tag :div, :style => "border: 1px solid black; margin: 10px;" do %>
33
- <%= ajax_section :pagination => "double" do %>My section name is "double".<% end %>
33
+ <%= ajax_section :id => "double" do %>My section name is "double".<% end %>
34
34
  <% end %>
35
- <p><%= ajax_link_to "Load stuff in section named \"double\"", pages_warnings_path, :pagination => "double", :id => "doublesectionlink" %></p>
35
+ <p><%= ajax_link_to "Load stuff in section named \"double\"", pages_warnings_path, :section_id => "double", :id => "doublesectionlink" %></p>
36
36
  <% end %>
37
37
 
38
38
  <%= content_tag :div, :class => "paginated_section", :style => "display: inline-block; width: 300px; height: 100px; border: 1px solid black; margin: 10px; padding: 10px; vertical-align: middle;" do %>
39
39
  <%= content_tag :div, :class => "ajaxpagination" do %>
40
40
  <p>If a link does not reference a section into which content can be loaded, AJAX will be cancelled, and the link will load in the whole window.</p>
41
+ <p>This warning/behaviour is deprecated.</p>
41
42
  <p><%= link_to "Link without reference to any section", pages_warnings_path, :id => "missingreferencelink" %></p>
42
43
  <% end %>
43
44
  <% end %>
@@ -1,15 +1,19 @@
1
- <%= will_paginate @posts, :params => { :pagination => nil } %>
1
+ <%= ajax_links :section_id => "page" do %>
2
+ <%= will_paginate @posts %>
3
+ <% end %>
2
4
  <%= ajax_loadzone do %>
3
5
  <% @posts.each do |post| %>
4
6
  <div style="border-bottom: 1px solid black; padding-bottom: 10px;">
5
7
  <p><h3><%= post.title %></h3><i>Published on <%= post.published_at.strftime('%d %B %Y') if post.published_at? %></i></p>
6
8
  <%= simple_format(post.content) %>
7
- <%= ajax_link_to 'Show', post, :pagination => "" %>
9
+ <%= ajax_link_to 'Show', post %>
8
10
  <% if session[:admin] %>
9
- | <%= ajax_link_to 'Edit', edit_post_path(post), :pagination => "" %> |
10
- <%= ajax_link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete, :pagination => "" %>
11
+ | <%= ajax_link_to 'Edit', edit_post_path(post), :section_id => "" %> |
12
+ <%= ajax_link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %>
11
13
  <% end %>
12
14
  </div>
13
15
  <% end %>
14
16
  <% end %>
15
- <%= will_paginate @posts, :params => { :pagination => nil } %>
17
+ <%= ajax_links :section_id => "page" do %>
18
+ <%= will_paginate @posts %>
19
+ <% end %>
@@ -1,4 +1,6 @@
1
- <%= will_paginate @upcomingposts, :params => { :pagination => nil }, :param_name => :upcomingpage %>
1
+ <%= ajax_links :section_id => "upcomingpage" do %>
2
+ <%= will_paginate @upcomingposts, :param_name => :upcomingpage %>
3
+ <% end %>
2
4
  <%= ajax_loadzone do %>
3
5
  <% @upcomingposts.each do |post| %>
4
6
  <div style="border-bottom: 1px solid black; padding-bottom: 10px;">
@@ -12,4 +14,6 @@
12
14
  </div>
13
15
  <% end %>
14
16
  <% end %>
15
- <%= will_paginate @upcomingposts, :params => { :pagination => nil }, :param_name => :upcomingpage %>
17
+ <%= ajax_links :section_id => "upcomingpage" do %>
18
+ <%= will_paginate @upcomingposts, :param_name => :upcomingpage %>
19
+ <% end %>
@@ -3,12 +3,12 @@
3
3
  <% if session[:admin] %>
4
4
  <%= content_tag :div, :style => "border: 1px solid blue; background-color: rgba(0,0,255,0.1); padding-left: 40px; padding-right: 40px;" do %>
5
5
  <h3>Upcoming</h3>
6
- <%= ajax_section :pagination => "upcomingpage" %>
6
+ <%= ajax_section :id => "upcomingpage" %>
7
7
  <% end %>
8
8
  <h3>Published</h3>
9
9
  <% end %>
10
10
 
11
- <%= ajax_section :image => "ajax-loader.gif" %>
11
+ <%= ajax_section :id => "page", :image => "ajax-loader.gif" %>
12
12
 
13
13
  <br />
14
14
 
@@ -9,6 +9,6 @@
9
9
 
10
10
  <% if session[:admin] %>
11
11
  <%= ajax_link_to 'Edit', edit_post_path(@post) %> |
12
- <%= ajax_link_to 'Destroy', @post, :confirm => 'Are you sure?', :method => :delete, :pagination => "" %> |
12
+ <%= ajax_link_to 'Destroy', @post, :confirm => 'Are you sure?', :method => :delete %> |
13
13
  <% end %>
14
14
  <%= ajax_link_to 'Back', posts_path %>
@@ -1,6 +1,6 @@
1
1
  <span id="submits"><%= session[:count].to_i %></span>
2
2
  submit<%= 's' unless session[:count]==1 %> so far.
3
- <%= ajax_form_tag sessions_count_url, :method => "post", :pagination => "count" do %>
3
+ <%= ajax_form_tag sessions_count_url, :method => "post", :section_id => "count" do %>
4
4
  <span class="actions">
5
5
  <%= submit_tag "Submit" %>
6
6
  </span>
metadata CHANGED
@@ -1,147 +1,114 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ajax_pagination
3
- version: !ruby/object:Gem::Version
4
- hash: 9
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 1
10
- version: 0.5.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ronald Ping Man Chan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-03-09 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &14445000 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: rspec-rails
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *14445000
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec-rails
27
+ requirement: &14444400 !ruby/object:Gem::Requirement
38
28
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
46
33
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: sqlite3
50
34
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *14444400
36
+ - !ruby/object:Gem::Dependency
37
+ name: sqlite3
38
+ requirement: &14443980 !ruby/object:Gem::Requirement
52
39
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
60
44
  type: :development
61
- version_requirements: *id003
62
- - !ruby/object:Gem::Dependency
63
- name: will_paginate
64
45
  prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *14443980
47
+ - !ruby/object:Gem::Dependency
48
+ name: will_paginate
49
+ requirement: &14443440 !ruby/object:Gem::Requirement
66
50
  none: false
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- hash: 3
71
- segments:
72
- - 0
73
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
74
55
  type: :development
75
- version_requirements: *id004
76
- - !ruby/object:Gem::Dependency
77
- name: capybara
78
56
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *14443440
58
+ - !ruby/object:Gem::Dependency
59
+ name: capybara
60
+ requirement: &14442880 !ruby/object:Gem::Requirement
80
61
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
88
66
  type: :development
89
- version_requirements: *id005
90
- - !ruby/object:Gem::Dependency
91
- name: rails
92
67
  prerelease: false
93
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *14442880
69
+ - !ruby/object:Gem::Dependency
70
+ name: rails
71
+ requirement: &14442260 !ruby/object:Gem::Requirement
94
72
  none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 7
99
- segments:
100
- - 3
101
- - 0
102
- version: "3.0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '3.0'
103
77
  type: :runtime
104
- version_requirements: *id006
105
- - !ruby/object:Gem::Dependency
106
- name: jquery-rails
107
78
  prerelease: false
108
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *14442260
80
+ - !ruby/object:Gem::Dependency
81
+ name: jquery-rails
82
+ requirement: &14368180 !ruby/object:Gem::Requirement
109
83
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 53
114
- segments:
115
- - 1
116
- - 0
117
- - 17
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
118
87
  version: 1.0.17
119
88
  type: :runtime
120
- version_requirements: *id007
121
- - !ruby/object:Gem::Dependency
122
- name: jquery-historyjs
123
89
  prerelease: false
124
- requirement: &id008 !ruby/object:Gem::Requirement
90
+ version_requirements: *14368180
91
+ - !ruby/object:Gem::Dependency
92
+ name: jquery-historyjs
93
+ requirement: &14367640 !ruby/object:Gem::Requirement
125
94
  none: false
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
133
99
  type: :runtime
134
- version_requirements: *id008
135
- description: Handles AJAX pagination for you, by hooking up the links you want to load content with javascript in designated page containers. Each webpage can have multiple page containers, each with a different set of pagination links. The page containers can be nested. Degrades gracefully when javascript is disabled.
136
- email:
100
+ prerelease: false
101
+ version_requirements: *14367640
102
+ description: Handles AJAX pagination for you, by hooking up the links you want to
103
+ load content with javascript in designated page containers. Each webpage can have
104
+ multiple page containers, each with a different set of pagination links. The page
105
+ containers can be nested. Degrades gracefully when javascript is disabled.
106
+ email:
137
107
  - ronalchn@gmail.com
138
108
  executables: []
139
-
140
109
  extensions: []
141
-
142
110
  extra_rdoc_files: []
143
-
144
- files:
111
+ files:
145
112
  - .gitignore
146
113
  - .rspec
147
114
  - .travis.yml
@@ -177,7 +144,6 @@ files:
177
144
  - spec/ajax_pagination/integration/warnings_spec.rb
178
145
  - spec/rails30_app/.gitignore
179
146
  - spec/rails30_app/Gemfile
180
- - spec/rails30_app/Gemfile.lock
181
147
  - spec/rails30_app/Rakefile
182
148
  - spec/rails30_app/app/controllers/application_controller.rb
183
149
  - spec/rails30_app/app/controllers/changelog_controller.rb
@@ -195,7 +161,6 @@ files:
195
161
  - spec/rails30_app/app/views/layouts/flash.html.erb
196
162
  - spec/rails30_app/app/views/pages/about.html.erb
197
163
  - spec/rails30_app/app/views/pages/readme.html.erb
198
- - spec/rails30_app/app/views/pages/warnings.html.erb
199
164
  - spec/rails30_app/app/views/pages/welcome.html.erb
200
165
  - spec/rails30_app/app/views/sessions/count.html.erb
201
166
  - spec/rails30_app/config.ru
@@ -239,7 +204,6 @@ files:
239
204
  - spec/rails30_app/script/rails
240
205
  - spec/rails_app/.gitignore
241
206
  - spec/rails_app/Gemfile
242
- - spec/rails_app/Gemfile.lock
243
207
  - spec/rails_app/README.rdoc
244
208
  - spec/rails_app/Rakefile
245
209
  - spec/rails_app/app/assets/images/myajax-loader.gif
@@ -308,36 +272,26 @@ files:
308
272
  - vendor/assets/javascripts/jquery.url.js
309
273
  homepage: https://github.com/ronalchn/ajax_pagination
310
274
  licenses: []
311
-
312
275
  post_install_message:
313
276
  rdoc_options: []
314
-
315
- require_paths:
277
+ require_paths:
316
278
  - lib
317
- required_ruby_version: !ruby/object:Gem::Requirement
279
+ required_ruby_version: !ruby/object:Gem::Requirement
318
280
  none: false
319
- requirements:
320
- - - ">="
321
- - !ruby/object:Gem::Version
322
- hash: 3
323
- segments:
324
- - 0
325
- version: "0"
326
- required_rubygems_version: !ruby/object:Gem::Requirement
281
+ requirements:
282
+ - - ! '>='
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
285
+ required_rubygems_version: !ruby/object:Gem::Requirement
327
286
  none: false
328
- requirements:
329
- - - ">="
330
- - !ruby/object:Gem::Version
331
- hash: 3
332
- segments:
333
- - 0
334
- version: "0"
287
+ requirements:
288
+ - - ! '>='
289
+ - !ruby/object:Gem::Version
290
+ version: '0'
335
291
  requirements: []
336
-
337
292
  rubyforge_project: ajax_pagination
338
293
  rubygems_version: 1.8.17
339
294
  signing_key:
340
295
  specification_version: 3
341
296
  summary: Handles AJAX pagination, changing the content when certain links are followed.
342
297
  test_files: []
343
-