forked from GarethElms/BackboneJSModalView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
68 lines (61 loc) · 1.86 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Backbone.js Modal Dialog</title>
<link rel="stylesheet" type="text/css" media="screen" href="demo.css" />
<link href="backbone-forms/backbone-forms.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="lib/underscore-min.js" type="text/javascript"></script>
<script src="lib/backbone-min.js" type="text/javascript"></script>
<script src="lib/backbone-forms.js"></script>
<script src="Backbone.ModalDialog.js" type="text/javascript"></script>
<script src="demo.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<h1>Backbone.js Modal Dialog</h1>
<div id="content">
<p>
<a href="#" id="addPersonButton">Add another person to the list</a>
</p>
<ul id="people">
</ul>
</div>
</div>
<div id="footer">
<a href="https://github.com/GarethElms/BackboneJSModalView">Backbone.js Modal View</a> demo By <a href="http://www.garethelms.org">Gareth Elms</a> 2011
</div>
</body>
<script type="text/javascript">
$(document).ready(
function()
{
_.templateSettings = {interpolate : /\{\{(.+?)\}\}/g};
$("#addPersonButton").click(
function( event)
{
event.preventDefault();
event.stopPropagation();
var new_person = new PersonModel();
// Create the modal view
var view = new AddPersonView({model:new_person});
view.render().showModal(
{
x: event.pageX,
y: event.pageY
});
});
_people = new PeopleCollection();
_people.add( new PersonModel({name: "Person 1"}));
_people.add( new PersonModel({name: "Person 2"}));
_people.add( new PersonModel({name: "Person 3"}));
_peopleList = new PeopleListView(
{
collection: _people,
el: "#people"
});
_peopleList.render();
});
</script>
</html>