adding content titles

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@26 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2007-11-15 23:42:26 +00:00
parent a7b0d46473
commit 07b86bf631
2 changed files with 11 additions and 10 deletions

View File

@ -3,9 +3,16 @@ module ApplicationHelper
# Returns the title for a page. This could be a Page title or something else. # Returns the title for a page. This could be a Page title or something else.
# #
def page_title def page_title
"BarleySodas :: #{controller.class.to_s.gsub(/Controller/, '')}"
end
##
# Returns a pretty name for the current chunk.
#
def content_title
return @page_title if @page_title return @page_title if @page_title
return @page.title if @page return @page.title if @page
"BarleySodas :: #{controller_class_name.gsub(/Controller/, '')}" "BarleySodas"
end end
## ##

View File

@ -1,21 +1,16 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title> <title><%= page_title -%></title>
<%= page_title -%>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<%= stylesheet_link_tag 'application', :media => 'all' %> <%= stylesheet_link_tag 'application', :media => 'all' %>
<%= javascript_include_tag :defaults %> <%= javascript_include_tag :defaults %>
<script type="text/javascript"> <script type="text/javascript">
<%= @content_for_script %> <%= @content_for_script %>
</script> </script>
</head> </head>
<body> <body>
<div id="container"> <div id="container">
<% flash.keys.each do |key| -%> <% flash.keys.each do |key| -%>
<div id="<%= key -%>"> <div id="<%= key -%>">
@ -24,7 +19,7 @@
<% end -%> <% end -%>
<div id="header"> <div id="header">
<h1><%= page_title -%></h1> <h1><%= content_title -%></h1>
<h2><%= secondary_title -%></h2> <h2><%= secondary_title -%></h2>
</div> </div>
@ -44,5 +39,4 @@
</div> </div>
</div> </div>
</body>
</body>