Stylesheet Rendering Issues

12 views
Skip to first unread message

Steven Natera

unread,
Aug 19, 2014, 3:58:37 PM8/19/14
to rubyonra...@googlegroups.com
I have a landing page and chapter1 page. The landing view is linked to one stylesheet. The chapter1 view is linked to another stylesheet. When I go to the home page the correct CSS is applied but when I click to my next page, the CSS form the landing view is being applied to the chapter1 view. When I refresh the chapter1 view, the correct CSS is applied but then when I click back to the home page, the chapter1 CSS is being applied to the landing view. I suspect my pages are rendering both stylesheets. How do I prevent this? How do I select which stylesheets are rendered for the views?

app/views/layouts/application.html.erb
<!DOCTYPE html>
<html>
<head>
  <title>OrgoDojo</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= yield(:head) %>
  <%= yield(:chapters) %>

  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>

<%= yield %>
<%= render 'layouts/footer_below' %>



</body>
</html>





app/views/pages/chapter1.html.erb
<% content_for(:chapters) do %>
    <%= stylesheet_link_tag 'chapters' , :media => "all" %>  
<% end %>

<%= render 'pages/chapters_header' %>

<h1> This is chapter 1</h1>
<p> Hello Hello </p>



app/views/pages/home.html.erb
<% content_for(:head) do %>
    <%= stylesheet_link_tag 'custom' , :media => "all" %>  
<% end %>

<%= render 'layouts/header' %>
<%= render 'layouts/welcome_section' %>
<%= render 'layouts/benefits_section' %>
<%= render 'layouts/footer_above' %>








tamouse pontiki

unread,
Aug 20, 2014, 11:53:56 PM8/20/14
to rubyonra...@googlegroups.com
On Tue, Aug 19, 2014 at 2:58 PM, Steven Natera <sna...@conncoll.edu> wrote:
I have a landing page and chapter1 page. The landing view is linked to one stylesheet. The chapter1 view is linked to another stylesheet. When I go to the home page the correct CSS is applied but when I click to my next page, the CSS form the landing view is being applied to the chapter1 view. When I refresh the chapter1 view, the correct CSS is applied but then when I click back to the home page, the chapter1 CSS is being applied to the landing view. I suspect my pages are rendering both stylesheets. How do I prevent this? How do I select which stylesheets are rendered for the views?

I'm guessing this is actually a turbolinks problem. When you go *back* to the home page, reload it in the browser and see if it gets displayed correctly at that point.
 
Reply all
Reply to author
Forward
0 new messages