Borges::HtmlRenderer (Class)

In: lib/Borges/HTML/HtmlRenderer.rb
Parent: Object

Renderer for HTML with callbacks

Attributes

action_url  [RW] 
callbacks  [RW] 
rendering_context  [RW] 

Public Class methods

Public Instance methods

Creates a callback that sends message to object with zero arguments.

Creates a link with anchor_text that executes a block when clicked.

Creates a link that calls sym on obj when clicked. sym is used as the title for the link.

Creates a <select> menu of two choices with labels (default to Yes and No). If bool is true, the first item is the default.

Creates a menu that picks the default value by calling sym on obj.

Creates a checkbox. The checkbox will be initially checked if checked is set to true.

Creates a default action that gets called when the form is submitted.

Creates a default action that sends message to object. message is sent with zero arguments.

Creates a link to download object with the text of text. mime_type will default to text/plain.

to_s will be sent to object, and the resulting string will be returned to the user.

WARNING! A download link created by this method will remain live until Borges is shut down. The space used will not be reclaimed. If you are creating many download links, you may wish to serve them from outside Borges.

Creates a file upload field.

Create a form.

Creates a link with image from img_url as content. The link executes block when executed. Image has alt text of alt.

Turn sym into a capitalized label.

Creates an option for a <select>. label sets the label for the select. The option will be selected if selected is true.

Creates a password input containing value. It is however not a good idea to output the current password to html, since the user can retrieve it by looking at the source.

Creates a password input that gets its value by calling sym to obj, then calls sym= to obj when submitted.

Creates a radio button that is part of radio group group. The radio button will be checked if checked is true.

group must come from a previous radio_group:

  group = r.radio_group
  r.radio_button(group) do ... end

Creates a default action for a radio group.

Creates a <script> that links to javascript.

Creates a <select> from list.

Calls each on list and if list yields a single item, then to_s will be called on the item for use as the label. If list yields two items, then the second item will be used as a label.

If selected matches an item in list, that item will be selected.

callback will be passed the user-selected item.

Creates a callback that sets attr on object.

Creates a new document containing css, and returns a URL for the document.

Creates a submit button with a label of label, or ‘Submit’ if not given.

Creates a submit button with a label of sym that calls sym on obj when clicked.

Creates a textarea with value as its contents.

Creates a <textarea> by using getter and setter methods for method sym on object obj.

Creates a text input containing value.

Creates a text input that gets its value by calling sym to obj, then calls sym= to obj when submitted.

Registers block as an action callback, and returns its URL.

Creates a DocumentHandler for obj with a MIME type of mime_type, and returns the URL of the DocumentHandler created.

[Validate]