public
Created

  • Download Gist
mustache.coffee
CoffeeScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
templateText = """<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="home" id="home">Pouch Demo</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li id="noteLink" {{#newNote}}class='active'{{/newNote}}><a id="newNote" href="newNote">New</a></li>
</ul>
<ul class="nav pull-right" >
 
<li><a href="start" id="toggleStart"><i class="icon-refresh"></i></a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<br/><br/><br/><div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div class="well sidebar-nav" id="sidebar">
<ul class="nav nav-list" id="sideList"><li class='nav-header'>Notes</li>
{{#sideList}}
<li id='li{{key}}' {{#active}}class='active'{{/active}}><a href='#{'#'}{{key}}' id='{{key}}'>{{{title}}}</a></li>
{{/sideList}}
</ul>
</div><!--/.well -->
</div>
<div class="span10">
<div id="mainContent">{{^edit}}{{> content}}{{/edit}}{{#edit}}{{> editContent}}{{/edit}}</div>
</div>
</div>
</div>"""
template = Mustache.compile templateText
Mustache.compilePartial("content","""
<h1>{{title}}{{#editable}}<a id='editable' href='edit{{hash}}'><i class ='icon-edit' id='edit{{hash}}'></i></a>{{/editable}}</h1>
<p>{{#md}}{{{body}}}{{/md}}</p>
""")
Mustache.compilePartial("editContent","""
<form class="form" id="updateForm">
<div class="tabbable tabs-left">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">edit</a></li>
<li><a href="#tab2" data-toggle="tab">view</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div class="control-group">
<label class="control-label" for="noteTitle">Title</label>
<div class="controls">
<input type="text" id="noteTitle" name="title" value='{{title}}'>
</div>
</div>
<div class="control-group">
<label class="control-label" for="nodeBody">Your Note</label>
<div class="controls">
<textarea rows="10" id="noteBody" class="span8" name='body'>{{{body}}}</textarea></div>
</div>
</div><div class="tab-pane" id="tab2"></div>
</div>
</div>
<div class="control-group">
<div class="controls" id="btg">
<button type="submit" class="btn btn-success" id="updateNote">Update</button>
<button type="submit" class="btn btn-info" id="cancelUpdate">Cancel Edit</buton>
<button type="submit" class="btn btn-danger" id="deleteNote">Delete</button>
</div>
</div>
</form>
""")

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.