Skip to content

Instantly share code, notes, and snippets.

@sinefunc
Created April 23, 2010 09:42
Show Gist options
  • Save sinefunc/376388 to your computer and use it in GitHub Desktop.
Save sinefunc/376388 to your computer and use it in GitHub Desktop.
@form = Terra::Form.create(YAML::load_file "foo.yml")
<!-- The entire <form>...</form> -->
<%= @form %>
<!-- Renders p > label + input -->
<%= @form.field "name" %>
---
# foo.yml
name: myform
action: /
fields:
- { name: name, label: First name, type: text, class: title }
- { name: pw, label: Password, type: password }
- { name: pw2, label: Repeat, type: password, value: Hey }
- { name: body, label: Body, type: text, class: textarea, value: .... }
- name: items
label: Items
type: select
options:
- one: Option one
- two: Option two
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment