Skip to content

Instantly share code, notes, and snippets.

@mauricemach
Created November 16, 2010 20:18
Show Gist options
  • Save mauricemach/702433 to your computer and use it in GitHub Desktop.
Save mauricemach/702433 to your computer and use it in GitHub Desktop.
"Faking" partials with what we have in zappa today
get '/': ->
@items = [
{name: 'coffeescript', url: 'http://coffeescript.org'}
{name: 'ruby', url: 'http://ruby-lang.org'}
{name: 'python', url: 'http://python.org'}
]
# I think helpers belong in the template's locals "namespace",
# but we cannot currently specify the template's locals in zappa.
@partial = partial
render 'default'
view ->
ul ->
for i in @items
text @partial 'item', i: i
partials =
item: ->
li -> a href: @i.url, -> @i.name
def partial: (key, data) ->
p = partials[key]
require('coffeekup').render p, context: data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment