From 013e45cfeab5613b45a035dbea0aac85e248dc82 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 21 Oct 2010 09:44:27 -0400 Subject: [PATCH] Adding an Examples section to the homepage. Weak at the moment. More to come. --- index.html | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/index.html b/index.html index 141bbbdd..4889362c 100644 --- a/index.html +++ b/index.html @@ -213,6 +213,9 @@
  • make
  • handleEvents
  • + + Examples + Change Log @@ -1428,6 +1431,85 @@ var DocumentView = Backbone.View.extend({ ... +}); + + +

    Examples

    + +

    + As a quick example to help get an idea of how Backbone can be used in a + real-world project, here are the method signatures (beyond the built-in + methods that Backbone provides) of the Document + model, and the DocumentSet collection, as used in + DocumentCloud. In the workspace, + these classes work together with many others: Project, Note, + Account, Entity, Organization... +

    + +
    +dc.model.Document = Backbone.Model.extend({
    +
    +  initialize(attributes): ...
    +
    +  canonicalId: ...
    +
    +  url: ...
    +  viewerUrl: ...
    +  publishedUrl: ...
    +  pageThumbnailURL(page): ...
    +
    +  openViewer: ...
    +  openPublishedViewer: ...
    +  openText: ...
    +  openPDF: ...
    +
    +  allowedToEdit: ...
    +  checkAllowedToEdit(errorMessage): ...
    +  checkBusy: ...
    +
    +  uniquePageEntities: ...
    +
    +  isPending: ...
    +  isPublic: ...
    +  isPublished: ...
    +
    +  toString: ...
    +
    +});
    +
    +
    +dc.model.DocumentSet = Backbone.Collection.extend({
    +
    +  model: dc.model.Document,
    +
    +  url: '/documents',
    +
    +  initialize(options): ...
    +
    +  comparator(document): ...
    +  
    +  selectAll: ...
    +  deselectAll: ...
    +  selectedIds: ...
    +
    +  filterPending: ...
    +  filterSelected: ...
    +
    +  getCommonAttribute(documents, attribute): ...
    +
    +  allowedToEdit(documents, errorMessage): ...
    +  editAccess(documents): ...
    +
    +  downloadSelectedViewers: ...
    +  downloadSelectedPDFs: ...
    +  downloadSelectedTexts: ...
    +
    +  poll: ...
    +  startPolling: ...
    +  stopPolling: ...
    +
    +  verifyDestroy(documents): ...
    +
     });