Socket
Book a DemoInstallSign in
Socket

body_id

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

body_id

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

BodyId

body_id logo

Create a custom body_id from your controller and action names.

Pages#index #=> #page-index
Cars#new #=> #car-new

Installation

Add this line to your application's Gemfile:

gem 'body_id'

And then execute:

$ bundle

Or install it yourself as:

$ gem install body_id

Usage

In your application.html.erb, or other layout files set, body_id as the body tag's ID ###ERB

...
</head>
    <body id= <%= body_id %>>
        <%= yield %>
    </body>
</html>

###HAML

...
%body{ id: "#{ body_id }" }
...

Custom body_id

In case you want a custom ID for your body tag, simply create an instance variable with what you want the view's body_id to be.

class PagesContrller < ApplicationController
  def index
    @body_id = 'home'
  end

  def new
    @body_id = 'awesome-custom-id'
  end
end

Contributing

  • Fork it ( http://github.com/the4dpatrick/body-id-gem )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 18 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.