Staff bar
Staff bar is a tiny utility for Ruby on Rails projects. It shows a bar with some basic project information: commit hash, branch, Ruby & Rails versions, environment and caching status. You can also make a list of links that you want to show on a bar for a quick access to your internal tools.
Usage
# Add this to Gemfile
gem 'staff_bar'
# Install dependencies
bundle
Add this to app/views/layouts/application.html.erb
:
...
</head>
<body>
<%= staff_bar if current_user.staff? %>
<%= yield %>
</body>
...
(you can change current_user.staff?
to whatever your administrators logic is of course.)
Add this to your application.css
to use default styles:
*= require staff_bar
To show current branch, add staff_bar capistrano tasks in Capfile
:
require "staff_bar/capistrano"
This will create BRANCH
file when deploying, which will staff bar use to show the branch.
Configuration
# app/config/initializers/staff_bar.rb
StaffBar.configure do |config|
config.links = [
{ url: '/jobs', title: 'Jobs queue' },
{ url: '/logs', title: 'Open logs' }
];
config.theme = :dark # or :light
config.position = :bottom # or :top
config.highlight_envs = [:production]
end
License
The gem is available as open source under the terms of the MIT License.