0.02
No commit activity in last 3 years
No release in over 3 years
Knowledge Base is a bunch of models for Ruby on Rails that you probably need to build your own
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.10.0
~> 0.0.2
~> 0.8
>= 0
~> 5.0.0
~> 1.0.1
~> 4.0
 Project Readme

Knowledge Base

Gem Version Build Status Dependency Status Code Climate Coverage Status

Knowledge Base is a bunch of models for Ruby on Rails that you probably need to build your own.

Installation

Add this line to your application's Gemfile:

gem 'knowledge_base'

... and then execute:

$ bundle

Install and run the migrations:

$ rake knowledge_base:install:migrations
$ rake db:migrate

Configure your routes:

# config/routes.rb
Rails.application.routes.draw do
  [...]

  mount KnowledgeBase::Engine, at: '/knowledge_base'
end

That's it, you're done!

Usage

At its core, Knowledge Base is categories and articles. Its categories can have many articles, and each article can be in many categories.

Articles consist of sections. Sections can be text, images, links, attachments and just about anything else you can imagine. Knowledge Base ships with over a dozen kinds of sections already, and you can check them out in app/models/knowledge_base/sectionables/.

Seeds

Development seeds are a nice way to populate your database with dummy content for styling and presentation purposes. You seed your database with categories and articles with a rake task:

$ rake knowledge_base:seed

... or include them in your own development seeds:

# db/seeds/development.rb
require 'knowledge_base/seeds'

Configuration

CarrierWave

Some sections have images or files in them, and Knowledge Base uses CarrierWave to upload them. It defaults to saving images to disk, but if you'd rather save them to the cloud you'll have to configure it:

# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
  storage :fog
end

ActiveAdmin

Knowledge Base ships with pretty good configuration for ActiveAdmin, and you should probably install it instead of writing your own:

$ rails generate knowledge_base:active_admin

Custom styles

Oftentimes we notice the need for sectionables of the same type with different styles. E.g. some text sectionables with black text and other text sectionables with orange text. It just so happens that you can add custom styles to your sectionables through the configuration. Considering the scenario with black and orange text sectionables, you would write something like this:

KnowledgeBase.configure do |config|
  config.section_styles = {
    text: [ :black, :orange ]
  }
end

Now each text sectionable can be given an orange or a black style, which can be accessed like any other attribute on the sectionable. Using this attribute, you could give the element a CSS class to achieve the correct styling:

<div class="text <%= @text.style %>">
  <%= simple_format @text.body %>
</div>

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

Credits

Hyper made this. We're a digital communications agency with a passion for good code, and if you're using Knowledge Base we probably want to hire you.

License

Knowledge Base is available under the MIT license. See the LICENSE file for more info.