-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
163 lines (137 loc) · 4.78 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ember Step by Step</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="styles/bootstrap.css" rel="stylesheet">
<link href="styles/style.css" rel="stylesheet">
</head>
<body>
<script type="text/x-handlebars">
<div id="wrap">
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Ember Blog</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Dashboard</a></li>
<li>{{#linkTo 'BlogPosts'}}Posts{{/linkTo}}</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!-- Begin page content -->
<div class="container">
{{outlet}}
</div>
</div>
</script>
<script type="text/x-handlebars" data-template-name="index">
<div class="page-header">
<h1>Dashboard</h1>
</div>
<div>{{#linkTo 'BlogPosts'}}Posts <span class="badge">{{postsCount}}</span>{{/linkTo}}</div>
</script>
<script type="text/x-handlebars" data-template-name="BlogPosts">
<div class="page-header">
<h1>Posts</h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Body</th>
</tr>
</thead>
<tbody>
{{#each controller}}
<tr>
<td>{{#linkTo "BlogPost" this}}{{title}}{{/linkTo}}</td>
<td>{{body}}</td>
</tr>
{{/each}}
</tbody>
</table>
<div>{{#linkTo 'BlogPosts.new' class='btn btn-primary btn-lg active' role='button'}}New Post{{/linkTo}}</div>
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="BlogPosts/new">
<div class="page-header">
<h1>New Post</h1>
</div>
<form role="form">
<div class="form-group">
<label for='title'>Title</label>
{{view Em.TextField elementId='title' valueBinding='content.title' placeholder='Enter Title' class='form-control'}}
</div>
<div class="form-group">
<label for='body'>Body</label>
{{view Em.TextArea elementId='body' valueBinding='content.body' placeholder='Enter Body' rows='3' class='form-control'}}
</div>
<div class="form-group">
<button type="submit" class="btn btn-default" {{action save content}}>Save</button>
<button type="button" class="btn btn-primary" {{action cancel content}}>Cancel</button>
</div>
</form>
</script>
<script type="text/x-handlebars" data-template-name="BlogPost">
<div class="page-header">
<h1>{{title}}</h1>
</div>
<div>
{{body}}
</div>
<hr>
<div class="page-header">
<h1>Comments</h1>
</div>
<ul class='comments'>
{{#each comment in comments}}
<li class="alert alert-info">{{comment.body}}</li>
{{/each}}
</ul>
<hr>
{{outlet}}
<div>
{{#linkTo 'comments.new' class='btn btn-primary'}}New Comment{{/linkTo}}
{{#linkTo 'BlogPosts' class='btn btn-default'}}Back{{/linkTo}}
</div>
</script>
<script type="text/x-handlebars" data-template-name="BlogPost/comment">
{{text}}
</script>
<script type="text/x-handlebars" data-template-name="comments">
{{outlet}}
</script>
<script type="text/x-handlebars" data-template-name="comments/new">
<form role="form" {{action save on='submit'}}>
<div class="form-group">
<label class="sr-only" for="body">Comment</label>
{{view Ember.TextArea valueBinding="body" class="form-control" placeholder="Enter comment here"}}
</div>
<div class="form-group">
<button type="submit" class="btn btn-success">Post Comment</button>
<button {{action 'cancel'}} class="btn btn-default">Cancel</button>
</div>
</form>
</script>
<!-- JAVASCRIPTS -->
<script src="javascripts/lib/jquery-1.10.2.js"></script>
<script src="javascripts/lib/handlebars-1.1.2.js"></script>
<script src="javascripts/lib/ember-1.2.0.js"></script>
<script src="javascripts/lib/ember-data-1.0.0-beta.4.js"></script>
<script src="javascripts/lib/bootstrap-3.0.2.js"></script>
<script src="javascripts/app/ember-blog-app.js"></script>
</body>
</html>