mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
131 lines
3.6 KiB
JavaScript
131 lines
3.6 KiB
JavaScript
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.<em>name</em>.helpers", {longname: "Template#helpers"}),
|
|
item("Template.<em>name</em>.events", {longname: "Template#events"}),
|
|
item("Template.<em>name</em>.rendered", {longname: "Template#rendered"}),
|
|
item("<em>template</em>.findAll", {longname: "Blaze.TemplateInstance#findAll"}),
|
|
item("<em>template</em>.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("<em>collection</em>.findOne", {longname: "Mongo.Collection#findOne"}),
|
|
item("<em>collection</em>.find", {longname: "Mongo.Collection#find"}),
|
|
item("<em>collection</em>.insert", {longname: "Mongo.Collection#insert"}),
|
|
item("<em>collection</em>.update", {longname: "Mongo.Collection#update"}),
|
|
item("<em>collection</em>.remove", {longname: "Mongo.Collection#remove"}),
|
|
item("<em>collection</em>.allow", {longname: "Mongo.Collection#allow"}),
|
|
item("<em>collection</em>.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;
|
|
}
|
|
}); |