rack-pjax 0.6.0 → 0.7.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/README.md CHANGED
@@ -1,13 +1,15 @@
1
- Rack-pjax [![stillmaintained](http://stillmaintained.com/eval/rack-pjax.png)](http://stillmaintained.com/eval/rack-pjax) [![travis](https://secure.travis-ci.org/eval/rack-pjax.png?branch=master)](https://secure.travis-ci.org/#!/eval/rack-pjax)
1
+ Rack-pjax [![travis](https://secure.travis-ci.org/eval/rack-pjax.png?branch=master)](https://secure.travis-ci.org/#!/eval/rack-pjax)
2
2
  ========
3
3
 
4
4
  Rack-pjax is middleware that lets you serve 'chrome-less' pages in respond to [pjax-requests](https://github.com/defunkt/jquery-pjax).
5
5
 
6
- It does this by simply filtering the generated page; only the title and inner-html of the pjax-container are sent to the client.
6
+ It does this by stripping the generated body; only the title and inner-html of the pjax-container are sent to the client.
7
7
 
8
- While this won't save you any time rendering the page, it gives you more flexibility where or how to define the pjax-container.
8
+ While this won't save you any time rendering the page, it gives you more flexibility where and how to define the pjax-container.
9
9
  Ryan Bates featured [rack-pjax on Railscasts](http://railscasts.com/episodes/294-playing-with-pjax) and explains how this gem compares to [pjax_rails](https://github.com/rails/pjax_rails).
10
10
 
11
+ [![railscast](http://railscasts.com/assets/railscasts_logo-1eeafbafc2154fc5340c0a9800f402fd.png)](http://railscasts.com/)
12
+
11
13
  Installation
12
14
  ------------
13
15
 
@@ -68,7 +70,4 @@ Requirements
68
70
  Contributors
69
71
  ------
70
72
 
71
- * [eval](https://github.com/eval)
72
- * [matthooks](https://github.com/matthooks)
73
- * [koszta](https://github.com/koszta)
74
- * [luizcosta](https://github.com/luizcosta)
73
+ [The contributors](https://github.com/eval/rack-pjax/graphs/contributors).
@@ -19,7 +19,7 @@ module Rack
19
19
  b.force_encoding('UTF-8') if RUBY_VERSION > '1.9.0'
20
20
 
21
21
  parsed_body = Nokogiri::HTML(b)
22
- container = parsed_body.at("[@data-pjax-container]")
22
+ container = parsed_body.at(container_selector(env))
23
23
 
24
24
  new_body << begin
25
25
  if container
@@ -44,5 +44,9 @@ module Rack
44
44
  def pjax?(env)
45
45
  env['HTTP_X_PJAX']
46
46
  end
47
+
48
+ def container_selector(env)
49
+ env['HTTP_X_PJAX_CONTAINER'] || "[@data-pjax-container]"
50
+ end
47
51
  end
48
52
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Pjax
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
@@ -36,6 +36,13 @@ describe Rack::Pjax do
36
36
  body.should == "World!"
37
37
  end
38
38
 
39
+ it "should return the inner-html of the custom pjax-container in the body" do
40
+ self.class.app = generate_app(:body => '<html><body><div id="container">World!</div></body></html>')
41
+
42
+ get "/", {}, {"HTTP_X_PJAX" => "true", "HTTP_X_PJAX_CONTAINER" => "#container"}
43
+ body.should == "World!"
44
+ end
45
+
39
46
  it "should handle self closing tags with HTML5 elements" do
40
47
  self.class.app = generate_app(:body => '<html><body><div data-pjax-container><article>World!<img src="test.jpg" /></article></div></body></html>')
41
48
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-pjax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-09 00:00:00.000000000Z
12
+ date: 2013-01-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70336558208980 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70336558208980
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: nokogiri
27
- requirement: &70336558208460 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '1.5'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70336558208460
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.5'
36
46
  description: Serve pjax responses through rack middleware
37
47
  email:
38
48
  - gert@thinkcreate.nl
@@ -67,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
77
  version: '0'
68
78
  segments:
69
79
  - 0
70
- hash: -3701518152791782230
80
+ hash: 2691976653533347282
71
81
  required_rubygems_version: !ruby/object:Gem::Requirement
72
82
  none: false
73
83
  requirements:
@@ -76,10 +86,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
86
  version: '0'
77
87
  segments:
78
88
  - 0
79
- hash: -3701518152791782230
89
+ hash: 2691976653533347282
80
90
  requirements: []
81
91
  rubyforge_project: rack-pjax
82
- rubygems_version: 1.8.10
92
+ rubygems_version: 1.8.23
83
93
  signing_key:
84
94
  specification_version: 3
85
95
  summary: Serve pjax responses through rack middleware