Hi, Is there anyway to add an rhtml view file, e.g. app/views/user/logout.rhtml, CSS and meta info which goes into the head section of the HTML file? For example in my logout.rhtml file I want to add a meta tag that will automatically redirect to the front page after 60 seconds and I want to add CSS style data that is only for the logout page. Thanks, Frank
Hi Frank, On 4.5.2005, at 14:32, Frank Kim wrote:> Hi, > > Is there anyway to add an rhtml view file, e.g. > app/views/user/logout.rhtml, CSS and meta info which goes into the > head section of the HTML file? For example in my logout.rhtml file I > want to add a meta tag that will automatically redirect to the front > page after 60 seconds and I want to add CSS style data that is only > for the logout page.You can use content_for (http://rails.rubyonrails.com/classes/ActionView/Helpers/ CaptureHelper.html#M000425) for this. Here''s an example: Layout file: ========... <title><%= ["PIFOrienteering.fi", _("News"), @content_for_title].join(" » ") %></title> <style type="text/css"> <%= @content_for_style %> </style> <body<%= @content_for_body_tag %>> View file: =======<% content_for("body_tag") do %> id="with-bar"<% end %> <% content_for("title") do %> <%= @news.title %><% end %> <% content_for("style") do %> #sidebar { float: right; width: 33%; border: 3px solid #ccc; padding: 5px 10px; } #sidebar h2 { } <% end %> HTH, //jarkko> > Thanks, > Frank > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
http://api.rubyonrails.com/classes/ActionView/Helpers/CaptureHelper.html#M000425
so if my layout has:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Krylls : <%= @title %></title>
  <%= stylesheet_link_tag ''public'' %>
  <script language="JavaScript1.3"
type="text/javascript">
    <!-- hide from old browsers
      <%= @content_for_script %>
    //-->
  </script>
</head>
I can do this in my view..
<% content_for( ''script'' ) do %>
function map_window( url )
{
    popup_window( url, "Map", 
"resizable=no,scrollbars=yes,toolbar=no,status=yes,menubar=no,location=no,directories=no"
);
    return false;
}
function popup_window( url, title, params )
{
    window.open( url, title, params ).focus();
}
function initialize()
{
    return true;
}
<% end %>
Frank Kim wrote:
>Hi,
>
>Is there anyway to add an rhtml view file, e.g.
>app/views/user/logout.rhtml, CSS and meta info which goes into the
>head section of the HTML file?  For example in my logout.rhtml file I
>want to add a meta tag that will automatically redirect to the front
>page after 60 seconds and I want to add CSS style data that is only
>for the logout page.
>
>Thanks,
>Frank
>_______________________________________________
>Rails mailing list
>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>  
>
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails