Skip to content

Instantly share code, notes, and snippets.

@somebee
Created January 20, 2016 09:05
Show Gist options
  • Save somebee/7291f774a2b81bf535f2 to your computer and use it in GitHub Desktop.
Save somebee/7291f774a2b81bf535f2 to your computer and use it in GitHub Desktop.
tag collection
def render
<self .searchme=@searchable>
for item,i in query
element(item,i)
<add_element object=object relation=@relation maxlength=@maxlength> if @addable
# you can override this for subclasses of collection
# but if you want the elements to be cached, you must
# remember to pass in the key (which in this case is
# the index in the list). In many cases it's better
# if each data-item has a unique id/reference, then
# it's better to use that like <div@{item:id}> ...
def element item, key
<div@{key} .selected=selected(item)>
<h3> item:name
<projects_collection[item] relation="projects" maxlength=20 addable=true searchable=true>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment