HelpCenter is a Rails wiki gem with Trix editor support for creating a knowledge base for your project. It includes categories, articles, simple moderation, the ability to leave comments to docs and more.
Out of the box, HelpCenter comes with styling for TailwindCSS 2.0 but you're free to customize the UI as much as you like by installing the views and tweaking the HTML.
Rails >= 6.1.4
Before you get started, HelpCenter requires a User
model in your application (for now).
Add this line to your application's Gemfile:
gem 'help_center'
And then execute:
bundle
Install the migrations and migrate:
rails help_center:install:migrations
rails db:migrate
Add HelpCenter to your User
model. The model must have name
method which will be used to display the user's name on comments & discussions (if enabled). Currently only a model named User
will work.
class User < ActiveRecord::Base
include HelpCenter::SupportUser
def name
"#{first_name} #{last_name}"
end
end
Next add a moderator
and admin
flag to the User
model.
rails g migration AddModeratorToUsers admin:boolean moderator:boolean
rails db:migrate
Only moderators or admins can manage articles.
if current_user.admin? || current_user.moderator?
Add the following line to your config/routes.rb
file:
mount HelpCenter::Engine => "/docs"
Add routes for active storage with your custom prefix
get "/docs/rails/active_storage/blobs/:signed_id/*filename" =>
"active_storage/blobs#show"
get "/docs/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" =>
"active_storage/representations#show"
To get all the basic functionality, the only thing you need to do is add a link to HelpCenter in your navbar.
<%= link_to "Docs", help_center_path %>
This will take the user to the views inside the Rails engine and that's all you have to do!
If you'd like to customize the views that HelpCenter uses, you can install the views to your Rails app:
rails g help_center:views
You can also install a copy of the HelpCenter controllers for advanced customization:
rails g help_center:controllers
Helpers are available for override as well. They are used for rendering the user avatars, text formatting, and more.
rails g help_center:helpers
NOTE: Keep in mind that the more customization you do, the tougher gem upgrades will be in the future.
You can enable user comments and questions for support articles. HelpCenter will attempt to send email and slack notifications for users who leave comments when a new reply posted.
To turn these off you can do the following in config/initializers/help_center.rb
HelpCenter.setup do |config|
config.article_dicussions = false # Default: false
config.send_email_notifications = false # Default: true
config.send_slack_notifications = false # Default: true
end
Slack notifications require you to set help_center_slack_url
in your config/secrets.yml
. If you don't have this value set, it will not attempt Slack notifications even if they are enabled.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Your support is appreciated for this project. Consider backing the project via GitHub Sponsors.
We plan to release following features:
- Contact form
- Built-in search
- Versioning Support
- Themes
- Dark Mode Support
simple_discussion by Chris Oliver
Bug reports and pull requests are welcome on GitHub at https://github.com/uurcank/help_center This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the HelpCenter project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.