No commit activity in last 3 years
No release in over 3 years
Forum engine for Rails 4 and mongoid. Forked from https://github.com/NJayDevelopment/mongoid_forums
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.10
= 1.0.2
>= 0
= 0.15.1
= 4.0.0
~> 4.2.0
= 2.0.6
 Project Readme

MongoidForums

A forum system for Rails 4 and Mongoid. Inspired by Forem.

Created due to lack of functioning Rails 4 mongoid engines.

Installation

gem 'mongoid-forums'

Run the installer

Ensure that you first of all have a User model and some sort of authentication system set up. We would recommend going with Devise, but it's up to you. All MongoidForums needs is a model to link topics and posts to.

Run the installer and answer any questions that pop up. There's sensible defaults there if you don't want to answer them.

rails g mongoid_forums:install

Set up helper methods in your user model

MongoidForums depends on a forum_display_name (which defaults as to_s) method being available on your User model so that it can display the user's name in posts. Define it in your model like this:

def forum_display_name
  name
end

Or simply return the user's display name as the to_s method in your user model.

Please note that if you are using Devise, User model does not have name field by default, so you either should add it or use another column (email for example).

The routes (along with some other designs such as Alerts system) for this project are based around Overcast Network's forum system (https://oc.tc/forums)

See here for an old open source version of oc.tc/forums that this project is based on (and borrows some code from): https://github.com/kultus/forem-2

Features

Here's a comprehensive list of the features currently in Mongoid Forumsf:

  • Forums
    • CRUD operations (provided by an admin backend)
  • Topics
    • Viewing all topics for a forum
    • Creating of new topics
    • Editing topics
    • Locking topics
    • Hiding topics
    • Pinning topics
  • Posts
    • Replying to topics
    • Deleting own posts
    • Blocking replies to locked topics
    • Editing posts
  • Text Formatting
    • Posts are HTML escaped and pre tagged by default.
    • Pluggable formatters for other behaviour
  • A flexible permissions system (Works exactly as Forem does, using CanCanCan and allowing overrides)
  • Translations (Not complete, some messages currently are hardcoded in English)
  • Flexible configuration (All features of Forem except avatars, profile links, and theme. We are working hard on adding these, but you can also add them to your own project if needed through the default method of overriding rails engine controllers, models, and views!)

View Customisation

If you want to customise Forem, you can copy over the views using the mongoid_forums:views generator:

rails g mongoid_forums:views

You will then be able to edit the forem views inside the app/views/mongoid_forums of your application. These views will take precedence over those in the engine.

Extending Classes

All of MongoidForum's business logic (models, controllers, helpers, etc) can easily be extended / overridden to meet your exact requirements using standard Ruby idioms.

Standard practice for including such changes in your application or extension is to create a directory app/decorators. place file within the relevant app/decorators/models or app/decorators/controllers directory with the original class name with _decorator appended.

Adding a custom method to the Post model:

# app/decorators/models/mongoid_forums/post_decorator.rb

MongoidForums::Post.class_eval do
  def some_method
    ...
  end
end

Adding a custom method to the PostsController:

# app/decorators/controllers/mongoid_forums/posts_controller_decorator.rb

MongoidForums::PostsController.class_eval do
  def some_action
    ...
  end
end

Planned Features:

  • emoji
  • Mass moderation
  • Option to have to approve topics/posts manually
  • Block spammers feature
  • Archiving
  • Theming
  • User profile links
  • Avatars