var section = function (title, options) { return _.extend({}, { type: "section", title: title, }, options); }; var item = function (name, options) { if (! options) { options = { longname: name }; } return _.extend({}, { type: "item", name: name }, options); }; var sections = [ section("Templates", { id: "templates", subtitle: "Create views that update automatically when data changes", items: [ item("Defining templates in HTML", {id: "defining-templates"}), item("Template.name.helpers", {longname: "Template#helpers"}), item("Template.name.events", {longname: "Template#events"}), item("Template.name.rendered", {longname: "Template#rendered"}), item("template.findAll", {longname: "Blaze.TemplateInstance#findAll"}), item("template.find", {longname: "Blaze.TemplateInstance#find"}) ] }), section("Session", { id: "session", subtitle: "Store temporary data for the user interface", items: [ item("Session.set"), item("Session.get") ] }), section("Tracker", { id: "tracker", subtitle: "Re-run functions when data changes", items: [ item("Tracker.autorun") ] }), section("Collections", { id: "collections", subtitle: "Store persistent data", items: [ item("Mongo.Collection"), item("collection.findOne", {longname: "Mongo.Collection#findOne"}), item("collection.find", {longname: "Mongo.Collection#find"}), item("collection.insert", {longname: "Mongo.Collection#insert"}), item("collection.update", {longname: "Mongo.Collection#update"}), item("collection.remove", {longname: "Mongo.Collection#remove"}), item("collection.allow", {longname: "Mongo.Collection#allow"}), item("collection.deny", {longname: "Mongo.Collection#deny"}), ] }), section("Accounts", { id: "accounts", subtitle: "Let users log in with passwords, Facebook, Google, GitHub, etc.", items: [ item("{{> loginButtons}}", {id: "loginButtons"}), item("Meteor.user"), item("Meteor.userId"), item("Meteor.users"), item("{{currentUser}}", {longname: "currentUser"}) ] }), section("Methods", { id: "methods", subtitle: "Call server functions from the client", items: [ item("Meteor.methods"), item("Meteor.call"), item("Meteor.Error") ] }), section("Publish / Subscribe", { id: "pubsub", subtitle: "Sync part of your data to the client", items: [ item("Meteor.publish"), item("Meteor.subscribe") ] }), section("Environment", { id: "environment", subtitle: "Control when and where your code runs", items: [ item("Meteor.isClient"), item("Meteor.isServer"), item("meteor.startup") ] }), section("Packages", { id: "packages", subtitle: "Add extra functionality to your app with 'meteor add'", items: [ item("Searching on Atmosphere", {id: "using-atmosphere"}), item("accounts-ui"), item("coffeescript"), item("jade"), item("jquery"), item("http"), item("less"), item("markdown"), item("underscore") ] }) ]; Template.basicTableOfContents.helpers({ sections: sections, linkForItem: function () { var self = this; if (self.id) { return "#" + self.id; } else if (self.longname) { return "#" + self.longname.replace(/[#.]/g, "-"); } }, linkForSection: function () { return "#" + this.id; } });