/
show.html.jade.ejs
36 lines (31 loc) · 1.15 KB
/
show.html.jade.ejs
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
.hero-unit
h2= <%= names.property.singular %>.<%= properties['default'].name %>
!= linkTo('Edit this <%= names.property.singular %>', edit<%= names.constructor.singular %>Path(params.id), {class: 'btn pull-right'})
h2 <%= names.constructor.singular %> Properties
each property, key in <%= names.property.singular %>
if key !== 'saved'
.row.list-item
.span4
h3= key
.span8
h3
i.icon-list-alt
span(class=key)= property
script(type="text/javascript")
$(function () {
var pageId = window.location.pathname.split('/')[2];
geddy.io.addListenersForModels(['<%= names.constructor.singular %>']);
geddy.model.<%= names.constructor.singular %>.on('update', function (<%= names.property.singular %>) {
if (<%= names.property.singular %>.id == pageId) {
var properties = <%= names.property.singular %>.toData();
for (var i in properties) {
$('.'+i).text(properties[i]);
}
}
});
geddy.model.<%= names.constructor.singular %>.on('remove', function (id) {
if (id == pageId) {
window.location = '/<%= names.property.plural %>';
}
});
});