mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
example stuff from demo
This commit is contained in:
1
examples/unfinished/shark/client/shark.css
Normal file
1
examples/unfinished/shark/client/shark.css
Normal file
@@ -0,0 +1 @@
|
||||
.foo { background: red; }
|
||||
@@ -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>
|
||||
|
||||
@@ -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'); }
|
||||
});
|
||||
Reference in New Issue
Block a user