-
Notifications
You must be signed in to change notification settings - Fork 77
/
index.html
121 lines (110 loc) · 4.65 KB
/
index.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE HTML>
<html>
<head>
<title>Example Backbone App</title>
<!-- load the bootstrap stylesheet -->
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<a href="https://github.com/dperrymorrow/example-backbone-app"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://camo.githubusercontent.com/567c3a48d796e2fc06ea80409cc9dd82bf714434/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_darkblue_121621.png"></a>
<div class="container">
<div class="page-header">
<h1>Backbone.js Example App</h1>
<p class="lead">
As simple as possible Backbone Application. Uses localStorage for persisting data.
Showing how to set up the classes, and listen to events.
</p>
<strong>Dependencies:</strong>
<ul>
<li>Zepto (could also use JQuery)</li>
<li>Underscore.js</li>
<li>Backbone.js</li>
<li>Backbone.LocalStorage.js</li>
</ul>
</div>
<div class="row">
<div class="col-md-6" id="primary-content">
<!-- the container that gets populated with the rendered templates -->
</div>
<div class="col-md-6">
<!-- we are going to debug our backbone collection here -->
<code id="output" style="display:block;white-space:pre-wrap;"></code>
</div>
</div>
</div>
<!-- THE JAVASCRIPT TEMPLATES -->
<!-- the form, used for create and edit -->
<script type="text/jst" id="formTemplate">
<div class="well">
<div class="alert alert-danger fade in" style="display:none;"></div>
<form>
<h2><%= title %></h2>
<div class="form-group">
<label>Title:</label>
<input type="text" class="form-control" name="title" value="<%= title %>" />
</div>
<div class="form-group">
<label>Author:</label>
<input type="text" class="form-control" name="author" value="<%= author %>" />
</div>
<div class="form-group">
<label>Description:</label>
<textarea class="form-control" rows="5" name="description"><%= description %></textarea>
</div>
<button class="save btn btn-large btn-info" type="submit">Save</button>
<a href="#notes/index" class="btn btn-large btn-default">Cancel</a>
</form>
</div>
</script>
<!-- the index container -->
<script type="text/template" id="indexTemplate">
<div class="well">
<a class="btn btn-block btn-large btn-info" href="#note/new">Create New Note</a>
</div>
<% if (_.isEmpty(notes)){ %>
<div class="alert alert-warning">
<p>There are currently no notes. Try creating some.</p>
</div>
<% } %>
<% _.each(notes, function (note) { %>
<dl class="dl-horizontal">
<dt>Title</dt>
<dd><%= note.title %></dd>
<dt>Author</dt>
<dd><%= note.author %></dd>
<dt>Description</dt>
<dd><%= note.description %></dd>
<dt> </dt>
<dd>
<a class="btn btn-xs btn-info" href="#note/<%= note.id %>/edit">Edit</a>
<a class="btn btn-xs btn-danger" href="#note/<%= note.id %>/delete">Delete</a>
</dd>
</dl>
<% }); %>
</script>
<!-- load the libraries we need -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.16/backbone.localStorage-min.js"></script>
<!-- load our scripts -->
<script src="js/note_router.js"></script>
<script src="js/note_model.js"></script>
<script src="js/views/note_index.js"></script>
<script src="js/views/note_new.js"></script>
<script src="js/views/note_edit.js"></script>
<script src="js/helpers.js"></script>
<script>
var app = new APP.NoteRouter();
</script>
<script>
// ga tracking
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72605505-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>