Created
March 1, 2012 02:36
-
-
Save michealbenedict/1946796 to your computer and use it in GitHub Desktop.
obj
This file contains hidden or 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
<!-- var obj = { | |
title: "some title", | |
content: "some content", | |
tasks: [ | |
{task_name: "abc"}, | |
{task_name: "bcd"} | |
] | |
}; | |
var template = ["<h1>{{title}}</h1>" | |
, "<div>{{content}}</div>" | |
, "<ul>" | |
, "{{#tasks}}<li>{{task_name}}</li>{{/tasks}}" | |
, "</ul>"].join(""); | |
template = Hogan.compile(template); | |
template = template.render(obj); | |
$("#container").append(template); --> | |
items = { | |
users: [ | |
{id: 1, name: "Vishwa"}, | |
{id: 2, name: "Mike"}, | |
{id: 3, name: "Magi"} | |
], | |
tasks: [ | |
{ | |
task_name: "Do Dropbox Integration", | |
type: "task", | |
assigned_to: [1,2], | |
assigned_by: 3, | |
created: "2012", | |
attachments: [ | |
{ | |
attachment_url: "http://1" | |
}, | |
{ | |
attachment_url: "http://2" | |
} | |
], | |
comments: [ | |
{ | |
id: 1, | |
commented_by: 2, | |
comment_data: "hiiiiii", | |
attachments: [ | |
{ | |
attachment_url: "http://" | |
} | |
] | |
}, | |
{ | |
id: 2, | |
commented_by: 1, | |
comment_data: "wassa", | |
attachments: [] | |
} | |
] | |
} | |
] | |
}; | |
{{#tasks}} | |
<li> | |
<div class="row-fluid nf-post"> | |
<div class="span1 avt"> | |
<img src="{{user_avatar}}"> | |
</div> | |
<div class="span10"> | |
<p class="nf-content"> | |
<a href="#">{{task_name}}</a> » <a href="#">Vishwa</a> | |
</p> | |
<p class="nf-meta"> | |
<i class="icon-check"></i> Task created by <a href="#">Micheal</a> · Posted 3 hours ago · <a href="#">Comments (4)</a> | |
</p> | |
</div> | |
</div> | |
<div class="row-fluid"> | |
<div class="span1"> </div> | |
<div class="span9 nf-comments"> | |
<!-- show extra comments !--> | |
<div class="nf-show-more-comments"> | |
<a href="#">Show 2 comments</a> | |
</div> | |
<ul> | |
{{}} | |
<li> | |
<div class="row-fluid"> | |
<div class="span1"> | |
<img src="https://d3szoh0f46td6t.cloudfront.net/public/5738754/small"> | |
</div> | |
<div class="span10 nf-comment"> | |
<div class="nf-comment-meta"><a href="#">Micheal</a> · 2 minutes ago</div> | |
<p> | |
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the | |
</p> | |
</div> | |
</div> | |
</li> | |
<li class="last"> | |
<div class="row-fluid"> | |
<div class="span1"> | |
<img src="https://d3szoh0f46td6t.cloudfront.net/public/5738754/small"> | |
</div> | |
<div class="span10 nf-comment"> | |
<div class="nf-comment-meta"><a href="#">Micheal</a> · a minute ago</div> | |
<p> | |
Some lame comment | |
</p> | |
</div> | |
</div> | |
</li> | |
</ul> | |
</div> | |
</div> | |
</li> | |
{{/tasks}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment