· 1 min read

Screencast: Mit PJAX Bereiche aktualisieren

Downloads in verschiedenen Formaten:

mp4 m4v webm ogg

Resourcen:

Gemfile

[ruby] gem ‘pjax_rails’ [/ruby]

app/assets/javascripts/application.js

[javascript] //= require jquery.pjax [/javascript]

layouts/application.html.erb

[html]

<%= yield %>
[/html]

index.html.erb

[html]

<%= yield(:title) %> [/html]

Gemfile

[ruby] gem ‘rack-pjax’ [/ruby]

config/application.rb

[ruby] config.middleware.use Rack::Pjax [/ruby]

bash

[bash] mkdir -p vendor/assets/javascripts curl https://raw.github.com/defunkt/jquery-pjax/master/jquery.pjax.js > vendor/assets/javascripts/jquery.pjax.js [/bash]

app/assets/javascripts/application.js

[javascript] //= require jquery.pjax [/javascript]

products.js.coffee

[javascript] jQuery -> $(‘.product a’).pjax(‘[data-pjax-container]’) [/javascript]

index.html.erb

[html] </<div data-pjax-container> … </div> [/html]

Back to Blog