Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add np-progress for turbolink support #238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions composer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2701,6 +2701,7 @@ def set_default_role
if config['disable_turbolinks']
prefs[:disable_turbolinks] = true
end

if prefs[:disable_turbolinks]
say_wizard "recipe removing support for Rails Turbolinks"
stage_two do
Expand All @@ -2716,6 +2717,15 @@ def set_default_role
gsub_file 'app/views/layouts/application.html.slim', /, 'data-turbolinks-track' => true/, ''
end
end
else
say_wizard "adding support for Rails Turbolinks"
add_gem 'nprogress-rails'
inject_into_file 'app/assets/javascripts/application.js', "//= require nprogress\n//= require nprogress-turbolinks\n", after: "require turbolinks\n"
inject_into_file 'app/assets/stylesheets/application.css', " *= require nprogress\n", after: "*= require_self\n"

if prefs[:frontend] == "bootstrap3" || prefs[:frontend] == "bootstrap2"
inject_into_file 'app/assets/stylesheets/application.css', " *= require nprogress-bootstrap\n", after: "*= require nprogress\n"
end
end

## BAN SPIDERS
Expand Down