├── .gitignore ├── Makefile ├── README.md ├── bin └── autoreload ├── docs └── backbonestore.pdf ├── htdocs ├── data │ └── items.json ├── images │ ├── AdventuresInOdyssey.jpg │ ├── AdventuresInOdyssey_t.jpg │ ├── AmericanAttorneys.jpg │ ├── AmericanAttorneys_t.jpg │ ├── BritishCivilLightTransport.jpg │ ├── BritishCivilLightTransport_t.jpg │ ├── PeriodsofMentalAssimilation.jpg │ ├── PeriodsofMentalAssimilation_t.jpg │ ├── Pulaski.jpg │ ├── Pulaski_t.jpg │ ├── StealthMonkeyVirus.png │ ├── StealthMonkeyVirus_t.jpg │ ├── SumsofMagnolia.jpg │ └── SumsofMagnolia_t.jpg ├── index.html ├── jsonstore.css └── store.js ├── package.json └── src └── backbonestore.nw /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo 3 | *# 4 | .#* 5 | .DS_Store 6 | *~ 7 | node_modules/* 8 | bower_components/* 9 | npm-debug.log 10 | docs/*.html 11 | docs/*.tex 12 | htdocs/lib 13 | package.yml 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: setup store serve 2 | 3 | NOTANGLE= notangle 4 | NOWEAVE= noweave 5 | ECHO= echo 6 | 7 | LIBS:= htdocs/lib/underscore.js htdocs/lib/jquery.js htdocs/lib/backbone.js 8 | 9 | all: htdocs/index.html htdocs/store.js htdocs/data/items.json 10 | @if [ ! -e "./htdocs/lib" ]; then \ 11 | echo "Please do 'make setup' before continuing"; \ 12 | exit 1; \ 13 | fi 14 | 15 | serve: all 16 | ./bin/autoreload 17 | 18 | store: all 19 | 20 | htdocs/lib: 21 | mkdir -p htdocs/lib 22 | 23 | htdocs/lib/underscore.js: htdocs/lib 24 | cp bower_components/underscore/underscore.js htdocs/lib 25 | 26 | htdocs/lib/jquery.js: htdocs/lib 27 | cp bower_components/jquery/dist/jquery.js htdocs/lib 28 | 29 | htdocs/lib/backbone.js: 30 | cp bower_components/backbone/backbone.js htdocs/lib 31 | 32 | install: 33 | npm install 34 | ./node_modules/bower/bin/bower install jquery underscore backbone 35 | 36 | setup: install $(LIBS) 37 | 38 | docs: 39 | mkdir -p docs 40 | 41 | htdocs/index.html: src/backbonestore.nw 42 | $(NOTANGLE) -c -Rindex.html src/backbonestore.nw > htdocs/index.html 43 | 44 | htdocs/store.js: src/backbonestore.nw 45 | $(NOTANGLE) -c -Rstore.js src/backbonestore.nw > htdocs/store.js 46 | 47 | docs/backbonestore.tex: docs src/backbonestore.nw 48 | ${NOWEAVE} -x -delay src/backbonestore.nw > docs/backbonestore.tex 49 | 50 | docs/backbonestore.pdf: docs/backbonestore.tex 51 | xelatex docs/backbonestore.tex; \ 52 | while grep -s 'Rerun to get cross-references right' ./backbonestore.log; \ 53 | do \ 54 | xelatex docs/backbonestore.tex; \ 55 | done 56 | mv backbonestore.pdf docs 57 | rm -f ./backbonestore.log ./backbonestore.aux ./backbonestore.out 58 | 59 | pdf: docs/backbonestore.pdf 60 | 61 | docs/backbonestore.html: docs src/backbonestore.nw 62 | $(NOWEAVE) -filter l2h -delay -x -autodefs c -html src/backbonestore.nw > docs/backbonestore.html 63 | 64 | html: docs/backbonestore.html 65 | 66 | clean: 67 | - rm -f htdocs/*.js htdocs/*.html docs/*.tex docs/*.dvi docs/*.aux docs/*.toc docs/*.log docs/*.out 68 | 69 | distclean: clean 70 | - rm -fr ./htdocs/lib 71 | 72 | realclean: distclean 73 | - rm -fr docs 74 | 75 | 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | The Backbone Store is a tutorial and demonstration application for 4 | BackboneJS, a javascript framework for managing data-driven websites. 5 | 6 | ## Installation 7 | 8 | After checking out the source code, type 9 | 10 | $ make setup all serve 11 | 12 | This will automatically run the NPM and Bower install scripts, placing 13 | the correct libraries into the target tree, build the actual application 14 | from the original source material, and start a local server. 15 | 16 | ## Requirements 17 | 18 | The build tool relies upon GNU Make and node-js. It also uses the NoWeb 19 | Literate Programming documentation tools, and building the documentation 20 | from source requires Xelatex be installed as well. 21 | 22 | The command 'make serve' probably only works under a fairly modern 23 | Linux, as it is dependent upon the kernel's inotify facility. 24 | 25 | ## Branches 26 | 27 | There are two major development branches for The Backbone Store. 28 | 29 | Branch 'master' uses HTML, CSS, and Javascript. 30 | 31 | Branch 'modern' uses HAML, Stylus, and Coffee. 32 | 33 | ## Changelog 34 | 35 | ### Changes from 2.0 36 | 37 | Version 3.0 has the following notable changes: 38 | * Replace __super__ with prototype 39 | * Replace Backbone-generated internal IDs with supplied IDs 40 | * Updates the use of Deferred 41 | * Updates to the current Underscore Template mechanism 42 | 43 | ### Changes from 1.0 44 | 45 | Version 2.0 has the following notable changes: 46 | * Use of jQuery animations 47 | * Better Styling 48 | * Proper event management. Version 1.0 was just doin' it WRONG. 49 | 50 | ## Copyright 51 | 52 | Store.js is entirely my own work, and is Copyright (c) 2010 Elf 53 | M. Sternberg. Included libraries are covered by their respective 54 | copyright holders, and are used with permission of the licenses 55 | included. Store.js is intended for educational purposes only, rather 56 | than to be working code, and is hereby licensed under the Creative 57 | Commons Attribution Non-Commercial Share Alike (by-nc-sa) licence. 58 | 59 | The images contained herein are derivative works of photographs 60 | licensed under Creative Commons licences for non-commercial purposes. 61 | 62 | ## Contribution 63 | 64 | Please look in backbonestore.nw for the base code. Backbonestore.nw 65 | is produced using the Noweb Literate Programming toolkit by Norman 66 | Ramsey (http://www.cs.tufts.edu/~nr/noweb/). 67 | -------------------------------------------------------------------------------- /bin/autoreload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var fs = require('fs'); 3 | var Inotify = require('inotify').Inotify; 4 | 5 | var spawn = require('child_process').spawn; 6 | 7 | var spew = function(data) { 8 | return console.log(data.toString('utf8')); 9 | }; 10 | 11 | var server = spawn('./node_modules/http-server/bin/http-server', ['./htdocs/']); 12 | server.stdout.on('data', spew); 13 | 14 | var monitor = new Inotify(); 15 | 16 | var reBuild = function() { 17 | var maker = spawn('make', ['store']); 18 | return maker.stdout.on('data', spew); 19 | }; 20 | 21 | monitor.addWatch({ 22 | path: "./src/backbonestore.nw", 23 | watch_for: Inotify.IN_CLOSE_WRITE, 24 | callback: reBuild 25 | }); 26 | 27 | -------------------------------------------------------------------------------- /docs/backbonestore.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/docs/backbonestore.pdf -------------------------------------------------------------------------------- /htdocs/data/items.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "unless-you-have-been-drinking", 4 | "title": "Unless You Have Been Drinking", 5 | "artist": "Adventures in Odyssey", 6 | "image": "images/AdventuresInOdyssey_t.jpg", 7 | "large_image": "images/AdventuresInOdyssey.jpg", 8 | "price": 9.98, 9 | "url": "http://www.amazon.com/Door-Religious-Knives/dp/B001FGW0UQ/?tag=quirkey-20" 10 | }, 11 | { 12 | "id": "leave-to-do-my-utmost", 13 | "title": "Leave To Do My Utmost", 14 | "artist": "American Attorneys", 15 | "image": "images/AmericanAttorneys_t.jpg", 16 | "large_image": "images/AmericanAttorneys.jpg", 17 | "price": 13.98, 18 | "url": "http://www.amazon.com/gp/product/B002GNOMJE?ie=UTF8&tag=quirkeycom-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=B002GNOMJE" 19 | }, 20 | { 21 | "id": "the-dead-sleep-encircled-by-the-living", 22 | "title": "The Dead Sleep Encircled by The Living", 23 | "artist": "British Civil Light Transport", 24 | "image": "images/BritishCivilLightTransport_t.jpg", 25 | "large_image": "images/BritishCivilLightTransport.jpg", 26 | "price": 13.98, 27 | "url": "http://www.amazon.com/Bitte-Orca-Dirty-Projectors/dp/B0026T4RTI/ref=pd_sim_m_12?tag=quirkey-20" 28 | }, 29 | { 30 | "id": "periods-of-mental-assimilation", 31 | "title": "Periods of Mental Assimilation", 32 | "artist": "Grigory Szondy", 33 | "image": "images/PeriodsofMentalAssimilation_t.jpg", 34 | "large_image": "images/PeriodsofMentalAssimilation.jpg", 35 | "price": 13.99, 36 | "url": "http://www.amazon.com/Pains-Being-Pure-Heart/dp/B001LGXIDS/ref=pd_sim_m_44?tag=quirkey-20" 37 | }, 38 | { 39 | "id": "keenly-developed-moral-bankruptcy", 40 | "title": "Keenly Developed Moral Bankruptcy", 41 | "artist": "Stealth Monkey Virus", 42 | "image": "images/StealthMonkeyVirus_t.jpg", 43 | "large_image": "images/StealthMonkeyVirus.png", 44 | "price": 13.99, 45 | "url": "http://www.amazon.com/Pains-Being-Pure-Heart/dp/B001LGXIDS/ref=pd_sim_m_44?tag=quirkey-20" 46 | }, 47 | { 48 | "id": "my-mistresss-sparrow-is-dead", 49 | "title": "My Mistress's Sparrow is Dead", 50 | "artist": "Sums of Mongolia", 51 | "image": "images/SumsofMagnolia_t.jpg", 52 | "large_image": "images/SumsofMagnolia.jpg", 53 | "price": 13.99, 54 | "url": "http://www.amazon.com/Pains-Being-Pure-Heart/dp/B001LGXIDS/ref=pd_sim_m_44?tag=quirkey-20" 55 | } 56 | ] 57 | -------------------------------------------------------------------------------- /htdocs/images/AdventuresInOdyssey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/AdventuresInOdyssey.jpg -------------------------------------------------------------------------------- /htdocs/images/AdventuresInOdyssey_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/AdventuresInOdyssey_t.jpg -------------------------------------------------------------------------------- /htdocs/images/AmericanAttorneys.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/AmericanAttorneys.jpg -------------------------------------------------------------------------------- /htdocs/images/AmericanAttorneys_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/AmericanAttorneys_t.jpg -------------------------------------------------------------------------------- /htdocs/images/BritishCivilLightTransport.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/BritishCivilLightTransport.jpg -------------------------------------------------------------------------------- /htdocs/images/BritishCivilLightTransport_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/BritishCivilLightTransport_t.jpg -------------------------------------------------------------------------------- /htdocs/images/PeriodsofMentalAssimilation.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/PeriodsofMentalAssimilation.jpg -------------------------------------------------------------------------------- /htdocs/images/PeriodsofMentalAssimilation_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/PeriodsofMentalAssimilation_t.jpg -------------------------------------------------------------------------------- /htdocs/images/Pulaski.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/Pulaski.jpg -------------------------------------------------------------------------------- /htdocs/images/Pulaski_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/Pulaski_t.jpg -------------------------------------------------------------------------------- /htdocs/images/StealthMonkeyVirus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/StealthMonkeyVirus.png -------------------------------------------------------------------------------- /htdocs/images/StealthMonkeyVirus_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/StealthMonkeyVirus_t.jpg -------------------------------------------------------------------------------- /htdocs/images/SumsofMagnolia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/SumsofMagnolia.jpg -------------------------------------------------------------------------------- /htdocs/images/SumsofMagnolia_t.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elfsternberg/The-Backbone-Store/82af8f6a443664a91af2edd707060b09e357e5d4/htdocs/images/SumsofMagnolia_t.jpg -------------------------------------------------------------------------------- /htdocs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |