textcircle.js 632 B

123456789101112131415161718192021222324252627
  1. // Note: not Documents, but this.Documents, because of the editing package (?)
  2. this.Documents = new Mongo.Collection("documents");
  3. if (Meteor.isClient) {
  4. Template.editor.helpers({
  5. docid: function () {
  6. let doc = Documents.findOne();
  7. return doc ? doc._id : undefined;
  8. }
  9. });
  10. Template.date_display.helpers({
  11. current_date: function () {
  12. return new Date();
  13. }
  14. });
  15. }
  16. if (Meteor.isServer) {
  17. Meteor.startup(function () {
  18. // startup code that creates a document in case there isn't one yet.
  19. if (!Documents.findOne()) {
  20. Documents.insert({ title: "my new document" });
  21. }
  22. });
  23. }