Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

got realtime working on show pages

  • Loading branch information...
commit 74a946ccdfd8e7f0d24ae5e393afda1ef2db10ec 1 parent 944267c
@Techwraith Techwraith authored
Showing with 17 additions and 4 deletions.
  1. +17 −4 templates/scaffold/realtime/views/ejs/show.html.ejs.ejs
View
21 templates/scaffold/realtime/views/ejs/show.html.ejs.ejs
@@ -1,5 +1,5 @@
<div class="hero-unit">
- <h2><@= <%= names.property.singular %>.<%= properties['default'].name %> @></h2>
+ <h2 class="<%= properties['default'].name %>"><@= <%= names.property.singular %>.<%= properties['default'].name %> @></h2>
<@- linkTo('Edit this <%= names.property.singular %>', edit<%= names.constructor.singular %>Path(params.id), {class: 'btn pull-right'}); @>
</div>
@@ -7,12 +7,25 @@
<@ for(var i in <%= names.property.singular %>) { -@>
<@ if(i !== 'saved') { -@>
<div class="row list-item">
- <div class="span8">
+ <div class="span4">
<h3><@= i @></h3>
</div>
- <div class="span4">
- <h3><i class="icon-list-alt"></i><@= <%= names.property.singular %>[i] @></h3>
+ <div class="span8">
+ <h3><i class="icon-list-alt"></i><span class="<@= i @>"><@= <%= names.property.singular %>[i] @></span></h3>
</div>
</div>
<%% } -%>
<%% } -%>
+
+<script type="text/javascript">
+
+geddy.io.addListenersForModels(['<%= names.constructor.singular %>']);
+
+geddy.model.<%= names.constructor.singular %>.on('update', function (<%= names.property.singular %>){
+ var properties = <%= names.property.singular %>.toData();
+ for (var i in properties) {
+ $('.'+i).text(properties[i]);
+ }
+});
+
+</script>
Please sign in to comment.
Something went wrong with that request. Please try again.