Module: Haml::Helpers::ActionViewExtensions

### Home Classes Methods

### In Files

- lib/haml/helpers/action_view_extensions.rb

### Methods

- #generate_content_class_names
- #page_class
- #with_raw_haml_concat

### Class/Module Index

Quicksearch

- Haml
- Haml::Buffer
- Haml::Compiler
- Haml::Engine
- Haml::Error
- Haml::ErubisTemplateHandler
- Haml::Exec
- Haml::Exec::Generic
- Haml::Exec::Haml
- Haml::Filters
- Haml::Filters::Base
- Haml::Filters::Cdata
- Haml::Filters::Css
- Haml::Filters::Erb
- Haml::Filters::Escaped
- Haml::Filters::Javascript
- Haml::Filters::Plain
- Haml::Filters::PrecompiledTiltFilter
- Haml::Filters::Preserve
- Haml::Filters::Ruby
- Haml::Filters::SassRailsTemplate
- Haml::Filters::ScssRailsTemplate
- Haml::Filters::TiltFilter
- Haml::Helpers
- Haml::Helpers::ActionViewExtensions
- Haml::Helpers::ErrorReturn
- Haml::Helpers::XssMods
- Haml::Options
- Haml::Parser
- Haml::Parser::Line
- Haml::Parser::ParseNode
- Haml::Plugin
- Haml::Railtie
- Haml::SafeErubisTemplate
- Haml::SyntaxError
- Haml::Template
- Haml::Util
- Haml::Util::StaticConditionalContext
- ActionView
- ActionView::Base
- ActionView::Helpers
- ActionView::Helpers::CaptureHelper
- ActionView::Helpers::FormHelper
- ActionView::Helpers::FormTagHelper
- ActionView::Helpers::HamlSupport
- ActionView::Helpers::InstanceTag
- ActionView::Helpers::TagHelper
- ActionView::Helpers::Tags
- ActionView::Helpers::Tags::TextArea
- ActionView::Helpers::TextHelper
- Object

No matching classes.

# Haml::Helpers::ActionViewExtensions

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.

### Public Instance Methods

generate_content_class_names() click to toggle source
Alias for: page_class
page_class() click to toggle source

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](sass-lang.com)), you could refer to this specific action:

    .entry.show
      font-weight: bold

or to all actions in the entry controller:

    .entry
      color: #00f

@return [String] The class name for the current page

    # File lib/haml/helpers/action_view_extensions.rb, line 34
    def page_class
      controller.controller_name + " " + controller.action_name
    end

Also aliased as: generate_content_class_names
with_raw_haml_concat() click to toggle source

Treats all input to {Haml::Helpers#haml_concat} within the block as being HTML safe for Rails’ XSS protection. This is useful for wrapping blocks of code that concatenate HTML en masse.

This has no effect if Rails’ XSS protection isn’t enabled.

@yield A block in which all input to `haml_concat` is treated as raw. @see Haml::Util#rails_xss_safe?

    # File lib/haml/helpers/action_view_extensions.rb, line 47
    def with_raw_haml_concat
      old = instance_variable_defined?('@_haml_concat_raw') ? @_haml_concat_raw : false
      @_haml_concat_raw = true
      yield
    ensure
      @_haml_concat_raw = old
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.