/Wilderness

Rails 2.3 Engine Plugin Starter Site/CMS/Automatic Admin Panel

Primary LanguageRubyMIT LicenseMIT

WildernessCMS

Wilderness

A Rails content maagement system/starter site Rails Engines plugin

Current Features:

  • Uses Rails 2.3
  • Lives mostly in vendor/plugins (with the exception of some rake installed files)
  • Started from Bort base
  • Unobtrusive extendable auto admin section that takes care of default actions and automated show and index views.
  • Customize any action or view as you wish by dropping in override actions/views in controllers/views
  • Users, roles, permissions, roles permissions grouping
  • Comes with Articles, Pages, Categories, Comments (with Rakisment Spam Check if you want), Links, Tags, Assets
  • TinyMCE custom file upload and AJAX paginated file browser.
  • Flowplayer for video playback (FLV, H.264 or MP4), 1-pixel out Mp3 player
  • Standard gems and plugins: capistrano, will paginate, cucumber, rspec, factory girl, openid, aasm, webrat, acts_as_taggable_on_steroids, paperclip, bundle-fu, forgot_password, gravatar-plugin (modified), vestal_versions
    hoptoad_notifier, open_id_authentication, rakismet, restful_authentication, role_requirement, sortable_column_headers, tiny_mce
  • Preference to change text area from TinyMCE to Textile, Markdown, Simple Format or plain output

To Do/Possible New Features:

  • Themes
  • More Tests
  • Extra modules
  • Improving form automation, more configuration options for index and show views etc.
  • Etc.

#################################################
TO INSTALL
#################################################

  • IF THE APP IS NOT CREATED YET, CREATE IT:
    rails -d myapp
  • OR DEFAULT TO YOUR FAVORITE DATABASE:
    rails -d mysql myapp
  • IF THE DATABASE IS NOT CREATED YET, CREATE IT:
    rake db:create
  • INSTALL THE WILDERNESS PLUGIN:
    script/plugin install git://github.com/gordonbisnor/Wilderness.git
  • RUN WILDERNESS RAKE INSTALL TO GET SOME REQUIRED FILES INTO YOUR APP (USE CAUTION TO MAKE SURE IT DOES NOT OVERWRITE ANYTHING IMPORTANT):
    rake wilderness:install

Remove the install-with-rake folder after installation is complete.

  • MODIFY YOUR MAIN APPLICATION CONTROLLER INHERITANCE (myapplication/app/controllers/application_controller.rb):
    class ApplicationController < WildernessController
  • COPY AND PASTE TEST GEM DEPENDENCIES INTO CONFIG/ENVIRONMENTS/TEST.RB IF YOU WANT/NEED:
    config.gem “rspec”, :lib => false, :version => ‘>=1.2.2’
    config.gem “rspec-rails”, :lib => false, :version => ‘>=1.2.2’
    config.gem “webrat”, :lib => false, :version => ‘>=0.4.3’
    config.gem “cucumber”, :lib => false, :version => ‘>=0.3.2’
    config.gem “thoughtbot-factory_girl”, :lib => “factory_girl”, :source => “http://gems.github.com
    config.gem ‘vestal_versions’
  • ADD ANY OF THESE REQUIRED GEM DEPENDENCIES TO CONFIG/ENVIRONMENT.RB:
    config.gem “capistrano-ext”, :lib => “capistrano”
    config.gem ‘rubyist-aasm’, :lib => ‘aasm’, :source => ‘http://gems.github.com’, :version => ‘2.0.5’
    config.gem ‘mislav-will_paginate’, :version => ‘2.3.6’, :lib => ‘will_paginate’, :source => ‘http://gems.github.com
    config.gem ‘ruby-openid’, :lib => ‘openid’, :version => ‘2.1.4’
    config.gem “giraffesoft-timeline_fu”, :lib => “timeline_fu”,
    :source => “http://gems.github.com

IF YOU WANT TO USE MARKDOWN OR TEXTILE INSTEAD OF TINYMCE:
config.gem ‘BlueCloth’, :lib => ‘bluecloth’
config.gem ‘RedCloth’ , :lib => ‘redcloth’, :version => ‘4.0.3’, :source=>’http://gems.rubyforge.org

  • PLUS THIS:
    config.action_controller.session_store = :active_record_store
    config.active_record.observers = :user_observer
  • SITE KEYS CAN GO IN ENVIRONMENT.RB OR YOUR SPECIFIC ENVIRONMENT FILES:
    REST_AUTH_SITE_KEY = ‘f5945d1c74d3502f8a3de8562e5bf21fe3fec887’
    REST_AUTH_DIGEST_STRETCHES = 10
  • NOW YOU CAN MIGRATE YOUR DATABASE:
    rake db:migrate
  • SHOULD BE READY TO GO:
    script/server

SERVER SETUP NOTES
#################################################
If you’re using image processing software you’ll need to make sure you have the proper libraries installed. I’ve been finding mini_magick the easiest to get up and running on my server.
#################################################

#################################################
CONTENT BLOCKS, CONTENT AREAS
#################################################
The default front end layout is created dynamically as a product of nested content areas and content block endpoints. If you wish to use this, you can create an “area” such as “container”, then a “header” container that is a child of container, in the “header” you can drop a content block endpoint like a logo. A content block expects a partial in views/wilderness/content_blocks, and the name is expected to be a downcased, underscored copy of the name you use in the content blocks. You can assign a class to a content area, and the id will be the same as the name but downcased and dasherized so an area called “Our Corporate Logo” becomes “

”.

#################################################
AUTOMATIC ADMIN SECTION OPTIONS
#################################################

Blank controllers/models/routes can be dropped into place and take advantage of the inherited wilderness controller methods and views (eg for a default admin section if if suits your needs).

If a custom action is required, drop it into that controller (and either write a completely custom method or just add your custom code then “super” up to the inherited method to finish the job).

If you need just a custom view, you can specify that in the model:

def self.custom_views
[‘new’,‘show’,‘index’]
end

Trying to apply the “convention over configuration” wisdom wherever I can to make this thing run smoothly.

— Assumes every model has a title attribute, or if not title, then name. If neither of those are available will use some sort of default eg ID. Maybe there should be a way of specifying an “label” field?

— For a polymorphic relationship the poly fields should be the name of the model suffixed with “able” so commentable_id, commentable_type.

#################################################
SORTABLE MODELS
#################################################
As long as your model contains a position column, you can add it to the
list of sortable sections in preferences (use the human name eg Menu Items instead of MenuItem). When you do this you’ll now have a link to a drag and drop sort view from the admin index for that section. This sorted order will now apply a default scope with a before_filter class_eval to always sort by position asc for that model.

#################################################

  1. PER MODEL OPTIONS
    #################################################

myapp/config/initializers/wilderness-config.rb:

  • ASSOCIATION FIELDS:
    Article.association_fields = {}
  • ACTIONS THAT REQUIRE A CUSTOM VIEW:
    Article.custom_views = []
  • JUMP MENU INDEX PAGE FILTERS
    Article.filter_options = { :field => ‘publish’, :values => [‘Yes’,‘No’] }
  • OMIT FIELDS FOR BOTH ADMIN INDEX AND SHOW PAGES
    Article.omit_fields = [‘title’,‘content’]
  • OMIT FIELDS FOR JUST THE ADMIN INDEX PAGE
    Article.index_omit_fields = [“content”,“title”]
  • ADD FIELDS TO THE INDEX SEARCH ENGINE
    Article.search_fields = [‘Title’]
  • CUSTOM METHODS
    Article.custom_methods = {’title’=>’method’}
  1. PRINT A COUNT OF “HAS MANY” RECORDS WITH A LINK TO THE NESTED RESOURCE eg links ‘3 Tags’ to articles/3/tags
    Article.links_to_has_many_records = [‘Tags’]

#################################################

  1. GENERAL APP CONFIGURATION OPTIONS
    #################################################

class Wilderness

# ADD A SECTION TO THE DASHBOARD
DASHBOARD_SECTIONS = [‘Articles’,‘Pages’,‘Whatever’]

end

#################################################
Things to note:
#################################################
Public:
- TinyMCE has a custom plugin with image uploads and a paginated ajax image gallery

Copyright © 2009 [Gordon B. Isnor], released under the MIT license