Sha256: caf441a31a1fd4d641c6465a990c7b0e78d8c2b42d9b4ac3150b43ff33731c7d
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
# holidays_img This gem is a simple wrapper for Rails's `image_tag` helper. Leveraging the `holidays` gem, it allows you to easily load images based on the holiday occurring on any given date. ## Installation Add this line to your application's Gemfile: ```ruby gem 'holidays_img' ``` And then execute: ```bash $ bundle ``` ## Usage Simply use the `holidays_image_tag` helper as you would a standard Rails `image_tag`. To ensure proper loading of images, adhere to the following naming convention: - Have a default image, used for when a day does not fall on a holiday (also acts as a fallback for when a holiday image cannot be found) - Name your holiday images in the following format: `original_name_holiday_name` - Ensure all holiday images are in the same directory Naming Examples: ``` image.jpg image_christmas_day.jpg image_new_year_s_day.jpg image_independence_day.jpg ... ``` See the holiday gem's [definition files](https://github.com/holidays/definitions) for a list of holidays for any available region. ## Configuration You can configure options using an initializer: ```ruby # app/initializers/holidays_img.rb HolidaysImg.configure do |config| # Load holidays based on region, defaults to :us config.region = :ca # Only load images for holidays you specify, # defaults to all holidays observed for specified region config.whitelist = ['Christmas Day'] end ``` ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
holidays_img-1.0.0 | README.md |