Ribbonit displays an elegant ribbon to the corner of the page displaying useful information about the application: Rails environment, Rails version, Ruby version.
It is completely inspired from the Github 'fork me' ribbon.
Add this line to your application's Gemfile:
# Gemfile
gem 'ribbonit'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ribbonit
- Run initializer
$ bin/rails g ribbonit:install
This will create a ribbonit.rb
file in config/initializers
- Import assets
/* application.css */
/*
*= require ribbon
*/
- Call ribbon in layout
/ application.slim
...
body
= ribbonit
You can customize some options through the initializer. Here are the default ones:
# config/initializers/ribbonit.rb
Ribbonit.configure do |config|
# rails_version: Version of Ruby on Rails
# ruby_version: Version of Ruby
# git_branch: Current git branch (only displayed in development)
config.infos_to_display = %i[rails_version ruby_version git_branch]
# additional extra content to display at the bottom of ribbon
config.extra_content = nil # 'Foo bar'
config.root_link = false # Wrap ribbon with root_url link ?
config.hide_for_small = true # Display ribbon in small devices ?
config.position = 'top-left' # top-right, bottom-left, bottom-right
config.sticky = true # stick to page corner ?
# Available colors:
# orange, blue, green, red, purple, black, white
config.themes = {
development: 'black',
staging: 'blue',
my_custom_environment: 'purple'
}
end
To add a custom environment, just add it inside the themes
option and set the color you want (careful, if you define config.themes
in your initializer it will erase default environments values so you will have to readd them).
Orange | Blue | Green | Red | Purple | Black | White |
Top/Left | Top/Right | Bottom/Right | Bottom/Left |
Development | Staging |
Git branch |
- Fork it
- 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