mirror of
https://github.com/jashkenas/backbone.git
synced 2026-01-23 13:58:06 -05:00
Adding an Examples section to the homepage. Weak at the moment. More to come.
This commit is contained in:
82
index.html
82
index.html
@@ -213,6 +213,9 @@
|
||||
<li>– <a href="#View-make">make</a></li>
|
||||
<li>– <a href="#View-handleEvents">handleEvents</a></li>
|
||||
</ul>
|
||||
<a class="toc_title" href="#examples">
|
||||
Examples
|
||||
</a>
|
||||
<a class="toc_title" href="#changelog">
|
||||
Change Log
|
||||
</a>
|
||||
@@ -1428,6 +1431,85 @@ var DocumentView = Backbone.View.extend({
|
||||
|
||||
...
|
||||
|
||||
});
|
||||
</pre>
|
||||
|
||||
<h2 id="examples">Examples</h2>
|
||||
|
||||
<p>
|
||||
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 <b>Document</b>
|
||||
model, and the <b>DocumentSet</b> collection, as used in
|
||||
<a href="http://www.documentcloud.org">DocumentCloud</a>. In the workspace,
|
||||
these classes work together with many others: <b>Project</b>, <b>Note</b>,
|
||||
<b>Account</b>, <b>Entity</b>, <b>Organization</b>...
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
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): ...
|
||||
|
||||
});
|
||||
</pre>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user