ajax_pagination 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -0
- data/README.md +13 -11
- data/lib/ajax_pagination/controller_additions.rb +10 -10
- data/lib/ajax_pagination/helper_additions.rb +8 -8
- data/lib/ajax_pagination/version.rb +1 -1
- data/lib/assets/javascripts/ajax_pagination.js.erb +1 -1
- data/lib/assets/stylesheets/{ajax_pagination.css.erb → ajax_pagination.css} +0 -0
- data/spec/ajax_pagination/controller_additions_spec.rb +24 -24
- data/spec/ajax_pagination/helper_additions_spec.rb +8 -8
- data/spec/rails_app/app/controllers/application_controller.rb +1 -1
- data/spec/rails_app/app/controllers/changelog_controller.rb +1 -1
- data/spec/rails_app/app/controllers/pages_controller.rb +3 -3
- data/spec/rails_app/app/controllers/posts_controller.rb +3 -3
- data/spec/rails_app/app/views/changelog/_page.html.erb +1 -1
- data/spec/rails_app/app/views/changelog/index.html.erb +1 -1
- data/spec/rails_app/app/views/layouts/application.html.erb +2 -2
- data/spec/rails_app/app/views/pages/warnings.html.erb +3 -3
- data/spec/rails_app/app/views/posts/_page.html.erb +1 -1
- data/spec/rails_app/app/views/posts/_upcomingpage.html.erb +1 -1
- data/spec/rails_app/app/views/posts/index.html.erb +2 -2
- metadata +5 -5
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## v0.5.0
|
2
|
+
This release has no new features, however, it is backwards incompatible because several methods have been renamed for clarity.
|
3
|
+
|
4
|
+
The new method names are ajax_respond in the controller instead of ajax_pagination, ajax_section in the view instead of ajax_pagination, ajax_loadzone instead of ajax_pagination_loadzone, and ajax_section_displayed? instead of ajax_pagination_displayed?.
|
5
|
+
|
6
|
+
Hopefully, the new names will make it easier to learn to use this gem, and is happening along with some slight changes in how various parts of the AJAX process is named.
|
7
|
+
|
8
|
+
I have for a while thought that the overloading of the same name ajax_pagination, with the name giving little clue as to its use, was confusing. However, it has taken a while to come up with a suitable replacement. Other name changes are simply to maintain the same naming format.
|
9
|
+
|
10
|
+
The minor version bump is for backwards incompatibility. Although there is little changed, this is a new minor version because I want to make a release with this new API earlier, before more people use the old interface.
|
11
|
+
|
1
12
|
## v0.4.0
|
2
13
|
* Reload logic rewritten, we now have world-class support for browser history. This is the biggest change. It is almost unnecessary to use the :reload option now, because the history support engine is much more intelligent. The original reason for the :reload option is to expose good history behaviour. This is now unnecessary, because the glitches which would otherwise occur are now solved in a better way. There is one remaining use for it. When browsers visit the same url, they do not add a new history item (therefore it is the same as clicking refresh). And when jumping to another history item with the same url, Firefox does not reload the page (although Chrome does). AJAX Pagination behaves like Firefox. However, sometimes different urls refer to the same content, when considering just a single section of the page. The :reload option is now used for this purpose. If present, it should specify all the important parts of the url which should be the same, for two different urls to be considered to same for the page section. The syntax for this reload specification is identical to before. Only the use of it has changed. Although this does change behaviour quite a bit, existing code should still work fine. This was changed because this behaviour more successfully mimics browser behaviour automatically - so less configuration.
|
3
14
|
* Moving css from javascript to stylesheet - this should make it easier to customize aspects of it.
|
data/README.md
CHANGED
@@ -7,17 +7,9 @@ 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
|
-
|
11
|
-
|
12
|
-
## Features
|
10
|
+
This gem currently assumes you are using Rails 3.1+, and the assets pipeline for the javascript and css files.
|
13
11
|
|
14
|
-
|
15
|
-
* Supports multiple and nested sections
|
16
|
-
* Supports browser history, for more see [Robust Support for Browser History in AJAX Pagination](https://github.com/ronalchn/ajax_pagination/wiki/Robust-Support-for-Browser-History-in-AJAX-Pagination)
|
17
|
-
* Supports links, but also POST, DELETE, PUT links and forms. Then all can be used to change the content in a section
|
18
|
-
* Supports redirects - a necessary feature when used with forms
|
19
|
-
* Custom javascript events
|
20
|
-
* Built in visual cues when loading new content - can be altered with css.
|
12
|
+
For more, see [Introduction and Background](https://github.com/ronalchn/ajax_pagination/wiki/Introduction-and-Background).
|
21
13
|
|
22
14
|
## Installation
|
23
15
|
Add to your Gemfile:
|
@@ -38,7 +30,7 @@ Then add to your asset manifests,
|
|
38
30
|
|
39
31
|
```css
|
40
32
|
/* app/assets/stylesheets/application.css
|
41
|
-
|
33
|
+
*= require ajax_pagination
|
42
34
|
*/
|
43
35
|
```
|
44
36
|
|
@@ -52,6 +44,16 @@ For more, including how specific features work, look in the [wiki](https://githu
|
|
52
44
|
|
53
45
|
Alternatively, to see the API, see [RDoc](http://rdoc.info/gems/ajax_pagination/frames).
|
54
46
|
|
47
|
+
## Features
|
48
|
+
|
49
|
+
* So easy to use, you don't need to touch a single line of javascript
|
50
|
+
* Supports multiple and nested sections
|
51
|
+
* Supports browser history, for more see [Robust Support for Browser History in AJAX Pagination](https://github.com/ronalchn/ajax_pagination/wiki/Robust-Support-for-Browser-History-in-AJAX-Pagination)
|
52
|
+
* Supports links, but also POST, DELETE, PUT links and forms, which can all be used to change the content in a section
|
53
|
+
* Supports redirects - a necessary feature when used with forms
|
54
|
+
* Custom javascript events
|
55
|
+
* Built in visual cues when loading new content - can be altered with css.
|
56
|
+
|
55
57
|
## Example Application
|
56
58
|
This gem contains an example application (actually, it is there also for testing purposes), however it is nevertheless a good example.
|
57
59
|
|
@@ -12,7 +12,7 @@ module AjaxPagination
|
|
12
12
|
# Overrides default render behaviour for AJAX Pagination, which is to render the partial with name matching the pagination option,
|
13
13
|
# or if it does not exist, renders the default template
|
14
14
|
#
|
15
|
-
def
|
15
|
+
def ajax_respond(options = {});
|
16
16
|
# instead of defining default render normally, we save an unbound reference to original function in case it was already defined, since we want to retain the original behaviour, and add to it (if the method is redefined after, this new behaviour is lost, but at least we don't remove others' behaviour - note that this also allows multiple invocations of this with different parameters)
|
17
17
|
default_render = self.instance_method(:default_render) # get a reference to original method
|
18
18
|
pagination = options[:pagination] || ""
|
@@ -28,7 +28,7 @@ module AjaxPagination
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
respond_to do |format|
|
31
|
-
|
31
|
+
ajax_respond format, :pagination => pagination, :render => view
|
32
32
|
end
|
33
33
|
else # otherwise do what would have been done
|
34
34
|
default_render.bind(self).call(*args) # call original method of the same name
|
@@ -50,7 +50,7 @@ module AjaxPagination
|
|
50
50
|
# @comments = Comment.all
|
51
51
|
# respond_to do |format|
|
52
52
|
# format.html # index.html.erb
|
53
|
-
#
|
53
|
+
# ajax_respond(format)
|
54
54
|
# end
|
55
55
|
# end
|
56
56
|
# end
|
@@ -70,11 +70,11 @@ module AjaxPagination
|
|
70
70
|
# def welcome
|
71
71
|
# respond_to do |format|
|
72
72
|
# format.html
|
73
|
-
#
|
73
|
+
# ajax_respond format, :pagination => :menu, :render => {:file => "pages/welcome"}
|
74
74
|
# end
|
75
75
|
# end
|
76
76
|
#
|
77
|
-
def
|
77
|
+
def ajax_respond(format,options = {})
|
78
78
|
paramspagination = request.GET[:pagination] || params[:pagination]
|
79
79
|
if paramspagination == (options[:pagination] || 'page').to_s
|
80
80
|
if options[:render]
|
@@ -105,13 +105,13 @@ module AjaxPagination
|
|
105
105
|
#
|
106
106
|
# class PostsController < ApplicationController
|
107
107
|
# def index
|
108
|
-
# if
|
108
|
+
# if ajax_section_displayed? do
|
109
109
|
# @posts = Post.published
|
110
110
|
# @posts.each do |post|
|
111
111
|
# post.heavycomputation
|
112
112
|
# end
|
113
113
|
# end
|
114
|
-
# if current_user.is_admin &&
|
114
|
+
# if current_user.is_admin && ajax_section_displayed? :upcomingpage do
|
115
115
|
# @upcomingposts = Post.upcoming
|
116
116
|
# @upcomingposts.each do |post|
|
117
117
|
# post.heavycomputation
|
@@ -119,14 +119,14 @@ module AjaxPagination
|
|
119
119
|
# end
|
120
120
|
# respond_to do |format|
|
121
121
|
# format.html # index.html.erb
|
122
|
-
#
|
123
|
-
#
|
122
|
+
# ajax_respond format
|
123
|
+
# ajax_respond format, :pagination => 'upcomingpage'
|
124
124
|
# end
|
125
125
|
# end
|
126
126
|
# end
|
127
127
|
#
|
128
128
|
# The heavy computation will only be performed on posts which will be displayed when AJAX Pagination only wants a partial.
|
129
|
-
def
|
129
|
+
def ajax_section_displayed?(pagination = :page)
|
130
130
|
paramspagination = request.GET[:pagination] || params[:pagination]
|
131
131
|
(!request.format.html?) || (paramspagination.nil?) || (paramspagination == pagination.to_s)
|
132
132
|
end
|
@@ -3,13 +3,13 @@ module AjaxPagination
|
|
3
3
|
module HelperAdditions
|
4
4
|
# Renders a partial wrapped in a div tag. When the page content displayed in the partial needs changing
|
5
5
|
# AJAX Pagination will replace content inside this div tag, with the new content returned by the controller
|
6
|
-
# (To manage that, see +
|
6
|
+
# (To manage that, see +ajax_respond+ in ControllerAdditions).
|
7
7
|
#
|
8
8
|
# Call this method instead of +render+ to display the partial representing the page content:
|
9
9
|
#
|
10
10
|
# Listing Comments:
|
11
11
|
#
|
12
|
-
# <%=
|
12
|
+
# <%= ajax_section %>
|
13
13
|
#
|
14
14
|
# <%= link_to 'New Comment', new_comment_path %>
|
15
15
|
#
|
@@ -26,7 +26,7 @@ module AjaxPagination
|
|
26
26
|
# <li><%= link_to "About", pages_about_url %></li>
|
27
27
|
# </ul>
|
28
28
|
# </div>
|
29
|
-
# <%=
|
29
|
+
# <%= ajax_section :pagination => "" do %>
|
30
30
|
# <%= yield %>
|
31
31
|
# <% end %>
|
32
32
|
#
|
@@ -65,14 +65,14 @@ module AjaxPagination
|
|
65
65
|
#
|
66
66
|
# Different parts of the url can be watched for any changes, by passing an array of hashes. For example:
|
67
67
|
#
|
68
|
-
# <%=
|
68
|
+
# <%= ajax_section :reload => [{:urlregex => "page=([0-9]+)", :regexindex => 1},{:query => "watching"}] %>
|
69
69
|
#
|
70
70
|
# [:+image+]
|
71
71
|
# Specify another image to be used as the loading image. The string passed is an image in the assets pipeline.
|
72
72
|
# If not specified, the default loading image is used.
|
73
73
|
#
|
74
74
|
# [:+loadzone+]
|
75
|
-
# Instead of using the
|
75
|
+
# Instead of using the ajax_loadzone tag, this option can be set to true. Everything inside this tag
|
76
76
|
# will then be regarded as a loading zone, and the visual loading cues will apply to all the content here.
|
77
77
|
#
|
78
78
|
# [:+history+]
|
@@ -82,7 +82,7 @@ module AjaxPagination
|
|
82
82
|
# If false then it is as if no new page is accessed, and the history is not changed. It therefore appears as if following
|
83
83
|
# the link simply creates a cool AJAX effect on the current page.
|
84
84
|
#
|
85
|
-
def
|
85
|
+
def ajax_section(options = {})
|
86
86
|
pagination = options[:pagination] || 'page' # by default the name of the pagination is 'page'
|
87
87
|
partial = options[:render] || pagination # default partial rendered is the name of the pagination
|
88
88
|
divoptions = { :id => "#{pagination}_paginated_section", :class => "paginated_section" }
|
@@ -120,12 +120,12 @@ module AjaxPagination
|
|
120
120
|
# your partial might contain:
|
121
121
|
#
|
122
122
|
# <%= will_paginate @objects, :params => { :pagination => nil } %>
|
123
|
-
# <%=
|
123
|
+
# <%= ajax_loadzone do %>
|
124
124
|
# All content here is covered by a semi-transparent rectangle.
|
125
125
|
# A loading image is displayed on top, and any links here are unclickable
|
126
126
|
# <% end %>
|
127
127
|
#
|
128
|
-
def
|
128
|
+
def ajax_loadzone()
|
129
129
|
content_tag :div, :class => "paginated_content", :style => "position: relative;" do
|
130
130
|
yield
|
131
131
|
end
|
@@ -192,7 +192,7 @@ jQuery(document).ready(function () {
|
|
192
192
|
if (content.length>0) {
|
193
193
|
content = content.html();
|
194
194
|
<% if AjaxPagination.warnings %>
|
195
|
-
alert("AJAX Pagination EXTRA_CONTENT_DISCARDED:\nExtra content returned by AJAX request ignored. Only a portion of the page content returned by the server was required. To fix this, explicitly call
|
195
|
+
alert("AJAX Pagination EXTRA_CONTENT_DISCARDED:\nExtra content returned by AJAX request ignored. Only a portion of the page content returned by the server was required. To fix this, explicitly call ajax_respond :pagination => \"" + pagination_name + "\" to render only the partial view required. This warning can be turned off in the ajax_pagination initializer file.");
|
196
196
|
<% end %>
|
197
197
|
}
|
198
198
|
else { // otherwise use all the content, including any scripts - we consider scripts specifically returned in the partial probably should be re-run
|
File without changes
|
@@ -21,69 +21,69 @@ describe AjaxPagination::ControllerAdditions do
|
|
21
21
|
stub_lookup_context([]) # no partial matching
|
22
22
|
end
|
23
23
|
|
24
|
-
describe '
|
24
|
+
describe 'ajax_respond' do
|
25
25
|
it 'should not render when pagination parameter not defined' do
|
26
|
-
@controller.
|
27
|
-
@controller.
|
28
|
-
@controller.
|
29
|
-
@controller.
|
26
|
+
@controller.ajax_respond(@formatter).should be_false
|
27
|
+
@controller.ajax_respond(@formatter, :pagination => :page).should be_false
|
28
|
+
@controller.ajax_respond(@formatter, :pagination => 'page').should be_false
|
29
|
+
@controller.ajax_respond(@formatter, :pagination => 'page2').should be_false
|
30
30
|
@formatter.html.should == 0
|
31
31
|
end
|
32
32
|
it 'should render when pagination parameter matches' do
|
33
33
|
stub_pagination('page')
|
34
|
-
@controller.
|
34
|
+
@controller.ajax_respond(@formatter).should be_true
|
35
35
|
@formatter.html.should == 1 # detects html function was called once (but checking also calls the function) ...
|
36
|
-
@controller.
|
36
|
+
@controller.ajax_respond(@formatter, :pagination => :page).should be_true
|
37
37
|
@formatter.html.should == 3 # ... which is why the next check should be 2 more html function calls
|
38
|
-
@controller.
|
38
|
+
@controller.ajax_respond(@formatter, :pagination => 'page').should be_true
|
39
39
|
@formatter.html.should == 5
|
40
40
|
stub_pagination('pageX')
|
41
|
-
@controller.
|
41
|
+
@controller.ajax_respond(@formatter, :pagination => 'pageX').should be_true
|
42
42
|
@formatter.html.should == 7
|
43
43
|
stub_lookup_context(['matching_partial_found'])
|
44
|
-
@controller.
|
44
|
+
@controller.ajax_respond(@formatter, :pagination => 'pageX').should be_true
|
45
45
|
@formatter.html.should == 9
|
46
46
|
stub_pagination('page')
|
47
|
-
@controller.
|
47
|
+
@controller.ajax_respond(@formatter).should be_true
|
48
48
|
@formatter.html.should == 11
|
49
49
|
|
50
50
|
end
|
51
51
|
it 'should not render when pagination parameter does not match' do
|
52
52
|
stub_pagination('notpage')
|
53
|
-
@controller.
|
54
|
-
@controller.
|
55
|
-
@controller.
|
53
|
+
@controller.ajax_respond(@formatter).should be_false
|
54
|
+
@controller.ajax_respond(@formatter, :pagination => :page).should be_false
|
55
|
+
@controller.ajax_respond(@formatter, :pagination => 'page').should be_false
|
56
56
|
stub_pagination('notpageX')
|
57
|
-
@controller.
|
57
|
+
@controller.ajax_respond(@formatter, :pagination => 'pageX').should be_false
|
58
58
|
@formatter.html.should == 0
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
describe '
|
62
|
+
describe 'ajax_section_displayed?' do
|
63
63
|
it 'should display partial when format is not html' do
|
64
|
-
@controller.
|
64
|
+
@controller.ajax_section_displayed?.should be_true
|
65
65
|
end
|
66
66
|
it 'should display partial when format is html but pagination is not defined' do
|
67
67
|
stub_request_format_html(true)
|
68
|
-
@controller.
|
68
|
+
@controller.ajax_section_displayed?.should be_true
|
69
69
|
end
|
70
70
|
it 'should display partial when .html?pagination=pagename' do
|
71
71
|
stub_request_format_html(true)
|
72
72
|
stub_pagination('page')
|
73
|
-
@controller.
|
73
|
+
@controller.ajax_section_displayed?.should be_true
|
74
74
|
stub_pagination('page2')
|
75
|
-
@controller.
|
75
|
+
@controller.ajax_section_displayed?('page2').should be_true
|
76
76
|
stub_pagination('page3')
|
77
|
-
@controller.
|
77
|
+
@controller.ajax_section_displayed?(:page3).should be_true
|
78
78
|
end
|
79
79
|
it 'should not display partial when .html?pagination!=pagename' do
|
80
80
|
stub_request_format_html(true)
|
81
81
|
stub_pagination('notpage')
|
82
|
-
@controller.
|
82
|
+
@controller.ajax_section_displayed?.should be_false
|
83
83
|
stub_pagination('notpage2')
|
84
|
-
@controller.
|
84
|
+
@controller.ajax_section_displayed?('page2').should be_false
|
85
85
|
stub_pagination('notpage3')
|
86
|
-
@controller.
|
86
|
+
@controller.ajax_section_displayed?(:page3).should be_false
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -13,27 +13,27 @@ describe AjaxPagination::HelperAdditions do
|
|
13
13
|
@view_class.send(:include, AjaxPagination::HelperAdditions)
|
14
14
|
@view_class.send(:include, BlockPassThrough) # passes through block return value directly
|
15
15
|
end
|
16
|
-
describe '
|
16
|
+
describe 'ajax_section' do
|
17
17
|
it 'should render partial requested, default of page with no arguments' do
|
18
18
|
@view.should_receive(:render).with('page')
|
19
|
-
@view.
|
19
|
+
@view.ajax_section
|
20
20
|
@view.should_receive(:render).with('page2')
|
21
|
-
@view.
|
21
|
+
@view.ajax_section :pagination => 'page2' # renders the partial named :pagination if :partial not defined
|
22
22
|
@view.should_receive(:render).with('page3')
|
23
|
-
@view.
|
23
|
+
@view.ajax_section :render => 'page3' # if partial defined, renders partial
|
24
24
|
@view.should_receive(:render).with('pageX')
|
25
|
-
@view.
|
25
|
+
@view.ajax_section :pagination => 'page10', :render => 'pageX' # even if pagination also defined as different value
|
26
26
|
end
|
27
27
|
end
|
28
|
-
describe '
|
28
|
+
describe 'ajax_loadzone' do
|
29
29
|
it 'should yield once to block' do
|
30
|
-
html = @view.
|
30
|
+
html = @view.ajax_loadzone do
|
31
31
|
@view.count
|
32
32
|
true
|
33
33
|
end
|
34
34
|
html.should be_true
|
35
35
|
@view.count.should == 1
|
36
|
-
html = @view.
|
36
|
+
html = @view.ajax_loadzone do
|
37
37
|
@view.count
|
38
38
|
false
|
39
39
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
before_filter :slowajaxload
|
4
|
-
|
4
|
+
ajax_respond :pagination => "", :render => { :layout => "ajax" }
|
5
5
|
def slowajaxload
|
6
6
|
if (request.GET[:pagination] || params[:pagination]) && Rails.env == "test"
|
7
7
|
delay = 0
|
@@ -5,7 +5,7 @@ class PagesController < ApplicationController
|
|
5
5
|
@readme = IO.read(File.expand_path("../../../../../README.md",__FILE__))
|
6
6
|
respond_to do |format|
|
7
7
|
format.html
|
8
|
-
|
8
|
+
ajax_respond format, :pagination => "", :render => {:file => "pages/readme", :layout => "ajax"}
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -15,14 +15,14 @@ class PagesController < ApplicationController
|
|
15
15
|
def welcome
|
16
16
|
respond_to do |format|
|
17
17
|
format.html
|
18
|
-
|
18
|
+
ajax_respond format, :pagination => "", :render => { :layout => "ajax" }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
def warnings
|
23
23
|
respond_to do |format|
|
24
24
|
format.html
|
25
|
-
|
25
|
+
ajax_respond format, :pagination => "disable", :render => { :layout => "ajax" }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class PostsController < ApplicationController
|
2
|
-
|
2
|
+
ajax_respond :pagination => 'page'
|
3
3
|
# GET /posts
|
4
4
|
# GET /posts.json
|
5
5
|
def index
|
@@ -8,8 +8,8 @@ class PostsController < ApplicationController
|
|
8
8
|
respond_to do |format|
|
9
9
|
format.html # index.html.erb
|
10
10
|
format.json { render :json => @posts }
|
11
|
-
|
12
|
-
|
11
|
+
ajax_respond format, :pagination => :upcomingpage
|
12
|
+
ajax_respond format, :pagination => "", :render => { :layout => "ajax" }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= will_paginate @changelogs, :params => { :pagination => nil } %>
|
2
|
-
<%=
|
2
|
+
<%= ajax_loadzone do %>
|
3
3
|
<% @changelogs.each do |changelog| %>
|
4
4
|
<%= content_tag :div, :style => "border-bottom: 1px solid black;" do %>
|
5
5
|
<h3><%= simple_format(changelog.title) %></h3>
|
@@ -27,7 +27,7 @@ $(document).ready(function () {
|
|
27
27
|
<% end %>
|
28
28
|
</div>
|
29
29
|
<div style="float: right; min-width: 150px;">
|
30
|
-
<%=
|
30
|
+
<%= ajax_section :pagination => "count", :history => false do %>
|
31
31
|
<%= render :template => "sessions/count" %>
|
32
32
|
<% end %>
|
33
33
|
</div>
|
@@ -42,7 +42,7 @@ $(document).ready(function () {
|
|
42
42
|
<li><%= link_to "About", pages_about_url %></li>
|
43
43
|
</ul>
|
44
44
|
</div>
|
45
|
-
<%=
|
45
|
+
<%= ajax_section :pagination => "", :reload => {:urlpart => "path", :urlregex => "^.*$"}, :loadzone => true do %>
|
46
46
|
<%= render :template => "layouts/flash" %>
|
47
47
|
<% end %>
|
48
48
|
</body>
|
@@ -2,7 +2,7 @@
|
|
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
|
-
<%=
|
5
|
+
<%= ajax_section do %>
|
6
6
|
<p>You are on page <%= params[:page] ||= 1 %>.</p>
|
7
7
|
|
8
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>
|
@@ -27,10 +27,10 @@ This page gives examples of the warnings that may be given, from AJAX Pagination
|
|
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
|
-
<%=
|
30
|
+
<%= ajax_section :pagination => "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
|
-
<%=
|
33
|
+
<%= ajax_section :pagination => "double" do %>My section name is "double".<% end %>
|
34
34
|
<% end %>
|
35
35
|
<p><%= ajax_link_to "Load stuff in section named \"double\"", pages_warnings_path, :pagination => "double", :id => "doublesectionlink" %></p>
|
36
36
|
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= will_paginate @posts, :params => { :pagination => nil } %>
|
2
|
-
<%=
|
2
|
+
<%= ajax_loadzone do %>
|
3
3
|
<% @posts.each do |post| %>
|
4
4
|
<div style="border-bottom: 1px solid black; padding-bottom: 10px;">
|
5
5
|
<p><h3><%= post.title %></h3><i>Published on <%= post.published_at.strftime('%d %B %Y') if post.published_at? %></i></p>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= will_paginate @upcomingposts, :params => { :pagination => nil }, :param_name => :upcomingpage %>
|
2
|
-
<%=
|
2
|
+
<%= ajax_loadzone do %>
|
3
3
|
<% @upcomingposts.each do |post| %>
|
4
4
|
<div style="border-bottom: 1px solid black; padding-bottom: 10px;">
|
5
5
|
<p><h3><%= post.title %></h3><i>Published on <%= post.published_at.strftime('%d %B %Y') if post.published_at? %></i></p>
|
@@ -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
|
-
<%=
|
6
|
+
<%= ajax_section :pagination => "upcomingpage" %>
|
7
7
|
<% end %>
|
8
8
|
<h3>Published</h3>
|
9
9
|
<% end %>
|
10
10
|
|
11
|
-
<%=
|
11
|
+
<%= ajax_section :image => "ajax-loader.gif" %>
|
12
12
|
|
13
13
|
<br />
|
14
14
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajax_pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ronald Ping Man Chan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-09 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|
@@ -160,7 +160,7 @@ files:
|
|
160
160
|
- lib/ajax_pagination/version.rb
|
161
161
|
- lib/assets/images/ajax-loader.gif
|
162
162
|
- lib/assets/javascripts/ajax_pagination.js.erb
|
163
|
-
- lib/assets/stylesheets/ajax_pagination.css
|
163
|
+
- lib/assets/stylesheets/ajax_pagination.css
|
164
164
|
- lib/generators/ajax_pagination/install_generator.rb
|
165
165
|
- lib/generators/templates/ajax_pagination.rb
|
166
166
|
- spec/PORT
|