Skip to content

Elegant Github like ribbon that displays informations about your Rails application

Notifications You must be signed in to change notification settings

anthony-robin/ribbonit

Repository files navigation

Ribbonit

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.

Gem Version Travis CI Codacy Badge Grade Codacy Badge Coverage Dependency Status

Installation

Add this line to your application's Gemfile:

# Gemfile
gem 'ribbonit'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ribbonit

Usage

  1. Run initializer
$ bin/rails g ribbonit:install

This will create a ribbonit.rb file in config/initializers

  1. Import assets
/* application.css */

/*
*= require ribbon
*/
  1. Call ribbon in layout
/ application.slim
...
body
  = ribbonit

Options

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).

Screenshots

Colors

Orange Blue Green Red Purple Black White

Positions

Top/Left Top/Right Bottom/Right Bottom/Left

Environments

Development Staging

Additional informations

Git branch

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request