Oops... forgot to add a few files.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@421 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-03-17 05:22:03 +00:00
parent 989004d354
commit 7b6d285294
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,45 @@
require 'haml/helpers/action_view_mods'
if defined?(Haml::Helpers::ActionViewMods)
module Haml
module Helpers
# This module contains various useful helper methods
# that either tie into ActionView or the rest of the ActionPack stack,
# or are only useful in that context.
# Thus, the methods defined here are only available
# if ActionView is installed.
module ActionViewExtensions
# Returns a value for the "class" attribute
# unique to this controller/action pair.
# This can be used to target styles specifically at this action or controller.
# For example, if the current action were EntryController#show,
#
# %div{:class => page_class} My Div
#
# would become
#
# <div class="entry show">My Div</div>
#
# Then, in a stylesheet
# (shown here as Sass),
# you could refer to this specific action:
#
# .entry.show
# :font-weight bold
#
# or to all actions in the entry controller:
#
# .entry
# :color #00f
#
def page_class
controller.controller_name + " " + controller.action_name
end
# :stopdoc:
alias_method :generate_content_class_names, :page_class
# :startdoc:
end
end
end
end

View File

@ -0,0 +1,12 @@
a { color: #000; }
a:hover { color: #f00; }
p, div { width: 100em; }
p foo, div foo { width: 10em; }
#cool { border-style: solid; border-width: 2em; }
.ie7 #cool, .ie6 #cool { content: string(Totally not cool.); }
.firefox #cool { content: string(Quite cool.); }
.wow, .snazzy { font-family: fantasy; }
.wow:hover, .wow:visited, .snazzy:hover, .snazzy:visited { font-weight: bold; }