public
Description: Complete wiki plugin for Ruby on Rails
Homepage:
Clone URL: git://github.com/alno/irwi.git
irwi /
name age message
file .document Wed Oct 28 12:21:05 -0700 2009 Fix .document for yardoc [alno]
file .gitignore Wed Oct 28 12:21:05 -0700 2009 Fix .document for yardoc [alno]
file MIT-LICENSE Thu Jul 02 12:51:28 -0700 2009 Initial plugin sceleton [alno]
file README.rdoc Mon Nov 02 10:14:43 -0800 2009 irwi_wiki_views generator to support Rails prio... [alno]
file Rakefile Sun Oct 25 13:17:47 -0700 2009 Initial gem version [alno]
file VERSION Tue Nov 24 13:53:31 -0800 2009 Version bump to 0.1.10 [alno]
directory app/ Sat Oct 31 13:56:53 -0700 2009 System pages [alno]
directory generators/ Mon Nov 02 10:14:43 -0800 2009 irwi_wiki_views generator to support Rails prio... [alno]
file irwi.gemspec Tue Nov 24 13:53:31 -0800 2009 Version bump to 0.1.10 [alno]
directory lib/ Tue Nov 24 13:52:58 -0800 2009 Submodule decalrations [alno]
directory rails/ Sun Oct 25 13:17:47 -0700 2009 Initial gem version [alno]
directory spec/ Sat Oct 31 13:56:53 -0700 2009 System pages [alno]
directory tasks/ Thu Jul 02 12:51:28 -0700 2009 Initial plugin sceleton [alno]
README.rdoc

Irwi

Irwi is Ruby on Rails plugin which adds wiki functionality to your application.

Installation

Setup gemcutter as gem source:

  sudo gem install gemcutter
  gem tumble

And install irwi gem (recommended):

  sudo gem install irwi

And add to your environment.rb:

  config.gem "irwi", :source => "http://gemcutter.org"

Or in your application directory call:

  script/plugin install git://github.com/alno/irwi

Usage

In your application directory call:

  script/generate irwi_wiki

It will generate:

  • WikiPageController to serve wiki pages
  • WikiPage model to represent page
  • Migration to prepare database

Also it will add to your routes.rb something like:

  map.wiki_root '/wiki'

Template definition

You may create your own templates for controller actions (show, edit and history), in other case default built-in templates will be used.

Helper definition

Following helpers are defined by default and you may replace them with you own:

  • wiki_user - Renders user name or link by given user object. By default renders <Unknown> for nil and "User#{user.id}" for others.

Configuration

Configuration options are acessed via Irwi.options object. Currently supported options:

  • user_class_name - Name of user model class. By default - ‘User’
  • formatter - Formatter instance, which process wiki content before output. It should have method format, which gets a string and returns it formatted. By default instance of Irwi::Formatters::RedCloth is used (requires RedCloth gem). Other built-in formatter is Irwi::Formatters::BlueCloth (requires BlueCloth gem).
  • comparator - Comparator instance, which builds and renders a set of changes between to texts. By default instance of Irwi::Comparators::DiffLcs is used (requires diff-lcs gem).

Access control

If you want (and it’s good idea) to specify which users can see or edit certain pages you should simply override following methods in your controller:

  • show_allowed? - should return true when it’s allowed for current user to see current page (@page).
  • history_allowed? - should return true when it’s allowed for user to see history of current page (@page) and compare it’s versions.
  • edit_allowed? - should return true when it’s allowed for current user to modify current page (@page).

Localization

Rails prior to 2.3

If you have Rails prior to 2.3 when you should also call:

  script/generate irwi_wiki_views

To generate default wiki views.

Copyright © 2009 Alexey Noskov, released under the MIT license