Plugins - Restful Citations

StarAdd to favorites

Engine, which adds citations mechanism to your Rails application. Citations may be edited using Ajax-based citations editor. Transparently integrates with Restful Comments plugin.

Features

  • Simple citation mechanism

Requirements

This plugin requires followng plugins installed:

If your Rails version prior to 1.2:

Installation

  1. script/install svn://rubyforge.org/var/svn/rf-comments/trunk/restful_citations
  2. script/generate plugin_migration

Using

Common configuring:

  1. Add map.from_plugin :restful_citations to your routes.rb
  2. Copy localization files from {RAILS_ROOT}/vendor/plugins/restful_citations/lang/ui directory to your {RAILS_ROOT}/lang/ui directory, or add their content to your existing localization files
  3. In environment.rb set your localization language (for example, Globalite.language = :en)
  4. If you want to specify per-user access rules and your helpers haven’t method current_user, implement this method in ApplicationHelper.

For citable:

  1. Add acts_as_restful_citable into your model class to declare it as citable
  2. Add <%=restful_citations_include%> into your erb template to include styles and javascripts
  3. Don’t forget to add <%= javascript_include_tag :defaults %> to your layout
  4. Add <%= restful_citations_for {model_instance} %> into view to render citation editor for {model_instance}
  5. Add <%= restful_citations_toggle_link {text}, {model_instance} %> to create link to toggle citation editor.

Configuring access

You can specify access rules for different citable models. To do it, you need to specify block in acts_as_restful_citable call.

This block can contain some of methods:

        def can_view?( citable, citation, user )

        def can_add?( citable, citation, user )

        def can_remove?( citable, citation, user )

Each method returns if user can make coresponding action on citation.

If you want to specify user-dependent access, when user must be accessible through current_user method in helper

Configuring styles

To configure display of editor you may pass hash of options to restful_citations_include. Available options:

  • :style - name of built-in style. Available value: ‘gray’, ‘lj’
  • :stylesheet - name of application stylesheet to use

Alexey Noskov

http://rubyforge.org/projects/rf-comments/

http://rf-comments.rubyforge.org/svn/trunk/restful_citations/

Rails' (MIT)

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rails Engines

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?