Skip to content
Browse files

added readme.md and .gitignore to the generator, some more fixes for …

…the realtime show page
  • Loading branch information...
1 parent 4b85ae4 commit 5f3e1e56d0a837d3d4f326c08697dd310a4dae9f @Techwraith Techwraith committed
Showing with 21 additions and 7 deletions.
  1. +1 −0 templates/base/.gitignore
  2. +2 −0 templates/base/readme.md
  3. +18 −7 templates/scaffold/realtime/views/ejs/show.html.ejs.ejs
View
1 templates/base/.gitignore
@@ -0,0 +1 @@
+public/js/core/*
View
2 templates/base/readme.md
@@ -0,0 +1,2 @@
+# This is a Geddy App
+Feel free to modify this file to your hearts content. We just put this here to remind you to add a readme file to your project. We also added a .gitignore file so it'll be really easy to host this code on github.
View
25 templates/scaffold/realtime/views/ejs/show.html.ejs.ejs
@@ -18,14 +18,25 @@
<%% } -%>
<script type="text/javascript">
+$(function(){
-geddy.io.addListenersForModels(['<%= names.constructor.singular %>']);
+ var pageId = window.location.pathname.split('/')[2];
-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]);
- }
-});
+ 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 %>';
+ }
+ });
+});
</script>

0 comments on commit 5f3e1e5

Please sign in to comment.
Something went wrong with that request. Please try again.