Permalink
Browse files

Closes #250, Add realtime code generation to the other template langu…

…ages.

Also fix a big where mustache and handlebars scaffold generators would fail because there wasn't a form template to read from(relate to issue #246).
  • Loading branch information...
1 parent 54509eb commit 315f77e9679f95e4edb7ecfb9023b0fcd024de36 @larzconwell larzconwell committed Nov 9, 2012
Showing with 339 additions and 253 deletions.
  1. +6 −1 templates/Jakefile
  2. +2 −3 templates/base/realtime/views/ejs/layouts/application.html.ejs
  3. +1 −1 templates/base/realtime/views/ejs/main/index.html.ejs
  4. +5 −4 templates/base/realtime/views/handlebars/layouts/application.html.hbs
  5. +6 −5 templates/base/realtime/views/jade/layouts/application.html.jade
  6. +1 −1 templates/base/realtime/views/jade/main/index.html.jade
  7. +5 −4 templates/base/realtime/views/mustache/layouts/application.html.hbs
  8. +3 −4 templates/base/views/ejs/layouts/application.html.ejs
  9. +1 −1 templates/base/views/ejs/main/index.html.ejs
  10. +6 −4 templates/base/views/handlebars/layouts/application.html.hbs
  11. +7 −5 templates/base/views/jade/layouts/application.html.jade
  12. +1 −1 templates/base/views/jade/main/index.html.jade
  13. +6 −4 templates/base/views/mustache/layouts/application.html.hbs
  14. +2 −4 templates/scaffold/realtime/views/ejs/index.html.ejs.ejs
  15. +1 −38 templates/scaffold/realtime/views/ejs/layout.html.ejs.ejs
  16. +3 −4 templates/scaffold/realtime/views/ejs/show.html.ejs.ejs
  17. +43 −0 templates/scaffold/realtime/views/handlebars/index.html.hbs.ejs
  18. +4 −38 templates/scaffold/realtime/views/handlebars/layout.html.hbs.ejs
  19. +23 −0 templates/scaffold/realtime/views/handlebars/show.html.hbs.ejs
  20. +2 −28 templates/scaffold/realtime/views/jade/add.html.jade.ejs
  21. +2 −32 templates/scaffold/realtime/views/jade/edit.html.jade.ejs
  22. +32 −0 templates/scaffold/realtime/views/jade/form.html.jade.ejs
  23. +52 −9 templates/scaffold/realtime/views/jade/index.html.jade.ejs
  24. +3 −36 templates/scaffold/realtime/views/jade/layout.html.jade.ejs
  25. +25 −3 templates/scaffold/realtime/views/jade/show.html.jade.ejs
  26. +43 −0 templates/scaffold/realtime/views/mustache/index.html.ms.ejs
  27. +5 −0 templates/scaffold/realtime/views/mustache/layout.html.ms.ejs
  28. +23 −0 templates/scaffold/realtime/views/mustache/show.html.ms.ejs
  29. +9 −7 templates/scaffold/views/ejs/index.html.ejs.ejs
  30. +4 −4 templates/scaffold/views/ejs/show.html.ejs.ejs
  31. +10 −9 templates/scaffold/views/jade/index.html.jade.ejs
  32. +3 −3 templates/scaffold/views/jade/show.html.jade.ejs
View
@@ -659,6 +659,7 @@ namespace('gen', function () {
, layoutViewPath
, actions
, addActionView
+ , viewPath
, text
, adapter
, templContent;
@@ -689,7 +690,11 @@ namespace('gen', function () {
// Function to compile the template
addActionView = function (action) {
- text = fs.readFileSync(path.join(templateViewDir, action + ext + '.ejs')).toString();
+ viewPath = path.join(templateViewDir, action + ext + '.ejs');
+ if (!utils.file.existsSync(viewPath)) {
+ return;
+ }
+ text = fs.readFileSync(viewPath).toString();
// Compile template text
adapter = new Adapter({engine: 'ejs', template: text});
@@ -5,12 +5,11 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <%- scriptLink('http://html5shim.googlecode.com/svn/trunk/html5.js', {type:'text/javascript'}) %>
<![endif]-->
<%- scriptLink('/js/jquery.min.js', {type:'text/javascript'}) %>
@@ -35,7 +34,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
</a>
- <%- linkTo('Geddy App', '/', { class: 'brand' }) %>
+ <%- linkTo('Geddy App', '/', {class: 'brand'}) %>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><%- linkTo('Home', '/') %></li>
@@ -2,5 +2,5 @@
<div class="hero-unit geddy-welcome-box">
<h1>Hello, World!</h1>
<p>You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...</p>
- <p><a href="http://geddyjs.org/tutorial.html" class="btn btn-primary btn-large">Lets get you started »</a></p>
+ <p><%- linkTo('Lets get you started »', 'http://geddyjs.org/tutorial.html', {class: 'btn btn-primary btn-large'}) %></p>
</div>
@@ -5,7 +5,6 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
@@ -15,6 +14,8 @@
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="/js/core/core.js"></script>
+ <script type="text/javascript" src="/js/core/models.js"></script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css">
@@ -36,9 +37,9 @@
<a class="brand" href="/">Geddy App</a>
<div class="nav-collapse">
<ul class="nav">
- <li class="active"><a href="/">Home</a></li>
- <li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>
- <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ <li class="active">{{{linkTo 'Home' '/'}}}</li>
+ <li>{{{linkTo 'Tutorial' 'http://geddyjs.org/tutorial'}}}</li>
+ <li>{{{linkTo 'Docs' 'http://geddyjs.org/documentation'}}}</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@@ -1,19 +1,20 @@
!!! html
-
html(lang="en")
head
meta(charset="utf-8")
+ title Geddy App | This app uses Geddy.js
meta(name="description", content="")
meta(name="author", content="")
meta(name="viewport", content="width=device-width")
- title Geddy App | This app uses Geddy.js
// The HTML5 shim, for IE6-8 support of HTML elements
//if lt IE 9
script(src="http://html5shim.googlecode.com/svn/trunk/html5.js")
!= scriptLink('/js/jquery.min.js', {type:'text/javascript'})
!= scriptLink('/js/bootstrap.min.js', {type:'text/javascript'})
+ != scriptLink('/js/core/core.js', {type: 'text/javascript'})
+ != scriptLink('/js/core/models.js', {type: 'text/javascript'})
!= styleLink('/css/bootstrap.min.css', {rel:'stylesheet'})
!= styleLink('/css/style.css', {rel:'stylesheet'})
@@ -38,9 +39,9 @@ html(lang="en")
li.active
!= linkTo('Home', '/')
li
- != linkTo('Tutorial', 'http://geddyjs.org/tutorial.html')
- //li
- != linkTo('Docs', 'http://geddyjs.org/docs.html')
+ != linkTo('Tutorial', 'http://geddyjs.org/tutorial')
+ li
+ != linkTo('Docs', 'http://geddyjs.org/documentation')
.container
!= yield()
@@ -3,4 +3,4 @@
h1 Hello, World!
p You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...
p
- a.btn.btn-primary.btn-large(href="http://geddyjs.org/tutorial.html") Lets get you started »
+ != linkTo('Lets get you started »', 'http://geddyjs.org/tutorial.html', {class: 'btn btn-primary btn-large'})
@@ -5,7 +5,6 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
@@ -15,6 +14,8 @@
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="/js/core/core.js"></script>
+ <script type="text/javascript" src="/js/core/models.js"></script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css">
@@ -36,9 +37,9 @@
<a class="brand" href="/">Geddy App</a>
<div class="nav-collapse">
<ul class="nav">
- <li class="active"><a href="/">Home</a></li>
- <li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>
- <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ <li class="active">{{{linkTo 'Home' '/'}}}</li>
+ <li>{{{linkTo 'Tutorial' 'http://geddyjs.org/tutorial'}}}</li>
+ <li>{{{linkTo 'Docs' 'http://geddyjs.org/documentation'}}}</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@@ -5,18 +5,17 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+ <%- scriptLink('http://html5shim.googlecode.com/svn/trunk/html5.js', {type:'text/javascript'}) %>
<![endif]-->
<%- scriptLink('/js/jquery.min.js', {type:'text/javascript'}) %>
<%- scriptLink('/js/bootstrap.min.js', {type:'text/javascript'}) %>
<%- scriptLink('/js/core/core.js', {type: 'text/javascript'}) %>
- <!-- <script src="/js/models/your_model.js" type="text/javascript"></script> -->
+ <!-- <%- scriptLink('/js/models/your_model.js', {type:'text/javascript'}) %> -->
<%- scriptLink('/js/config/init.js', {type: 'text/javascript'}) %>
<%- styleLink('/css/bootstrap.min.css', {rel:'stylesheet'}) %>
@@ -36,7 +35,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
</a>
- <%- linkTo('Geddy App', '/', { class: 'brand' }) %>
+ <%- linkTo('Geddy App', '/', {class: 'brand'}) %>
<div class="nav-collapse">
<ul class="nav">
<li class="active"><%- linkTo('Home', '/') %></li>
@@ -2,5 +2,5 @@
<div class="hero-unit geddy-welcome-box">
<h1>Hello, World!</h1>
<p>You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...</p>
- <p><a href="http://geddyjs.org/tutorial.html" class="btn btn-primary btn-large">Lets get you started »</a></p>
+ <p><%- linkTo('Lets get you started »', 'http://geddyjs.org/tutorial.html', {class: 'btn btn-primary btn-large'}) %></p>
</div>
@@ -5,7 +5,6 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
@@ -15,6 +14,9 @@
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="/js/core/core.js"></script>
+ <!-- <script type="text/javascript" src="/js/models/your_model.js"></script> -->
+ <script type="text/javascript" src="/js/config/init.js"></script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css">
@@ -36,9 +38,9 @@
<a class="brand" href="/">Geddy App</a>
<div class="nav-collapse">
<ul class="nav">
- <li class="active"><a href="/">Home</a></li>
- <li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>
- <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ <li class="active">{{{linkTo 'Home' '/'}}}</li>
+ <li>{{{linkTo 'Tutorial' 'http://geddyjs.org/tutorial'}}}</li>
+ <li>{{{linkTo 'Docs' 'http://geddyjs.org/documentation'}}}</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@@ -1,19 +1,21 @@
!!! html
-
html(lang="en")
head
meta(charset="utf-8")
+ title Geddy App | This app uses Geddy.js
meta(name="description", content="")
meta(name="author", content="")
meta(name="viewport", content="width=device-width")
- title Geddy App | This app uses Geddy.js
// The HTML5 shim, for IE6-8 support of HTML elements
//if lt IE 9
script(src="http://html5shim.googlecode.com/svn/trunk/html5.js")
!= scriptLink('/js/jquery.min.js', {type:'text/javascript'})
!= scriptLink('/js/bootstrap.min.js', {type:'text/javascript'})
+ != scriptLink('/js/core/core.js', {type: 'text/javascript'})
+ //- != scriptLink('/js/models/your_model.js', {type:'text/javascript'})
+ != scriptLink('/js/config/init.js', {type: 'text/javascript'})
!= styleLink('/css/bootstrap.min.css', {rel:'stylesheet'})
!= styleLink('/css/style.css', {rel:'stylesheet'})
@@ -38,9 +40,9 @@ html(lang="en")
li.active
!= linkTo('Home', '/')
li
- != linkTo('Tutorial', 'http://geddyjs.org/tutorial.html')
- //li
- != linkTo('Docs', 'http://geddyjs.org/docs.html')
+ != linkTo('Tutorial', 'http://geddyjs.org/tutorial')
+ li
+ != linkTo('Docs', 'http://geddyjs.org/documentation')
.container
!= yield()
@@ -3,4 +3,4 @@
h1 Hello, World!
p You've created a Geddy app and your server is running. If you already know what you're doing, feel free to jump into your app logic, if not...
p
- a.btn.btn-primary.btn-large(href="http://geddyjs.org/tutorial.html") Lets get you started »
+ != linkTo('Lets get you started »', 'http://geddyjs.org/tutorial.html', {class: 'btn btn-primary btn-large'})
@@ -5,7 +5,6 @@
<title>Geddy App | This app uses Geddy.js</title>
<meta name="description" content="">
<meta name="author" content="">
-
<meta name="viewport" content="width=device-width" />
<!-- The HTML5 shim, for IE6-8 support of HTML elements -->
@@ -15,6 +14,9 @@
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
+ <script type="text/javascript" src="/js/core/core.js"></script>
+ <!-- <script type="text/javascript" src="/js/models/your_model.js"></script> -->
+ <script type="text/javascript" src="/js/config/init.js"></script>
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/style.css">
@@ -36,9 +38,9 @@
<a class="brand" href="/">Geddy App</a>
<div class="nav-collapse">
<ul class="nav">
- <li class="active"><a href="/">Home</a></li>
- <li><a href="http://geddyjs.org/tutorial.html">Tutorial</a></li>
- <!--<li><a href="http://geddyjs.org/docs.html">Docs</a></li>-->
+ <li class="active">{{{linkTo 'Home' '/'}}}</li>
+ <li>{{{linkTo 'Tutorial' 'http://geddyjs.org/tutorial'}}}</li>
+ <li>{{{linkTo 'Docs' 'http://geddyjs.org/documentation'}}}</li>
</ul>
</div><!--/.nav-collapse -->
</div>
@@ -19,8 +19,7 @@
</div>
<script type="text/javascript">
-$(function(){
-
+$(function () {
geddy.io.addListenersForModels(['<%= names.constructor.singular %>']);
var renderTemplate = function (<%= names.property.singular %>) {
@@ -34,11 +33,11 @@ $(function(){
, ' </div>'
, '</div>'
].join('');
+
return $(template);
}
var <%= names.constructor.plural %>Controller = function (opts) {
-
this.options = opts || {};
this.create = function (<%= names.property.singular %>) {
@@ -54,7 +53,6 @@ $(function(){
};
};
-
geddy.<%= names.constructor.plural %> = new <%= names.constructor.plural %>Controller();
geddy.model.<%= names.constructor.singular %>.on('save' , geddy.<%= names.constructor.plural %>.create);
@@ -3,50 +3,13 @@
<head>
<meta charset="utf-8">
<title>Geddy App | This app uses Geddy.js</title>
- <meta name="description" content="">
- <meta name="author" content="">
-
- <meta name="viewport" content="width=device-width" />
-
- <!-- The HTML5 shim, for IE6-8 support of HTML elements -->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
<%- scriptLink('/js/jquery.min.js', {type:'text/javascript'}) %>
- <%- scriptLink('/js/bootstrap.min.js', {type:'text/javascript'}) %>
<%- scriptLink('/js/core/core.js', {type: 'text/javascript'}) %>
- <!-- <script src="/js/models/your_model.js" type="text/javascript"></script> -->
+ <!-- <%- scriptLink('/js/models/your_model.js', {type:'text/javascript'}) %> -->
<%- scriptLink('/js/config/init.js', {type: 'text/javascript'}) %>
-
- <%- styleLink('/css/bootstrap.min.css', {rel:'stylesheet'}) %>
- <%- styleLink('/css/style.css', {rel:'stylesheet'}) %>
- <%- styleLink('/css/bootstrap.responsive.min.css', {rel:'stylesheet'}) %>
-
- <!-- The fav and touch icons -->
- <link rel="shortcut icon" href="/images/favicon.ico">
- <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
- <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">
</head>
<body>
- <div class="navbar navbar-fixed-top">
- <div class="navbar-inner">
- <div class="container">
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
- <span class="i-bar"><i class="icon-chevron-down icon-white"></i></span>
- </a>
- <%- linkTo('Geddy App', '/', { class: 'brand' }) %>
- <div class="nav-collapse">
- <ul class="nav">
- <li class="active"><%- linkTo('Home', '/') %></li>
- <li><%- linkTo('Tutorial', 'http://geddyjs.org/tutorial') %></li>
- <li><%- linkTo('Docs', 'http://geddyjs.org/documentation') %></li>
- </ul>
- </div><!--/.nav-collapse -->
- </div>
- </div>
- </div>
<div class="container">
<%- yield(); %>
</div>
Oops, something went wrong.

0 comments on commit 315f77e

Please sign in to comment.