Created
February 5, 2015 15:12
-
-
Save trueadm/898c8f7d7cf89d62f54a to your computer and use it in GitHub Desktop.
DOM DSL Example #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template() { | |
return [ | |
["div", | |
["header" | |
["h1", "Example " + this.title] | |
] | |
], | |
['div#main', | |
$.if(this.todos.length > 0, [ | |
['div', | |
['span.counter', "There are " + this.todos.length + " todos!"] | |
] | |
]) | |
], | |
['ul.todos', | |
$.forEach(this.todos, (todo, index) => [ | |
['li.todo', | |
['h2', "A todo"], | |
['span', index + ": " + todo] | |
] | |
]) | |
], | |
['form', {id: them.formId, method: "post", action. "#"}, | |
['div.form-control', [ | |
['input', {name: "first_name", type: "text"}] | |
], | |
['button', {type: "submit", onClick: this.click}, | |
"Submit!" | |
] | |
] | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment