Permalink
Browse files

Merge pull request #11163 from nfedyashev/omit_turbolinks_on_javascri…

…pt_skip_option

Omit turbolinks configuration completely on skip_javascript generator option
Conflicts:
	railties/CHANGELOG.md
  • Loading branch information...
1 parent 6e80d12 commit 5d9636e8e0b53f8f5db7ad15917b1ee2ad5e5452 @carlosantoniodasilva carlosantoniodasilva committed Jun 28, 2013
View
6 railties/CHANGELOG.md
@@ -1,3 +1,9 @@
+## unreleased ##
+
+* Omit turbolinks configuration completely on skip_javascript generator option.
+
+ *Nikita Fedyashev*
+
## Rails 4.0.0 (June 25, 2013) ##
* Clearing autoloaded constants triggers routes reloading [Fixes #10685].
View
5 railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
@@ -2,8 +2,13 @@
<html>
<head>
<title><%= camelized %></title>
+ <%- if options[:skip_javascript] -%>
+ <%%= stylesheet_link_tag "application", media: "all" %>
+ <%%= javascript_include_tag "application" %>
+ <%- else -%>
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
+ <%- end -%>
<%%= csrf_meta_tags %>
</head>
<body>
View
11 railties/test/generators/app_generator_test.rb
@@ -53,9 +53,10 @@ def default_files
def test_assets
run_generator
- assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
- assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
- assert_file "app/assets/stylesheets/application.css"
+
+ assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
+ assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+"application", "data-turbolinks-track" => true/)
+ assert_file("app/assets/stylesheets/application.css")
end
def test_invalid_application_name_raises_an_error
@@ -295,6 +296,10 @@ def test_javascript_is_skipped_if_required
assert_file "app/assets/javascripts/application.js" do |contents|
assert_no_match %r{^//=\s+require\s}, contents
end
+ assert_file "app/views/layouts/application.html.erb" do |contents|
+ assert_match(/stylesheet_link_tag\s+"application", media: "all" %>/, contents)
+ assert_match(/javascript_include_tag\s+"application" \%>/, contents)
+ end
assert_file "Gemfile" do |content|
assert_match(/coffee-rails/, content)
end

0 comments on commit 5d9636e

Please sign in to comment.