ajax_pagination 0.5.1 → 0.6.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.
- data/.gitignore +1 -1
- data/.travis.yml +0 -1
- data/CHANGELOG.md +15 -0
- data/README.md +5 -5
- data/lib/ajax_pagination/controller_additions.rb +48 -31
- data/lib/ajax_pagination/helper_additions.rb +48 -24
- data/lib/ajax_pagination/rails.rb +0 -7
- data/lib/ajax_pagination/version.rb +1 -1
- data/lib/assets/javascripts/ajax_pagination.js.erb +11 -14
- data/spec/ajax_pagination/controller_additions_spec.rb +15 -3
- data/spec/ajax_pagination/helper_additions_spec.rb +1 -1
- data/spec/ajax_pagination/integration/ajaxpaginate_spec.rb +10 -9
- data/spec/ajax_pagination/integration/nojavascript_spec.rb +7 -7
- data/spec/ajax_pagination/integration/paginate_spec.rb +8 -8
- data/spec/ajax_pagination/integration/rails30_spec.rb +1 -1
- data/spec/rails30_app/app/controllers/application_controller.rb +2 -2
- data/spec/rails30_app/app/controllers/changelog_controller.rb +1 -1
- data/spec/rails30_app/app/controllers/pages_controller.rb +2 -9
- data/spec/rails30_app/app/views/changelog/_page.html.erb +6 -2
- data/spec/rails30_app/app/views/changelog/index.html.erb +1 -1
- data/spec/rails30_app/app/views/layouts/application.html.erb +5 -5
- data/spec/rails30_app/app/views/sessions/count.html.erb +1 -1
- data/spec/rails30_app/public/javascripts/ajax_pagination.js +12 -15
- data/spec/rails_app/app/controllers/application_controller.rb +2 -2
- 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 +6 -2
- data/spec/rails_app/app/views/changelog/index.html.erb +1 -1
- data/spec/rails_app/app/views/layouts/application.html.erb +5 -5
- data/spec/rails_app/app/views/pages/warnings.html.erb +8 -7
- data/spec/rails_app/app/views/posts/_page.html.erb +9 -5
- data/spec/rails_app/app/views/posts/_upcomingpage.html.erb +6 -2
- data/spec/rails_app/app/views/posts/index.html.erb +2 -2
- data/spec/rails_app/app/views/posts/show.html.erb +1 -1
- data/spec/rails_app/app/views/sessions/count.html.erb +1 -1
- metadata +86 -132
- data/spec/rails30_app/Gemfile.lock +0 -96
- data/spec/rails30_app/app/views/pages/warnings.html.erb +0 -43
- data/spec/rails_app/Gemfile.lock +0 -107
@@ -1,8 +1,15 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
module SetAjaxSection
|
4
|
+
def ajax_section= (name)
|
5
|
+
@_ajax_section = name
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
describe AjaxPagination::ControllerAdditions do
|
4
10
|
def stub_pagination(name)
|
5
11
|
@controller.stub!(:params).and_return({:pagination => name, :controller => "dummycontroller"})
|
12
|
+
@controller.ajax_section = name
|
6
13
|
end
|
7
14
|
def stub_request_format_html(bool)
|
8
15
|
@controller.stub!(:request).and_return(stub({:format => stub(:html? => bool), :GET => {} }))
|
@@ -12,10 +19,14 @@ describe AjaxPagination::ControllerAdditions do
|
|
12
19
|
end
|
13
20
|
before :each do
|
14
21
|
@controller_class = Class.new
|
22
|
+
@controller_class.stub!(:around_filter)
|
23
|
+
@controller_class.stub!(:before_filter)
|
24
|
+
@controller_class.stub!(:after_filter)
|
15
25
|
@controller = @controller_class.new
|
16
26
|
@controller.stub!(:params).and_return({})
|
17
27
|
stub_request_format_html(false)
|
18
28
|
@controller_class.send(:include, AjaxPagination::ControllerAdditions)
|
29
|
+
@controller_class.send(:include, SetAjaxSection)
|
19
30
|
@formatter = Class.new
|
20
31
|
@formatter.stub!(:html).and_return(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) # to detect how many times the function was called
|
21
32
|
stub_lookup_context([]) # no partial matching
|
@@ -30,9 +41,10 @@ describe AjaxPagination::ControllerAdditions do
|
|
30
41
|
@formatter.html.should == 0
|
31
42
|
end
|
32
43
|
it 'should render when pagination parameter matches' do
|
33
|
-
stub_pagination('
|
44
|
+
stub_pagination('global')
|
34
45
|
@controller.ajax_respond(@formatter).should be_true
|
35
46
|
@formatter.html.should == 1 # detects html function was called once (but checking also calls the function) ...
|
47
|
+
stub_pagination('page')
|
36
48
|
@controller.ajax_respond(@formatter, :pagination => :page).should be_true
|
37
49
|
@formatter.html.should == 3 # ... which is why the next check should be 2 more html function calls
|
38
50
|
@controller.ajax_respond(@formatter, :pagination => 'page').should be_true
|
@@ -43,7 +55,7 @@ describe AjaxPagination::ControllerAdditions do
|
|
43
55
|
stub_lookup_context(['matching_partial_found'])
|
44
56
|
@controller.ajax_respond(@formatter, :pagination => 'pageX').should be_true
|
45
57
|
@formatter.html.should == 9
|
46
|
-
stub_pagination('
|
58
|
+
stub_pagination('global')
|
47
59
|
@controller.ajax_respond(@formatter).should be_true
|
48
60
|
@formatter.html.should == 11
|
49
61
|
|
@@ -69,7 +81,7 @@ describe AjaxPagination::ControllerAdditions do
|
|
69
81
|
end
|
70
82
|
it 'should display partial when .html?pagination=pagename' do
|
71
83
|
stub_request_format_html(true)
|
72
|
-
stub_pagination('
|
84
|
+
stub_pagination('global')
|
73
85
|
@controller.ajax_section_displayed?.should be_true
|
74
86
|
stub_pagination('page2')
|
75
87
|
@controller.ajax_section_displayed?('page2').should be_true
|
@@ -15,7 +15,7 @@ describe AjaxPagination::HelperAdditions do
|
|
15
15
|
end
|
16
16
|
describe 'ajax_section' do
|
17
17
|
it 'should render partial requested, default of page with no arguments' do
|
18
|
-
@view.should_receive(:render).with('
|
18
|
+
@view.should_receive(:render).with('global')
|
19
19
|
@view.ajax_section
|
20
20
|
@view.should_receive(:render).with('page2')
|
21
21
|
@view.ajax_section :pagination => 'page2' # renders the partial named :pagination if :partial not defined
|
@@ -33,7 +33,7 @@ describe 'paginating with javascript on', :js => true do
|
|
33
33
|
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
34
34
|
sleep(2)
|
35
35
|
page.should have_selector('#changelogpagetitle')
|
36
|
-
find('#
|
36
|
+
find('#page').find('.next_page').click
|
37
37
|
page.should have_selector('.ajaxpagination-loader')
|
38
38
|
sleep(1.5)
|
39
39
|
page.should have_no_selector('.ajaxpagination-loader')
|
@@ -42,12 +42,12 @@ describe 'paginating with javascript on', :js => true do
|
|
42
42
|
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
43
43
|
sleep(2)
|
44
44
|
page.should have_selector('#postspagetitle')
|
45
|
-
find('#
|
45
|
+
find('#page').find('.next_page').click
|
46
46
|
sleep(0.5) # failed once on travis rbx without sleep
|
47
47
|
page.should have_selector('.ajaxpagination-loader')
|
48
48
|
sleep(1.5)
|
49
49
|
page.should have_no_selector('.ajaxpagination-loader')
|
50
|
-
find('#
|
50
|
+
find('#upcomingpage').find('.next_page').click
|
51
51
|
page.should have_selector('.ajaxpagination-loader')
|
52
52
|
sleep(1.5)
|
53
53
|
page.should have_no_selector('.ajaxpagination-loader')
|
@@ -57,18 +57,18 @@ describe 'paginating with javascript on', :js => true do
|
|
57
57
|
retry_exceptions do
|
58
58
|
# warmup images
|
59
59
|
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
60
|
-
find('#
|
60
|
+
find('#page').find('.next_page').click
|
61
61
|
sleep(3)
|
62
62
|
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
63
|
-
find('#
|
63
|
+
find('#page').find('.next_page').click
|
64
64
|
sleep(3)
|
65
65
|
|
66
66
|
visit("http://localhost:#{SERVERSLOWPORT}/changelog")
|
67
|
-
find('#
|
67
|
+
find('#page').find('.next_page').click
|
68
68
|
page.should have_xpath("//img[@class='ajaxpagination-loader' and @src = '/assets/myajax-loader.gif']")
|
69
69
|
sleep(1.5)
|
70
70
|
visit("http://localhost:#{SERVERSLOWPORT}/posts")
|
71
|
-
find('#
|
71
|
+
find('#page').find('.next_page').click
|
72
72
|
page.should have_xpath("//img[@class='ajaxpagination-loader' and @src = '/assets/ajax-loader.gif']")
|
73
73
|
end
|
74
74
|
end
|
@@ -165,8 +165,8 @@ describe 'paginating with javascript on', :js => true do
|
|
165
165
|
end
|
166
166
|
it 'submits ajax_form_for form via POST and DELETE link' do
|
167
167
|
retry_exceptions do
|
168
|
-
visit("http://localhost:#{SERVERPORT}")
|
169
|
-
find('#signin').click
|
168
|
+
visit("http://localhost:#{SERVERPORT}/")
|
169
|
+
find('#signin').click if !page.has_selector?('#signout')
|
170
170
|
click_link("Posts")
|
171
171
|
sleep(1)
|
172
172
|
page.should have_content("New Post")
|
@@ -186,6 +186,7 @@ describe 'paginating with javascript on', :js => true do
|
|
186
186
|
|
187
187
|
count = ajaxCount
|
188
188
|
click_link("Destroy");
|
189
|
+
sleep(2)
|
189
190
|
page.driver.browser.switch_to.alert.accept
|
190
191
|
sleep(2)
|
191
192
|
page.should have_content("Post destroyed.")
|
@@ -15,15 +15,15 @@ describe 'paginating without javascript', :type => :request, :driver => :rack_te
|
|
15
15
|
it 'still paginates nested and multiple paginated sections' do
|
16
16
|
visit(changelog_url)
|
17
17
|
page.should have_selector('.previous_page.disabled')
|
18
|
-
find('#
|
18
|
+
find('#page').find('.next_page').click
|
19
19
|
page.should have_no_selector('.previous_page.disabled')
|
20
20
|
find('#signin').click
|
21
21
|
visit(posts_url)
|
22
|
-
page.should have_selector('#
|
23
|
-
find('#
|
24
|
-
page.should have_no_selector('#
|
25
|
-
page.should have_selector('#
|
26
|
-
find('#
|
27
|
-
page.should have_no_selector('#
|
22
|
+
page.should have_selector('#upcomingpage .previous_page.disabled')
|
23
|
+
find('#upcomingpage').find('.next_page').click
|
24
|
+
page.should have_no_selector('#upcomingpage .previous_page.disabled')
|
25
|
+
page.should have_selector('#page .previous_page.disabled')
|
26
|
+
find('#page').find('.next_page').click
|
27
|
+
page.should have_no_selector('#page .previous_page.disabled')
|
28
28
|
end
|
29
29
|
end
|
@@ -14,18 +14,18 @@ describe 'paginating with javascript on', :type => :request, :driver => :seleniu
|
|
14
14
|
it 'works with nested and multiple paginated sections' do
|
15
15
|
visit("http://localhost:#{SERVERPORT}/changelog")
|
16
16
|
page.should have_selector('.previous_page.disabled')
|
17
|
-
find('#
|
17
|
+
find('#page').find('.next_page').click
|
18
18
|
page.should have_no_selector('.previous_page.disabled')
|
19
19
|
find('#signin').click
|
20
20
|
visit("http://localhost:#{SERVERPORT}/posts")
|
21
|
-
page.should have_selector('#
|
22
|
-
find('#
|
21
|
+
page.should have_selector('#page .previous_page.disabled')
|
22
|
+
find('#page').find('.next_page').click
|
23
23
|
sleep(1)
|
24
|
-
page.should have_no_selector('#
|
25
|
-
page.should have_selector('#
|
26
|
-
find('#
|
24
|
+
page.should have_no_selector('#page .previous_page.disabled')
|
25
|
+
page.should have_selector('#upcomingpage .previous_page.disabled')
|
26
|
+
find('#upcomingpage').find('.next_page').click
|
27
27
|
sleep(1)
|
28
|
-
page.should have_no_selector('#
|
29
|
-
page.should have_no_selector('#
|
28
|
+
page.should have_no_selector('#upcomingpage .previous_page.disabled')
|
29
|
+
page.should have_no_selector('#page .previous_page.disabled')
|
30
30
|
end
|
31
31
|
end
|
@@ -18,7 +18,7 @@ describe 'rails3.0 support', :type => :request, :driver => :selenium do
|
|
18
18
|
click_link 'Changelog'
|
19
19
|
sleep(2)
|
20
20
|
page.should have_selector('#changelogpagetitle')
|
21
|
-
find('#
|
21
|
+
find('#page').find('.next_page').click
|
22
22
|
page.should have_selector('.ajaxpagination-loader')
|
23
23
|
sleep(1.5)
|
24
24
|
page.should have_no_selector('.ajaxpagination-loader')
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
before_filter :slowajaxload
|
4
|
-
ajax_respond :
|
4
|
+
ajax_respond :render => { :layout => "ajax" }
|
5
5
|
def slowajaxload
|
6
|
-
if (
|
6
|
+
if (!ajax_section.nil?) && Rails.env == "test"
|
7
7
|
delay = 0
|
8
8
|
delay = ENV['AJAX_DELAY'] if ENV['AJAX_DELAY']
|
9
9
|
sleep(delay.to_f)
|
@@ -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
|
-
ajax_respond format, :
|
8
|
+
ajax_respond format, :section_id => "global", :render => {:file => "pages/readme", :layout => "ajax"}
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -15,14 +15,7 @@ class PagesController < ApplicationController
|
|
15
15
|
def welcome
|
16
16
|
respond_to do |format|
|
17
17
|
format.html
|
18
|
-
ajax_respond format, :
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def warnings
|
23
|
-
respond_to do |format|
|
24
|
-
format.html
|
25
|
-
ajax_respond format, :pagination => "disable", :render => { :layout => "ajax" }
|
18
|
+
ajax_respond format, :section_id => "global", :render => { :layout => "ajax" }
|
26
19
|
end
|
27
20
|
end
|
28
21
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<%=
|
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
|
-
<%=
|
12
|
+
<%= ajax_links :section_id => "page" do %>
|
13
|
+
<%= will_paginate @changelogs %>
|
14
|
+
<% end %>
|
@@ -29,20 +29,20 @@ $(document).ready(function () {
|
|
29
29
|
</script>
|
30
30
|
|
31
31
|
<div style="float: right; min-width: 150px;">
|
32
|
-
<%= ajax_section :
|
32
|
+
<%= ajax_section :id => "count", :history => false do %>
|
33
33
|
<%= render :template => "sessions/count" %>
|
34
34
|
<% end %>
|
35
35
|
</div>
|
36
|
-
<h1><%= ajax_link_to "AJAX Pagination Example Application", "broken link"
|
37
|
-
|
36
|
+
<h1><%= ajax_link_to "AJAX Pagination Example Application", "broken link" %><!-- note the broken link is intentional, for testing purposes --></h1>
|
37
|
+
<%= ajax_links :section_id => "global", :class => "menu" do %>
|
38
38
|
<ul>
|
39
39
|
<li><%= link_to "Home", root_url %></li>
|
40
40
|
<li><%= link_to "Changelog", changelog_url %></li>
|
41
41
|
<li><%= link_to "Readme", pages_readme_url %></li>
|
42
42
|
<li><%= link_to "About", pages_about_url %></li>
|
43
43
|
</ul>
|
44
|
-
|
45
|
-
<%= ajax_section :
|
44
|
+
<% end %>
|
45
|
+
<%= ajax_section :reload => {:urlpart => "path", :urlregex => "^.*$"}, :loadzone => true do %>
|
46
46
|
<%= render :template => "layouts/flash" %>
|
47
47
|
<% end %>
|
48
48
|
</body>
|
@@ -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", :
|
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>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
//= require jquery.url
|
3
3
|
|
4
4
|
/*
|
5
|
-
* AJAX Pagination: Ajaxifying your
|
5
|
+
* AJAX Pagination: Ajaxifying your navigation
|
6
6
|
* https://github.com/ronalchn/ajax_pagination
|
7
7
|
*
|
8
8
|
* Copyright (c) 2012 Ronald Ping Man Chan
|
@@ -47,7 +47,7 @@ jQuery(document).ready(function () {
|
|
47
47
|
$.ajax_pagination = function (pagination_name) {
|
48
48
|
return new pagination_object(pagination_name);
|
49
49
|
};
|
50
|
-
$.ajax_pagination.version = '0.
|
50
|
+
$.ajax_pagination.version = '0.6.0';
|
51
51
|
$.ajax_pagination.enabled = true;
|
52
52
|
function pagination_object(pagination_name) {
|
53
53
|
this.get = function(url,options) {
|
@@ -56,7 +56,7 @@ jQuery(document).ready(function () {
|
|
56
56
|
swapPage(pagination_name,url,options.history);
|
57
57
|
}
|
58
58
|
this.exists = function() {
|
59
|
-
return $('#' + pagination_name
|
59
|
+
return $('#' + pagination_name).length == 1;
|
60
60
|
}
|
61
61
|
}
|
62
62
|
/////////////////////////////
|
@@ -95,15 +95,13 @@ jQuery(document).ready(function () {
|
|
95
95
|
}
|
96
96
|
}
|
97
97
|
function getSection(pagination_name) {
|
98
|
-
var id = "#" + pagination_name
|
98
|
+
var id = "#" + pagination_name; // element id we are looking for
|
99
99
|
return $(id);
|
100
100
|
}
|
101
101
|
function getSectionName(section) {
|
102
102
|
var id = section.attr("id");
|
103
103
|
if (id === undefined) return undefined; // no name
|
104
|
-
|
105
|
-
if (pagination_name == null || pagination_name === undefined) return undefined; // pagination not set up properly
|
106
|
-
return pagination_name;
|
104
|
+
return id; // id = pagination_name
|
107
105
|
}
|
108
106
|
function getSectionNames(sections) {
|
109
107
|
var names = new Array();
|
@@ -158,9 +156,9 @@ jQuery(document).ready(function () {
|
|
158
156
|
// this event handler has the same arguments as for jquery and jquery-ujs, except it also takes the name of the section to put the content into as first argument
|
159
157
|
// adapter functions will be used to reconcile the differences in arguments, this is required because jquery and jquery-ujs has different ways to get the pagination_name argument
|
160
158
|
function beforeSendHandler(pagination_name,jqXHR,settings) {
|
161
|
-
var id = "#" + pagination_name
|
159
|
+
var id = "#" + pagination_name; // element id we are looking for
|
162
160
|
var requesturl = settings.url;
|
163
|
-
var countid = $('[id="' + pagination_name + '
|
161
|
+
var countid = $('[id="' + pagination_name + '"]').length;
|
164
162
|
if (countid != 1) { // something wrong, cannot find unique section to load page into
|
165
163
|
|
166
164
|
alert("AJAX Pagination UNIQUE_SECTION_NOT_FOUND:\nExpected one pagination section called " + pagination_name + ", found " + countid);
|
@@ -234,7 +232,7 @@ jQuery(document).ready(function () {
|
|
234
232
|
});
|
235
233
|
}
|
236
234
|
function pushHistory(pagination_name,url) {
|
237
|
-
var data = $("#" + pagination_name
|
235
|
+
var data = $("#" + pagination_name).data("pagination");
|
238
236
|
if (data === undefined || data.history === undefined || data.history) { // check that history is not disabled
|
239
237
|
// construct visible url
|
240
238
|
var data = $.deparam.querystring($.url(url).attr('query'));
|
@@ -252,21 +250,20 @@ jQuery(document).ready(function () {
|
|
252
250
|
}
|
253
251
|
}
|
254
252
|
// these special containers are for convenience only, to apply the required data-remote, data-pagination attributes to all links inside
|
255
|
-
$(document).on("click", ".
|
253
|
+
$(document).on("click", ".ajaxpagination a", function(e) {
|
256
254
|
// ignore if already selected by jquery-ujs
|
257
255
|
if ($(this).filter($.rails.linkClickSelector).length>0) return true; // continue with jquery-ujs - this behaviour is necessary because we do not know if the jquery-ujs handler executes before or after this handler
|
258
256
|
// find out what data-pagination should be set to
|
259
|
-
var pagination_container = $(this).closest(".
|
257
|
+
var pagination_container = $(this).closest(".ajaxpagination"); // container of links (use to check for data-pagination first)
|
260
258
|
var pagination_name = pagination_container.data('pagination');
|
261
259
|
if (pagination_name === undefined) {
|
262
|
-
pagination_name =
|
260
|
+
pagination_name = $(this).closest(".paginated_section").attr("id"); // if data-pagination not present, search up the tree for a suitable section
|
263
261
|
if (pagination_name == null) {
|
264
262
|
|
265
|
-
alert("AJAX Pagination MISSING_REFERENCE:\nNo pagination section
|
263
|
+
alert("AJAX Pagination MISSING_REFERENCE:\nNo pagination section id given for link, and none could be implicitly assigned, AJAX cancelled for this request");
|
266
264
|
|
267
265
|
return true; // pagination not set up properly
|
268
266
|
}
|
269
|
-
pagination_name = pagination_name[1];
|
270
267
|
}
|
271
268
|
|
272
269
|
// set data-remote, data-pagination
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
before_filter :slowajaxload
|
4
|
-
ajax_respond :
|
4
|
+
ajax_respond :section_id => "global", :render => { :layout => "ajax" }
|
5
5
|
def slowajaxload
|
6
|
-
if (
|
6
|
+
if (!ajax_section.nil?) && Rails.env == "test"
|
7
7
|
delay = 0
|
8
8
|
delay = ENV['AJAX_DELAY'] if ENV['AJAX_DELAY']
|
9
9
|
sleep(delay.to_f)
|
@@ -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
|
-
ajax_respond format, :
|
8
|
+
ajax_respond format, :section_id => "global", :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
|
-
ajax_respond format, :
|
18
|
+
ajax_respond format, :section_id => "global", :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
|
-
ajax_respond format, :
|
25
|
+
ajax_respond format, :section_id => "disable", :render => { :layout => "ajax" }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class PostsController < ApplicationController
|
2
|
-
ajax_respond :
|
2
|
+
ajax_respond :section_id => '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
|
-
ajax_respond format, :
|
12
|
-
ajax_respond format, :
|
11
|
+
ajax_respond format, :section_id => :upcomingpage
|
12
|
+
ajax_respond format, :section_id => "", :render => { :layout => "ajax" }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|