Skip to content

Instantly share code, notes, and snippets.

@mikeobrien
Created April 30, 2012 04:03
Show Gist options
  • Save mikeobrien/2555382 to your computer and use it in GitHub Desktop.
Save mikeobrien/2555382 to your computer and use it in GitHub Desktop.
Nustache
define [..., 'mustache', 'text!dashboard-template.html'], (..., Mustache, dashboardTemplate) ->
class Router extends Backbone.Router
...
routes:
'': 'dashboard'
'about': 'about'
dashboard: ->
$.get 'dashboard', (data) => @render(Mustache.render(dashboardTemplate, data))
...
<bindings>
<element name="mustache">Nustache.Core.Render.FileToString(System.Web.HttpContext.Current.Server.MapPath('@src'), @data)</element>
</bindings>
<div ...>
...
<div style="float: right; text-align: right;color:#fff">
v{{version}}<br/>
Released {{buildDate}}<br/>
Logged in as {{username}}<br/>
{{userType}}
</div>
...
<h4 class="subheading">Recently Added</h4>
<ul class="nav nav-tabs nav-stacked">
{{#batches}}
<li>
<a href="#batches/edit/{{id}}">{{name}} <span class="label label-inverse">{{createdBy}}</span></a>
</li>
{{/batches}}
</ul>
</div>
...
</div>
...
<div class="content" id="content">
<mustache src="~/dashboard-template.html" data="Model.Dashboard" />
</div>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment