• Stars
    star
    215
  • Rank 177,393 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Complete wiki plugin for Ruby on Rails

Irwi

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

Status

Build Status

Installation

Add to your Gemfile:

gem 'irwi', :git => 'git://github.com/alno/irwi.git'

Then in your application directory call:

rails g 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:

wiki_root '/wiki'

Wiki syntax (links to other pages)

You can link pages by using

[[Some page title]]

construction in text. If linked page exists, when it will be replaced with link to this page, in other case it will be replaced with link to new page with such path/title.

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.config object. Currently supported options:

  • user_class_name - Name of user model class. By default - 'User'

    Define a method named 'current_user' method on WikiPagesController that returns the object for the current user

  • formatter - Formatter instance, which process wiki content before output (see section below).

  • paginator - Paginator instance, which display pagination controls (see section below).

  • 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).

Formatters

Irwi supports custom formatters which can be configured by setting Irwi.config.formatter to corresponding instance. Each formatter should have method format, which gets a string and returns it formatted.

There are several supported formatters based on different gems (which tou should add to Gemfile of your application):

  • Irwi::Formatters::RedCloth - markdown formatter based on RedCloth gem.
  • Irwi::Formatters::RedCarpet - markdown formatter based on `redcarpet gem.
  • Irwi::Formatters::BlueCloth - textile formatter based on BlueCloth gem.
  • Irwi::Formatters::WikiCloth - formatter based on wiki_cloth gem.
  • Irwi::Formatters::SimpleHtml which does nothing.

By default, Irwi will select first available (having corresponding gem in application Gemfile) formatter. Also, you may select formatter explicitly by specifying Irwi.config.formatter value like:

Irwi.config.formatter = Irwi::Formatters::BlueCloth.new

Paginators

Irwi supports custom paginators which can be configured by setting Irwi.config.paginator to corresponding instance.

There are following supported paginators (which tou should add to Gemfile of your application):

  • Irwi::Paginators::WillPaginate - based on will_paginate gem.
  • Irwi::Paginators::Kaminari - based on kaminari gem.
  • Irwi::Paginators::None which does nothing.

By default, Irwi will select first available (having corresponding gem in application Gemfile) paginator. Also, you may select paginator explicitly by specifying Irwi.config.paginator value like:

Irwi.config.paginator = Irwi::Paginators::WillPaginate.new

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).

Attachments

Irwi allows easy attachment integration in your wiki. There area several simple steps to add attachments to wiki pages:

  • Call irwi_wiki_attachments generator. It will create WikiPageAttachment class.
  • Include config.gem "paperclip" in your environment.rb or, if you prefer another library modify generated code for it.
  • Append to initializer (or create a new one) something like Irwi.config.page_attachment_class_name = 'WikiPageAttachment'.
  • Run rake db:migrate and start using attachments in your wiki!

Contributors

Feel free to add yourself when you add new features.

Copyright (c) 2009 Alexey Noskov, released under the MIT license

More Repositories

1

kaggle-allstate-claims-severity

2nd place solution for Allstate Claims Severity competition at Kaggle
Python
128
star
2

kaggle-outbrain-click-prediction

C++
77
star
3

batch-learn

C++
48
star
4

osm-js-libs

JavaScript libraries for OSM application
CoffeeScript
13
star
5

radiant-code-extension

Extension to highlight code in Radiant CMS
Ruby
10
star
6

rayo

Lightweight CMS based on Sinatra and Radius
Ruby
9
star
7

plasma-runner-events

KDE Plasma Runner, through which you can add events and todos to calendar
C++
6
star
8

chef-motion

Motion cookbook for chef
HTML
5
star
9

osmer

Tool to manage local OSM database
Ruby
5
star
10

sbt-caliper

Sbt plugin to execute Caliper benchmarks
Scala
4
star
11

scalann

Scala
4
star
12

kaggle-jigsaw-toxic-comment-classification-challenge

Python
4
star
13

rzd-api-java

Java API for RZD tickets service
Java
4
star
14

kaggle-santander-product-recommendation

Python
4
star
15

demtools

Fork of perrugeo's demtools
C++
3
star
16

cache

Ruby
3
star
17

irwi_test

Test application for Irwi wiki plugin
Ruby
3
star
18

radiant-archive-hacks-extension

Some hacks for standart Radiant CMS archive extension, improving its usability
Ruby
3
star
19

site-personal

My personal site on top of Rayo CMS
JavaScript
3
star
20

hse-oop-java

Материалы для занятий по курсу "Современные объектно-ориентированные языки программирования" на 2-3 курсе ГУ ВШЭ
Java
3
star
21

kaggle-dstl-satellite-imagery-feature-detection

Python
3
star
22

hse-oop-csharp

C#
2
star
23

josm-vectorizer

JOSM plugin for vectorization
Java
2
star
24

sproto

Scala protocol library like sbinary or sjson but generic
Scala
2
star
25

plasma-runner-appinstall

C++
2
star
26

rzd

Rzd is a gem automating checking ticket information for rzd.ru railway service
Ruby
2
star
27

site-freeforms

FreeForms.ru site
JavaScript
2
star
28

hse-grammars

Материалы для занятий по формальным грамматикам на 2 курсе ГУ ВШЭ
C++
2
star
29

hse-ofp-scala

Материалы для занятий по курсу "Объектно-функциональное программирование" на 3-4 курсе ГУ ВШЭ
Scala
2
star
30

hse-cpp

Материалы для занятий по курсу "Алгоритмы и структуры данных" на 2 курсе ГУ ВШЭ
C++
1
star
31

my-arduino

My arduino tests root
C++
1
star
32

akka-etcd-cluster-seed

Starting Akka cluster with Etcd
Scala
1
star
33

scala-game-example

Scala
1
star
34

my-environment

My home environment
Shell
1
star
35

balance

Balance is a gem automating checking balance for different service providers
Ruby
1
star
36

site-personal-osm

Ruby
1
star
37

rzd-android

Android application to check RZD tickets
Java
1
star
38

osm-render

My style for OSM rendering
1
star
39

my-scripts

My scripts not included in environment
Ruby
1
star
40

plasma-widget-onelinecalc

OneLineCalculator plasmoid for KDE4
C++
1
star
41

mapapp

My map application
Ruby
1
star