Socket
Book a DemoInstallSign in
Socket

bootstrap_calendar_rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap_calendar_rails

0.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Calendar helper for Twitter Bootstrap and Rails

This gem provide simple and easy way to create calendar with Twitter Bootstrap and Rails.

Installation

First of all you should include twitter bootstrap in your app. You can do it manually, or use twitter-bootstrap-rails gem.

Installing the Less stylesheets

To use Less stylesheets, you'll need the less-rails gem, and one of Javascript runtimes supported by CommonJS.

Include these lines in the Gemfile to install the gems from RubyGems.org:

gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "bootstrap_calendar_rails"

Then run bundle install from the command line:

bundle install

Then run the bootstrap generator to add Calendar includes into your assets:

rails generate calendar:install less

Installing the CSS stylesheets

If you don't need to customize the stylesheets using Less, the only gem you need is the bootstrap_calendar_rails gem:

gem "bootstrap_calendar_rails"

After running bundle install, run the generator:

rails generate calendar:install static

Usage

Basic usage

You should use something like this in the view

bootstrap_calendar Date.today {} do |date|
    date.day.to_s
end

it show you calendar for the current month.

Advanced usage

You can specify another start week day. Use start_day key for this:

bootstrap_calendar Date.today { start_day: :wednesday } do |date|
    date.day.to_s
end

You can extend day classes. Use extra_day_classes key and lambda for this:

options = { extra_day_classes: lambda { |classes, date|
  classes << 'cal-day-daylight' if true  
  }
}
bootstrap_calendar Date.today, options do |date|
  date.day.to_s
end

Example application

An example application is available at sharpyfox/bootstrap_calendar_rails_example. You can view it running on heroku here. Contributions welcome.

Screenshot

Inspiration

This gem are highly inspired by:

davidray and davidray / twitter-bootstrap-calendar Basically this gem is an adoptation davidray / twitter-bootstrap-calendar for my flavour

Serhioromano and Serhioromano / bootstrap-calendar I stole all css markup from him

Thanks guys!

Contribution

If you'd like to add features (or bug fixes) to improve the gem, you can fork the GitHub repo and make pull requests. Your code contributions are welcome!

FAQs

Package last updated on 11 May 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.