Sha256: 1e1d14663f2b17f7993ab2fdf1a20d10929e7e04656e34b1a7f5f19f9511b84d

Contents?: true

Size: 1.34 KB

Versions: 65

Compression:

Stored size: 1.34 KB

Contents

require 'haml/helpers/action_view_mods'

if defined?(ActionView)
  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

Version data entries

65 entries across 65 versions & 12 rubygems

Version Path
gohanlonllc-haml-2.1.0.20080513000000 lib/haml/helpers/action_view_extensions.rb
gohanlonllc-haml-2.1.0 lib/haml/helpers/action_view_extensions.rb
honkster-haml-2.1.0 lib/haml/helpers/action_view_extensions.rb
honkster-haml-2.1.1 lib/haml/helpers/action_view_extensions.rb
jwhitmire-haml-2.1.0.1 lib/haml/helpers/action_view_extensions.rb
jwhitmire-haml-2.1.0.2 lib/haml/helpers/action_view_extensions.rb
jwhitmire-haml-2.1.0.3 lib/haml/helpers/action_view_extensions.rb
wireframe-haml-2.1.0 lib/haml/helpers/action_view_extensions.rb
wireframe-haml-2.1.1 lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.2.4 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.2.2 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.2.1 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.2 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.1.9 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.1.8 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.1.7 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.1.6 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiantcms-couchrest_model-0.1.5 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiant-0.7.2 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb
radiant-0.8.2 vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb