├── app ├── js │ ├── templates │ │ ├── lists │ │ │ ├── menuitem.html │ │ │ └── form.html │ │ ├── auth.html │ │ ├── tasks │ │ │ ├── task.html │ │ │ ├── index.html │ │ │ └── edit.html │ │ └── app.html │ ├── models │ │ ├── tasklist.js │ │ └── task.js │ ├── collections │ │ ├── tasks.js │ │ └── tasklists.js │ ├── config.js │ ├── main.js │ ├── views │ │ ├── auth.js │ │ ├── lists │ │ │ ├── add.js │ │ │ ├── menu.js │ │ │ ├── edit.js │ │ │ └── menuitem.js │ │ ├── app.js │ │ └── tasks │ │ │ ├── edit.js │ │ │ ├── task.js │ │ │ └── index.js │ ├── app.js │ ├── gapi.js │ └── lib │ │ ├── underscore-min.js │ │ ├── text.js │ │ ├── backbone-min.js │ │ └── backbone.js ├── img │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── index.html └── css │ └── app.css ├── test ├── app.test.js ├── setup.js ├── index.html ├── lists.test.js └── fixtures │ └── gapi.js ├── require-config.js ├── README.md ├── package.json ├── server.js └── grunt.js /app/js/templates/lists/menuitem.html: -------------------------------------------------------------------------------- 1 | {{title}} 2 | -------------------------------------------------------------------------------- /app/js/templates/auth.html: -------------------------------------------------------------------------------- 1 | Sign In with Google 2 | -------------------------------------------------------------------------------- /app/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereobooster/dailyjs-backbone-tutorial/master/app/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /test/app.test.js: -------------------------------------------------------------------------------- 1 | suite('App', function() { 2 | test('Should be present', function() { 3 | assert.ok(window.bTask); 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /test/setup.js: -------------------------------------------------------------------------------- 1 | var assert = chai.assert; 2 | 3 | mocha.setup({ 4 | ui: 'tdd' 5 | , globals: ['bTask', 'gapi', '___jsl', 'confirm'] 6 | }); 7 | -------------------------------------------------------------------------------- /app/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stereobooster/dailyjs-backbone-tutorial/master/app/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /app/js/models/tasklist.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | var TaskList = Backbone.Model.extend({ 3 | url: 'tasklists' 4 | }); 5 | 6 | return TaskList; 7 | }); 8 | -------------------------------------------------------------------------------- /require-config.js: -------------------------------------------------------------------------------- 1 | ({ 2 | appDir: 'app/' 3 | , baseUrl: 'js' 4 | , paths: {} 5 | , dir: 'build/' 6 | , mainConfigFile : 'app/js/main.js' 7 | , modules: [{ name: 'main' }] 8 | }) 9 | -------------------------------------------------------------------------------- /app/js/models/task.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | var Task = Backbone.Model.extend({ 3 | url: 'tasks', 4 | defaults: { title: '', notes: '' } 5 | }); 6 | 7 | return Task; 8 | }); 9 | -------------------------------------------------------------------------------- /app/js/collections/tasks.js: -------------------------------------------------------------------------------- 1 | define(['models/task'], function(Task) { 2 | var Tasks = Backbone.Collection.extend({ 3 | model: Task, 4 | url: 'tasks' 5 | }); 6 | 7 | return Tasks; 8 | }); 9 | -------------------------------------------------------------------------------- /app/js/collections/tasklists.js: -------------------------------------------------------------------------------- 1 | define(['models/tasklist'], function(TaskList) { 2 | var TaskLists = Backbone.Collection.extend({ 3 | model: TaskList 4 | , url: 'tasklists' 5 | }); 6 | 7 | return TaskLists; 8 | }); 9 | -------------------------------------------------------------------------------- /app/js/templates/tasks/task.html: -------------------------------------------------------------------------------- 1 | 2 | {{title}} 3 | {{notes}} 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repository is from a tutorial for http://dailyjs.com 2 | 3 | To use the code, you need to get an Google Tasks API key and Client ID. Set these values in `app/js/config.js`. See [DailyJS](http://dailyjs.com) for details. 4 | -------------------------------------------------------------------------------- /app/js/config.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | var config = {}; 3 | config.apiKey = ''; 4 | config.scopes = 'https://www.googleapis.com/auth/tasks https://www.googleapis.com/auth/userinfo.profile'; 5 | config.clientId = ''; 6 | 7 | _.templateSettings = { 8 | interpolate: /\{\{(.+?)\}\}/g 9 | }; 10 | 11 | return config; 12 | }); 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "btask" 3 | , "version": "0.0.1" 4 | , "private": true 5 | , "dependencies": { 6 | "requirejs": "latest" 7 | , "connect": "2.7.0" 8 | } 9 | , "devDependencies": { 10 | "mocha": "latest" 11 | , "chai": "latest" 12 | , "grunt": "latest" 13 | , "grunt-exec": "latest" 14 | } 15 | , "scripts": { 16 | "grunt": "node_modules/.bin/grunt" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | var connect = require('connect') 2 | , http = require('http') 3 | , app 4 | ; 5 | 6 | app = connect() 7 | .use(connect.static('app')) 8 | .use('/js/lib/', connect.static('node_modules/requirejs/')) 9 | .use('/node_modules', connect.static('node_modules')) 10 | .use('/test', connect.static('test/')) 11 | .use('/test', connect.static('app')) 12 | ; 13 | 14 | http.createServer(app).listen(8080, function() { 15 | console.log('Running on http://localhost:8080'); 16 | }); 17 | -------------------------------------------------------------------------------- /app/js/main.js: -------------------------------------------------------------------------------- 1 | requirejs.config({ 2 | baseUrl: 'js', 3 | 4 | paths: { 5 | text: 'lib/text' 6 | }, 7 | 8 | shim: { 9 | 'lib/underscore-min': { 10 | exports: '_' 11 | }, 12 | 'lib/backbone': { 13 | deps: ['lib/underscore-min'] 14 | , exports: 'Backbone' 15 | }, 16 | 'app': { 17 | deps: ['lib/underscore-min', 'lib/backbone'] 18 | } 19 | } 20 | }); 21 | 22 | require([ 23 | 'app' 24 | ], 25 | 26 | function(App) { 27 | window.bTask = new App(); 28 | }); 29 | -------------------------------------------------------------------------------- /app/index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |