Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added :prefix and :suffix options to title_tag

Signed-off-by: Justin French <justin@indent.com.au>
  • Loading branch information...
commit b4547cff7384c5440f2a75ebc769936774701e8e 1 parent 8144883
Mike Pepper authored committed
Showing with 19 additions and 18 deletions.
  1. +19 −18 lib/lovely_layouts.rb
View
37 lib/lovely_layouts.rb
@@ -1,16 +1,16 @@
module LovelyLayouts
-
+
module ContentHelpers
-
+
def title(string)
content_for(:title, string)
end
-
- def title_tag(default='')
- content_tag(:title, @content_for_title || default)
+
+ def title_tag(default='',args={})
+ content_tag(:title, "#{args[:prefix]}#{@content_for_title||default}#{args[:suffix]}")
end
-
+
def description(string)
content_for(:description, string)
@@ -30,7 +30,7 @@ def keywords_tag(default='')
content = @content_for_keywords || default
tag(:meta, :name => "keywords", :content => content) unless content.blank?
end
-
+
def copyright(string)
content_for(:copyright, string)
@@ -49,30 +49,31 @@ def body_id(string)
def body_class(string)
content_for(:body_class, string)
end
-
-
+
+
def body(*args, &block)
options = args.extract_options!
options[:class] ||= @content_for_body_class || default_body_class
options[:id] ||= @content_for_body_id || default_body_id
-
+
contents = capture(&block)
-
+
concat(content_tag(:body, contents, options))
end
-
-
+
+
protected
-
+
def default_body_id
params[:controller]
end
-
+
def default_body_class
[params[:controller], params[:action]].join(" ")
end
-
-
+
+
end
-end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.