Module MuraveyWebHelper
In: app/helpers/muravey_web_helper.rb
Author:Dmitry V. Sabanin <dmitry@sabanin.ru>
Copyright:Copyright © 2005 MuraveyLabs, Ltd
URL:muravey.net/opensource/
Revision:$Date: 2005/04/02 16:46:54 $ $Revision: 1.22 $
License:MIT

This helper is a key part of MuraveyWeb API. You may want to add it to the controller where you want to render MW documents. This can be done via generic Rails helpers interface:

  class ArticlesController < Application
    helper :MuraveyWeb
  end

After that, you can use helper methods in your views.

Methods

mw  

Public Instance methods

MuraveyWeb helper to work with content.

  # Usage:
  mw :render => :image, :document => @image
  # or more link_to -like way:
  mw 'Want to know more?', :link => :text, :document => @document

You can :render following elements:

  • :text - text document
  • :image - image
  • :custom - custom document type
  • :file - file
  • :auto - guess document type

One of the following options is required:

  • :document - document to render or
  • :symid - symid of the document to render

You can build :link with following targets:

  • :text - link to any document
  • :image - thumbnail image and link to fullscreen version
  • :file - file
  • :auto - guess document type
  • :raw - only URL to the document

Possible options for :link are:

  • :document - document to render or
  • :symid - symid of the document to render
  • :title - title to use on render, may be specified as a first argument, before :render key.
  • :size - limit image size with this value, image will be automatically proportional resized on the server side

Examples:

  mw "Click here", :link => :text, :document = @document
  # <a href="http://document-viewer-url/85" title="Document Title Here">Click here</a>

  mw "My photo", :link => :image, :document = @photo
  # <a href="http://document-viewer-url/85" title="My photo">
  # <img src="http://document-viewer-url/85?limit_size=100" alt="Photo Title Here" />
  # </a>

  # @article is an Article document that has link_to(document_symid) string somewhere
  # inside, with symid pointing at document with id 86
  mw :render => :text, :document => @article
  # <p> Here is a link to a document: http://document-viewer-url/86 </p>

  # Paginator usage:
  mw :paginate => :folder, :folder => @news, :page => @params[:page]
  # This will render a paginator bar

[Source]

    # File app/helpers/muravey_web_helper.rb, line 90
90:   def mw(*args)
91:     parse_arguments(args).execute
92:   end

[Validate]