Skip to content

WIP Presenter Specification

Marak edited this page Aug 19, 2012 · 17 revisions

WIP - Presenter Spec

Presenter options on a resource property are intended to imply the property should be "presented" in a certain way. They can be stacked and combined. Their eventual implementation is not set.

A presenter option might also share the same name as a JSON-schema property ( such as default or required )

Example:

var Creature = resourceful.define('creature');
Creature.string('name', { editable: true });

This implies that the name property on Creature is an editable property, and this should be indicated in the according interface to the resource.

  • If this was a RESTFul interface, the value of the name property would be able to be updated.
  • If this was a Form, it would be represented as a text input box.
  • If this was a CLI, it would be represented as a prompt.

Types

editable - boolean

Property is intended to be edit-able

disabled - boolean

Property is intended to be shown, but can't actually be interacted with.

private - boolean

Property is intended to be private. Don't show it.

public - boolean

Property is intended to be public. Show it.

hidden - boolean

Don't show the property, but it's still public.

position - number

Property is intended to be displayed in an ordered position relative to other properties' position values.

required - boolean

A value for the property is required.

default - value

A default value to use if none if provided.

Clone this wiki locally