Skip to content

Instantly share code, notes, and snippets.

@zanematthew
Created May 8, 2012 16:34
Show Gist options
  • Save zanematthew/2637041 to your computer and use it in GitHub Desktop.
Save zanematthew/2637041 to your computer and use it in GitHub Desktop.
Sample Temp
// Old js snippet, would be better to move this to the template, the thing is if there's no results this should not be displayed.
new_header = '<tr><th class="attending">Add</th><th class="date">Date</th><th class="title">Event</th><th class="track">Track</th><th class="state">State</th></tr>';
// snippet of search.js
// Start
var results_data_object = {"result":[]};
results_data_object.result.push({
id: this_result['ID'],
title: this_result['t'],
track: this_result['tr'],
date: this_result.dateHTML,
city: this_result['c'],
current_user: _user.ID,
checked: checked,
css_class: css_class,
action: action,
state: this_result['s'],
percent: this_percent,
url: this_result['url'], // @todo re-gen feed without url for events
});
// End
// 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment