Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // HTML
- <head>
- <title>Test</title>
- </head>
- <body>
- <div id="outer">
- {{> admin_prints_list}}
- </div>
- </body>
- <template name="admin_prints_list">
- <div class="row">
- {{> reactiveTable settings=settings}}
- </div>
- </template>
- <template name="admin_prints_list_published">
- <form>
- <p class="center">
- <input type="checkbox" class="filled-in checkbox" id="is_published" />
- </p>
- </form>
- </template>
- // JS
- Prints = new Meteor.Collection("print");
- if (Meteor.isClient) {
- Template.admin_prints_list.helpers({
- settings: function() {
- return {
- id: 'prints_list',
- collection: Prints.find({}),
- fields: [
- {key: 'published', label: 'Published', tmpl: Template.admin_prints_list_published},
- {key: 'ref', label: 'Ref'},
- {key: 'title', label: 'Title'}
- ]
- };
- }
- });
- Template.admin_prints_list_published.events({
- 'click .checkbox': function (event, template) {
- // template.data will always return first collection object regardless of which row
- }
- });
- }
- if (Meteor.isServer) {
- Meteor.startup(function () {
- if (Prints.find().count() === 0) {
- Prints.insert({title: "a", ref: "a", published: true});
- Prints.insert({title: "b", ref: "b", published: false});
- Prints.insert({title: "c", ref: "c", published: false});
- Prints.insert({title: "d", ref: "d", published: false});
- Prints.insert({title: "e", ref: "e", published: false});
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement