Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. // HTML
  2. <head>
  3. <title>Test</title>
  4. </head>
  5.  
  6. <body>
  7. <div id="outer">
  8. {{> admin_prints_list}}
  9. </div>
  10. </body>
  11.  
  12. <template name="admin_prints_list">
  13. <div class="row">
  14. {{> reactiveTable settings=settings}}
  15. </div>
  16. </template>
  17.  
  18. <template name="admin_prints_list_published">
  19. <form>
  20. <p class="center">
  21. <input type="checkbox" class="filled-in checkbox" id="is_published" />
  22. </p>
  23. </form>
  24. </template>
  25.  
  26. // JS
  27. Prints = new Meteor.Collection("print");
  28.  
  29. if (Meteor.isClient) {
  30. Template.admin_prints_list.helpers({
  31. settings: function() {
  32. return {
  33. id: 'prints_list',
  34. collection: Prints.find({}),
  35. fields: [
  36. {key: 'published', label: 'Published', tmpl: Template.admin_prints_list_published},
  37. {key: 'ref', label: 'Ref'},
  38. {key: 'title', label: 'Title'}
  39. ]
  40. };
  41. }
  42. });
  43.  
  44. Template.admin_prints_list_published.events({
  45. 'click .checkbox': function (event, template) {
  46. // template.data will always return first collection object regardless of which row
  47. }
  48. });
  49. }
  50.  
  51. if (Meteor.isServer) {
  52. Meteor.startup(function () {
  53. if (Prints.find().count() === 0) {
  54. Prints.insert({title: "a", ref: "a", published: true});
  55. Prints.insert({title: "b", ref: "b", published: false});
  56. Prints.insert({title: "c", ref: "c", published: false});
  57. Prints.insert({title: "d", ref: "d", published: false});
  58. Prints.insert({title: "e", ref: "e", published: false});
  59. }
  60. });
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement