Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified some of the template. Property-ized the values in the left b…

…ar. Spent a lot of time trying to get Meteor to limit the results of the DB queries, but it won't. Also, disabling the client-side database convenience methods also disables the server-side ops. Tragic. Regardless, I will persevere.
  • Loading branch information...
commit 28bfcf464174725b4080a342897c9f5f3da89253 1 parent 469dc85
@bmelton authored
Showing with 53 additions and 11 deletions.
  1. +17 −4 orbvt.html
  2. +36 −6 orbvt.js
  3. +0 −1  server/orbvt.js
View
21 orbvt.html
@@ -7,15 +7,13 @@
<h1>Orbvt</h1>
<span>A 'Svtble' clone in Meteor.</h1>
<ul>
- <li><a href="http://twitter.com/bmelton/">@bmelton</a></li>
- <li><a href="http://github.com/bmelton/">github.com/bmelton</a></li>
- <li><a href="http://sympodial.com">sympodial.com</a></li>
+ {{>properties}}
<li><a href="mailto:barry.melton@gmail.com">barry.melton@gmail.com</a></li>
</ul>
<span class="powered-by">Powered by <a href="http://github.com/bmelton/orbvt/">Orbvt</a></span>
</header>
<div id="container">
- <time>April 11, 2012</time>
+ <time>{{>stamp}}</time>
<div id="content">
{{>orbvt}}
</div>
@@ -25,10 +23,25 @@
<div>
{{#each posts}}
{{>post}}
+ <a href="#" id="{{_id}}" class="destroy">Delete</a>
{{/each}}
</div>
</template>
+<template name="properties">
+ {{#each properties}}
+ {{>property}}
+ {{/each}}
+</template>
+
+<template name="property">
+ <li><a href="{{href}}" target="_blank">{{name}}</a></li>
+</template>
+
+<template name="stamp">
+ {{stamp}}
+ <div style="float: right; margin-right: 40px;"><a id="new_post" href="#">New Post</a></div>
+</template>
<template name="post">
<section id="{{_id}}">
<div class="post contain">
View
42 orbvt.js
@@ -1,9 +1,32 @@
Posts = new Meteor.Collection("Orbvt");
default_message = "This is the first post on the Orbvt (and cannot be destroyed), the somewhat ridiculous Svbtle clone built on the significantly less ridiculous Meteor application framework. The admin console is *no longer* the Javascript console. Now I have to build one.";
+Properties = new Meteor.Collection("Properties");
+
+months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
+
if (Meteor.is_client) {
+ Template.stamp.stamp = function() {
+ var d = new Date();
+ month = months[d.getMonth()];
+ day = d.getDay();
+ year = d.getFullYear();
+ return month + "&nbsp;&nbsp;&nbsp;" + day + ",&nbsp;&nbsp;&nbsp;" + year ;
+ };
+ Template.stamp.events = {
+ 'click #new_post': function(event) {
+ post = {title: 'New post', author: 'bmelton', content: new Date() + ' is when you created this new post.', date: 'April 11', timestamp: new Date()};
+ Posts.insert(post);
+ }
+ }
+
Template.orbvt.posts = function() {
- return Posts.find({}, {}, 10, 0);
+ // collection.find({}, {'skip':1, 'limit':1, 'sort':'a'},
+ return Posts.find({}, {sort: {timestamp: -1}});
+ };
+
+ Template.properties.properties = function() {
+ return Properties.find();
};
Template.orbvt.events = {
@@ -13,7 +36,7 @@ if (Meteor.is_client) {
'click .destroy': function (event) {
Posts.remove(event.currentTarget.id);
if(Posts.find().count() == 0) {
- var post = {title: 'Test post', author: 'bmelton', content: default_message, date: 'April 11'};
+ var post = {title: 'Test post', author: 'bmelton', content: default_message, date: 'April 11', timestamp: new Date()};
Posts.insert(post);
}
}
@@ -23,11 +46,18 @@ if (Meteor.is_client) {
if (Meteor.is_server) {
Meteor.startup(function () {
if(Posts.find().count() === 0) {
- var post = {title: 'Test post', author: 'bmelton', content: default_message, date: 'April 11'};
+ var post = {title: 'Test post', author: 'bmelton', content: default_message, date: 'April 11', timestamp: new Date()};
Posts.insert(post);
}
+
+ if(Properties.find().count() == 0) {
+ Properties.insert({name: "@bmelton", type: "link", href : "http://twitter.com/bmelton/"});
+ Properties.insert({name: "github.com/bmelton", type: "link", href : "http://github.com/bmelton/"});
+ Properties.insert({name: "sympodial.com", type: "link", href : "http://sympodial.com/"});
+ }
});
- Meteor.default_server.method_handlers['/Orbvt/insert'] = function () {};
- Meteor.default_server.method_handlers['/Orbvt/remove'] = function () {};
- Meteor.default_server.method_handlers['/Orbvt/update'] = function () {};
+
+ // Meteor.default_server.method_handlers['/Posts/insert'] = function () {};
+ // Meteor.default_server.method_handlers['/Posts/remove'] = function () {};
+ // Meteor.default_server.method_handlers['/Posts/update'] = function () {};
}
View
1  server/orbvt.js
@@ -1 +0,0 @@
-Meteor.default_server.method_handlers['/posts/insert'] = function () {};
Please sign in to comment.
Something went wrong with that request. Please try again.