Permalink
Browse files

Merge pull request #78 from mde/model-adapters

Model Adapters: they work now.
  • Loading branch information...
2 parents aab28ee + fda0372 commit 441ca10e9f039607da87cfbfe9eb215395f8e8c3 @Techwraith Techwraith committed May 1, 2012
Showing with 7,121 additions and 107 deletions.
  1. +3 −0 .gitignore
  2. +25 −0 examples/related_models/app/controllers/application.js
  3. +38 −0 examples/related_models/app/controllers/boxes.js
  4. +30 −0 examples/related_models/app/controllers/main.js
  5. +38 −0 examples/related_models/app/controllers/things.js
  6. +38 −0 examples/related_models/app/controllers/widgets.js
  7. +12 −0 examples/related_models/app/models/box.js
  8. +13 −0 examples/related_models/app/models/thing.js
  9. +12 −0 examples/related_models/app/models/widget.js
  10. +8 −0 examples/related_models/app/views/boxes/add.html.ejs
  11. +8 −0 examples/related_models/app/views/boxes/edit.html.ejs
  12. +8 −0 examples/related_models/app/views/boxes/index.html.ejs
  13. +8 −0 examples/related_models/app/views/boxes/show.html.ejs
  14. +51 −0 examples/related_models/app/views/layouts/application.html.ejs
  15. +6 −0 examples/related_models/app/views/main/index.html.ejs
  16. +8 −0 examples/related_models/app/views/things/add.html.ejs
  17. +8 −0 examples/related_models/app/views/things/edit.html.ejs
  18. +8 −0 examples/related_models/app/views/things/index.html.ejs
  19. +8 −0 examples/related_models/app/views/things/show.html.ejs
  20. +8 −0 examples/related_models/app/views/widgets/add.html.ejs
  21. +8 −0 examples/related_models/app/views/widgets/edit.html.ejs
  22. +8 −0 examples/related_models/app/views/widgets/index.html.ejs
  23. +8 −0 examples/related_models/app/views/widgets/show.html.ejs
  24. +31 −0 examples/related_models/config/development.js
  25. +16 −0 examples/related_models/config/environment.js
  26. +36 −0 examples/related_models/config/init.js
  27. +32 −0 examples/related_models/config/production.js
  28. +39 −0 examples/related_models/config/router.js
  29. +3,363 −0 examples/related_models/public/css/bootstrap.css
  30. +610 −0 examples/related_models/public/css/bootstrap.min.css
  31. +567 −0 examples/related_models/public/css/bootstrap.responsive.css
  32. +3 −0 examples/related_models/public/css/bootstrap.responsive.min.css
  33. +31 −0 examples/related_models/public/css/style.css
  34. BIN examples/related_models/public/favicon.ico
  35. BIN examples/related_models/public/img/glyphicons-halflings-white.png
  36. BIN examples/related_models/public/img/glyphicons-halflings.png
  37. BIN examples/related_models/public/img/whitey.png
  38. +1,722 −0 examples/related_models/public/js/bootstrap.js
  39. +1 −0 examples/related_models/public/js/bootstrap.min.js
  40. +4 −0 examples/related_models/public/js/jquery.min.js
  41. +4 −2 examples/todo_app_mongo/app/controllers/todos.js
  42. +2 −0 examples/todo_app_mongo/app/models/todo.js
  43. +5 −0 examples/todo_app_mongo/config/development.js
  44. +0 −3 examples/todo_app_mongo/config/init.js
  45. +0 −99 examples/todo_app_mongo/lib/model_adapters/todo.js
  46. +33 −1 lib/app.js
  47. +215 −0 lib/model/adapters/mongo.js
  48. +43 −0 lib/model/index.js
  49. +2 −2 package.json
View
@@ -22,3 +22,6 @@ examples/todo_app_mongo/log/stdout.2012-03-06T23:30:22.log
examples/todo_app_mongo/log/stdout.2012-03-06T23:32:01.log
examples/todo_app_mongo/log/stdout.2012-03-07T00:00:22.log
examples/todo_app_mongo/log/stdout.log
+examples/demo
+examples/todo_app_mongo/log
+.log
@@ -0,0 +1,25 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Application = function () {
+};
+
+exports.Application = Application;
+
+
+
@@ -0,0 +1,38 @@
+
+var Boxes = function () {
+ this.respondsWith = ['html', 'json', 'xml', 'js', 'txt'];
+
+ this.index = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.add = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.create = function (req, resp, params) {
+ // Save the resource, then display index page
+ this.redirect({controller: this.name});
+ };
+
+ this.show = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.edit = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.update = function (req, resp, params) {
+ // Save the resource, then display the item page
+ this.redirect({controller: this.name, id: params.id});
+ };
+
+ this.remove = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+};
+
+exports.Boxes = Boxes;
+
@@ -0,0 +1,30 @@
+/*
+ * Geddy JavaScript Web development framework
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var Main = function () {
+ this.index = function (req, resp, params) {
+ this.respond(params, {
+ format: 'html'
+ , template: 'app/views/main/index'
+ });
+ };
+};
+
+exports.Main = Main;
+
+
@@ -0,0 +1,38 @@
+
+var Things = function () {
+ this.respondsWith = ['html', 'json', 'xml', 'js', 'txt'];
+
+ this.index = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.add = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.create = function (req, resp, params) {
+ // Save the resource, then display index page
+ this.redirect({controller: this.name});
+ };
+
+ this.show = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.edit = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.update = function (req, resp, params) {
+ // Save the resource, then display the item page
+ this.redirect({controller: this.name, id: params.id});
+ };
+
+ this.remove = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+};
+
+exports.Things = Things;
+
@@ -0,0 +1,38 @@
+
+var Widgets = function () {
+ this.respondsWith = ['html', 'json', 'xml', 'js', 'txt'];
+
+ this.index = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.add = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.create = function (req, resp, params) {
+ // Save the resource, then display index page
+ this.redirect({controller: this.name});
+ };
+
+ this.show = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.edit = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+ this.update = function (req, resp, params) {
+ // Save the resource, then display the item page
+ this.redirect({controller: this.name, id: params.id});
+ };
+
+ this.remove = function (req, resp, params) {
+ this.respond({params: params});
+ };
+
+};
+
+exports.Widgets = Widgets;
+
@@ -0,0 +1,12 @@
+var Box = function () {
+
+ this.defineProperties({
+ id: {type: 'string', required: true}
+ });
+
+ this.hasMany('Things');
+
+ this.adapter = 'Mongo';
+
+};
+Box = geddy.model.register('Box', Box);
@@ -0,0 +1,13 @@
+var Thing = function () {
+
+ this.defineProperties({
+ id: {type: 'string', required: true}
+ , widgetid: {type: 'string', required: true}
+ });
+
+ this.belongsTo('Box');
+
+ this.adapter = 'Mongo';
+
+};
+Thing = geddy.model.register('Thing', Thing);
@@ -0,0 +1,12 @@
+var Widget = function () {
+
+ this.defineProperties({
+ id: {type: 'string', required: true}
+ });
+
+ this.hasOne('Thing');
+
+ this.adapter = 'Mongo';
+
+};
+Widget = geddy.model.register('Widget', Widget);
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html lang="en">
+ <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]-->
+
+ <script type="text/javascript" src="/js/jquery.min.js"></script>
+ <script type="text/javascript" src="/js/bootstrap.min.js"></script>
+
+ <link rel="stylesheet" href="/css/bootstrap.min.css">
+ <link rel="stylesheet" href="/css/style.css">
+ <link rel="stylesheet" href="/css/bootstrap.responsive.min.css">
+
+ <!-- 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>
+ <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>-->
+ </ul>
+ </div><!--/.nav-collapse -->
+ </div>
+ </div>
+ </div>
+ <div class="container">
+ <%- yield(); %>
+ </div>
+ </body>
+</html>
@@ -0,0 +1,6 @@
+<!-- Lets talk about geddy -->
+<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>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
@@ -0,0 +1,8 @@
+<div class="hero-unit">
+ <h3>Params</h3>
+ <ul>
+ <% for (var p in params) { %>
+ <li><%= p + ': ' + params[p]; %></li>
+ <% } %>
+ </ul>
+</div>
Oops, something went wrong.

0 comments on commit 441ca10

Please sign in to comment.