Add turbolinks to application

This commit is contained in:
Dmitriy Zaporozhets 2013-04-29 10:10:45 +03:00
parent fbb7cd8b76
commit de7d6431b1
5 changed files with 23 additions and 0 deletions

View file

@ -105,6 +105,8 @@ group :assets do
gem "coffee-rails", "~> 3.2.2"
gem "uglifier", "~> 1.3.0"
gem "therubyracer"
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'chosen-rails', "0.9.8"
gem 'select2-rails'

View file

@ -232,6 +232,9 @@ GEM
jquery-rails (2.1.3)
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
jquery-turbolinks (1.0.0)
railties (>= 3.1.0)
turbolinks
jquery-ui-rails (2.0.2)
jquery-rails
railties (>= 3.1.0)
@ -461,6 +464,8 @@ GEM
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
turbolinks (1.1.1)
coffee-rails
tzinfo (0.3.37)
uglifier (1.3.0)
execjs (>= 0.3.0)
@ -521,6 +526,7 @@ DEPENDENCIES
httparty
jquery-atwho-rails (= 0.1.7)
jquery-rails (= 2.1.3)
jquery-turbolinks
jquery-ui-rails (= 2.0.2)
kaminari (~> 0.14.1)
launchy
@ -564,5 +570,6 @@ DEPENDENCIES
test_after_commit
therubyracer
thin
turbolinks
uglifier (~> 1.3.0)
webmock

View file

@ -14,6 +14,8 @@
//= require jquery.waitforimages
//= require jquery.atwho
//= require jquery.scrollto
//= require turbolinks
//= require jquery.turbolinks
//= require bootstrap
//= require modernizr
//= require chosen-jquery

View file

@ -41,6 +41,14 @@ window.linkify = (str) ->
exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig
return str.replace(exp,"<a href='$1'>$1</a>")
window.startSpinner = ->
$('.turbolink-spinner').fadeIn()
window.stopSpinner = ->
$('.turbolink-spinner').fadeOut()
document.addEventListener("page:fetch", startSpinner)
document.addEventListener("page:receive", stopSpinner)
$ ->
# Click a .one_click_select field, select the contents

View file

@ -8,6 +8,10 @@
%span.separator
%h1.project_name= title
%ul.nav
%li
%a
%div.hide.turbolink-spinner
%i.icon-refresh.icon-spin
%li
= render "layouts/search"
%li