public
Description: JavaScript Application Framework - JS library only
Home | Edit | New

Label_view

Extends: view

A label view creates a label on the page. Most of the time this is static text, but it can also be editable using inline editing.

Syntax:

Supports all options in view plus:

<%= label_view :label_id, :editable => true | false, :escape_html => true | false, :localize => true | false, :formatter => “formatter_func”, :value => “hello!”, :content => “Path.to.Object”, :content_value_key => “keyName” %>

Where:

  • :editable :: enables editing using the inline editor
  • :escape_html :: If true, value will be escaped to avoid scripting attacks. Defaults to true.
  • :localize :: If true, the value will be localized using the current strings before display. The value should be a loc key.
  • :formatter :: Set this to a validator or to a function and the value will be passed through it before being set.
  • :value :: The initial text value of the label. You can also bind this value.
  • :content :: Optionally set the content object that should be used to extract the value . This is bindable.
  • :content_value_key :: If you set or bind to a content object, name the property on the content object that should be used as the value of the label.

Examples

Generates a simple label:

<%= label_view :value => “Hello World!” %>

Generates a label that will display the “itemCount” property on the controller:

<%= label_view :bind => { :value => ‘MyApp.itemsController.itemCount’ } %>

Generates a label that will display the fullName property on the content object (which is retrieved from the current selection):

<%= label_view :content_value_key => ‘fullName’, :bind => { :content => “MyApp.contactsController.selection” } %>

Related Links

Comments

Last edited by sproutit, Fri Jun 27 22:25:36 -0700 2008
Home | Edit | New
Versions: