Skip to content

Instantly share code, notes, and snippets.

@wycats
Forked from jonathan/huh?
Created December 21, 2010 20:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wycats/750498 to your computer and use it in GitHub Desktop.
Save wycats/750498 to your computer and use it in GitHub Desktop.
<select id="item-kind" name="item[kind]" class="kind">
{{itemOptions this}}
</select>
helpers =
formItemOptions: (item) ->
_.reduce(
item.itemKinds
(out, itemKind) ->
out + '<option value="' + itemKind.value + '">' + itemKind.name + '</option>'
'<option value=""></option>'
)
item =
itemKinds:
[value: "one", name: "One"]
[value: "two", name: "Two"]
expected:
<option value=""></option><option value="one">One</option><option value="two">Two</option>
actual:
"
<option value=""></option><option value="text">Text Field</option><option value="textarea">Text Area</option><option value="range">Range</option>
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment