coffeecup helpers
coffeecup helpers project is a set of helpers to add some sugar to generating forms and twitter bootstrap classes
install
npm install coffeecup-helpers
usage
cc = require 'coffeecup'helpers = require 'coffeecup-helpers'= ->form ->p ->textField 'name'class: 'small'ccrender templatehardcode: helpers
output
Name
api
textField(name, value, attributes)
generate label and input type text element.
params
Parameter | Type | Required | Description |
---|---|---|---|
name | string | optional | input element name attribute and label display |
value | string | optional | input element value attribute |
attributes | object | optional | object containing both input and label attributes |
usage
= ->form ->p ->textField 'name'label: class: 'foo' input: class: 'bar'
output
Name
passwordField(name, value, attributes)
generate label and input type text element.
params
Parameter | Type | Required | Description |
---|---|---|---|
name | string | optional | input element name attribute and label display |
value | string | optional | input element value attribute |
attributes | object | optional | object containing both input and label attributes |
usage
= ->form ->p ->textField 'name'label: class: 'foo' input: class: 'bar'
output
Name
Bootstrap Form Controls
textControl(name, value, attributes)
generates form text control with help text
params
Parameter | Type | Required | Description |
---|---|---|---|
name | string | optional | input element name attribute and label display |
value | string | optional | input element value attribute |
attributes | object | optional | object containing both input and label attributes as well as help text |
usage
= ->textControl 'foo'help: 'Help text here'coffeecuprenderthardcode
output
FooHelp text here
passwordControl(name, value, attributes)
generates form password control with help text
params
Parameter | Type | Required | Description |
---|---|---|---|
name | string | optional | input element name attribute and label display |
value | string | optional | input element value attribute |
attributes | object | optional | object containing both input and label attributes as well as help text |
usage
= ->textControl 'foo'help: 'Help text here'coffeecuprenderthardcode
output
FooHelp text here