Created
May 8, 2012 12:56
-
-
Save zanematthew/2634706 to your computer and use it in GitHub Desktop.
Sample using JavaScript templating.
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
// The JS Template | |
<script id="result_event_tpl" type="text/html"> | |
{{#result}} | |
<tr> | |
<td> | |
<input type="checkbox" {{checked }} class="yes_no_handle {{ css_class }}" data-action="{{ action }}" data-current_user_id="{{ current_user }}" data-post_id="{{ id }}" /> | |
</td> | |
<td class="meta">{{ date }}</td> | |
<td> | |
<div class="title"> | |
<a href="{{ url }}">{{ title }}</a> | |
<span title="{{ percent }} % Match" class="tool-tip bar-container" style="width: 100px;"> | |
<span style="width: {{ percent }}px"></span> | |
</span> | |
</div> | |
</td> | |
<td class="meta">{{ city }}</td> | |
<td class="meta">{{ state }}</td> | |
</tr> | |
{{/result}} | |
</script> | |
// Then later in your JavaScript | |
results_data_object = {"result":[{ | |
title: "my title", | |
date: "my date" | |
}]} | |
tpl = ich.result_event_tpl( results_data_object ); | |
$( '#search_target tbody' ).html( tpl ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment