example stuff from demo

This commit is contained in:
David Greenspan
2013-07-01 15:31:44 -07:00
parent f1853086ed
commit 317fc8abee
3 changed files with 25 additions and 27 deletions

View File

@@ -0,0 +1 @@
.foo { background: red; }

View File

@@ -1,31 +1,24 @@
<head>
<title>shark</title>
<title>Shark Test</title>
</head>
<body>
<div class="{{containerClass}}">
<h1>Hello {{name}}</h1>
{{#each items}}
{{#divwrap}}
<div>{{text}}</div>
{{/divwrap}}
{{#item}}
{{text}}
{{/item}}
{{else}}
<strong>Empty</strong>
{{/each}}
<p>{{#twice middle="<hr>"}}testing{{foo}}{{/twice}}</p>
</div>
</body>
<template name="blah">
HI
<template name="item">
<div>{{> content}}</div>
<div>{{> content text=foo}}</div>
{{rand}}
</template>
<template name="twice">
{{> content foo=123}} {{{middle}}} {{> content foo=456}}
</template>
<template name="divwrap">
<div>{{> content}}</div>
</template>

View File

@@ -1,20 +1,24 @@
Items = new Meteor.Collection(null);
Items.insert({ text: 'Foo' });
Items.insert({ text: 'Bar' });
Items.insert({ text: 'Baz' });
Body({
items: function () {
return Items.find({}, { sort: { text: 1 }});
},
name: 'David'
});
Meteor.startup(function () {
Items.insert({ text: 'Qux' });
Items.remove({ text: 'Foo' });
Items.update({ text: 'Bar' }, { text: 'Car' });
});
Body({
items: function () {
return Items.find({}, { sort: { text: 1 }});
},
name: 'David',
containerClass: function () { return Session.get('containerClass'); }
});
Template.item({
foo: function () { return Session.get('foo'); },
rand: function () { return Math.random(); },
built: function () { console.log('built'); }
});