Skip to content
This repository
Browse code

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...
commit 5d9636e8e0b53f8f5db7ad15917b1ee2ad5e5452 1 parent 6e80d12
Carlos Antonio da Silva carlosantoniodasilva authored
6 railties/CHANGELOG.md
Source Rendered
... ... @@ -1,3 +1,9 @@
  1 +## unreleased ##
  2 +
  3 +* Omit turbolinks configuration completely on skip_javascript generator option.
  4 +
  5 + *Nikita Fedyashev*
  6 +
1 7 ## Rails 4.0.0 (June 25, 2013) ##
2 8
3 9 * Clearing autoloaded constants triggers routes reloading [Fixes #10685].
5 railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
@@ -2,8 +2,13 @@
2 2 <html>
3 3 <head>
4 4 <title><%= camelized %></title>
  5 + <%- if options[:skip_javascript] -%>
  6 + <%%= stylesheet_link_tag "application", media: "all" %>
  7 + <%%= javascript_include_tag "application" %>
  8 + <%- else -%>
5 9 <%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6 10 <%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
  11 + <%- end -%>
7 12 <%%= csrf_meta_tags %>
8 13 </head>
9 14 <body>
11 railties/test/generators/app_generator_test.rb
@@ -53,9 +53,10 @@ def default_files
53 53
54 54 def test_assets
55 55 run_generator
56   - assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
57   - assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
58   - assert_file "app/assets/stylesheets/application.css"
  56 +
  57 + assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
  58 + assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+"application", "data-turbolinks-track" => true/)
  59 + assert_file("app/assets/stylesheets/application.css")
59 60 end
60 61
61 62 def test_invalid_application_name_raises_an_error
@@ -295,6 +296,10 @@ def test_javascript_is_skipped_if_required
295 296 assert_file "app/assets/javascripts/application.js" do |contents|
296 297 assert_no_match %r{^//=\s+require\s}, contents
297 298 end
  299 + assert_file "app/views/layouts/application.html.erb" do |contents|
  300 + assert_match(/stylesheet_link_tag\s+"application", media: "all" %>/, contents)
  301 + assert_match(/javascript_include_tag\s+"application" \%>/, contents)
  302 + end
298 303 assert_file "Gemfile" do |content|
299 304 assert_match(/coffee-rails/, content)
300 305 end

0 comments on commit 5d9636e

Please sign in to comment.
Something went wrong with that request. Please try again.