From: Steve Sutton Date: Sun, 9 Aug 2015 13:25:09 +0000 (-0400) Subject: new sources X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2c3e36c074c8ebd4ec609587b53cf564ee8fe05e;p=prog%2FDash.git new sources --- 2c3e36c074c8ebd4ec609587b53cf564ee8fe05e diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..1b1fc02 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,6 @@ +{ + "directory": "libs", + "analytics": false, + "timeout": 120000, + "cwd": "/var/www/html" +} diff --git a/assets/logo.gif b/assets/logo.gif new file mode 100644 index 0000000..403fbae Binary files /dev/null and b/assets/logo.gif differ diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..4ad2efc --- /dev/null +++ b/bower.json @@ -0,0 +1,26 @@ +{ + "name": "Glm Backbone Demo", + "version": "0.0.1", + "authors": [ + "Steve Sutton " + ], + "description": "Backbone Demo for tracking projects", + "main": "\"main.js\"", + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "js", + "test", + "tests" + ], + "dependencies": { + "jquery": "~2.1.4", + "backbone": "~1.2.1", + "bootstrap": "~3.3.5", + "requirejs": "~2.1.20", + "handlebars": "~3.0.3" + }, + "devDependencies": {} +} diff --git a/dash/app.js b/dash/app.js new file mode 100644 index 0000000..5ff209a --- /dev/null +++ b/dash/app.js @@ -0,0 +1,8 @@ +$(document).ready(function(){ + var task1 = new Task({title: "new task #1"}); + var task2 = new Task({title: "new task #2"}); + var taskView1 = new TaskView({model: task1}); + console.log(taskView1.render().el); + var taskView2 = new TaskView({model: task2}); + console.log(taskView2.render().el); +}); diff --git a/dash/collections/Tasks.js b/dash/collections/Tasks.js new file mode 100644 index 0000000..97b0d28 --- /dev/null +++ b/dash/collections/Tasks.js @@ -0,0 +1,3 @@ +var Tasks = Backbone.Collection.extend({ + model: Task +}); diff --git a/dash/models/Project.js b/dash/models/Project.js new file mode 100644 index 0000000..5812af0 --- /dev/null +++ b/dash/models/Project.js @@ -0,0 +1,5 @@ +var Project = Backbone.Model.extend({ + defaults: { + title: "undefined" + } +}); diff --git a/dash/models/Task.js b/dash/models/Task.js new file mode 100644 index 0000000..af26f1a --- /dev/null +++ b/dash/models/Task.js @@ -0,0 +1,7 @@ +var Task = Backbone.Model.extend({ + defaults: { + title: "untitled", + complete: false, + project: 0 + } +}); diff --git a/dash/views/TaskListView.js b/dash/views/TaskListView.js new file mode 100644 index 0000000..43bb409 --- /dev/null +++ b/dash/views/TaskListView.js @@ -0,0 +1,13 @@ +var TaskListView = Backbone.View.extend({ + el: '#myList', + tagName: 'section', + template: _.template('

<%= title %>

'), + initialize: function(){ + this.render(); + }, + render: function(){ + var taskView = this.collection.map(function(task){ + return (new TaskView({model: task}).render().el); + }); + } +}); diff --git a/dash/views/TaskView.js b/dash/views/TaskView.js new file mode 100644 index 0000000..ae51baa --- /dev/null +++ b/dash/views/TaskView.js @@ -0,0 +1,9 @@ +var TaskView = Backbone.View.extend({ + tagName: 'article', + className: 'task', + template: _.template('

<%= title %>

'), + render: function(){ + this.$el.append(this.template(this.model.toJSON())); + return this; + } +}); diff --git a/index.html b/index.html new file mode 100644 index 0000000..14bc443 --- /dev/null +++ b/index.html @@ -0,0 +1,53 @@ + + + + + + Gaslight Backbone Demo + + + + +
+
+
+ + + + + + + + + + + + + + diff --git a/libs/backbone/.bower.json b/libs/backbone/.bower.json new file mode 100644 index 0000000..62e5c56 --- /dev/null +++ b/libs/backbone/.bower.json @@ -0,0 +1,32 @@ +{ + "name": "backbone", + "version": "1.2.1", + "main": "backbone.js", + "dependencies": { + "underscore": ">=1.7.0" + }, + "ignore": [ + "docs", + "examples", + "test", + "*.yml", + "*.html", + "*.ico", + "*.md", + "CNAME", + ".*", + "karma.*", + "component.json", + "package.json" + ], + "homepage": "https://github.com/jashkenas/backbone", + "_release": "1.2.1", + "_resolution": { + "type": "version", + "tag": "1.2.1", + "commit": "938a8ff934fd4de4f0009f68d43f500f5920b490" + }, + "_source": "git://github.com/jashkenas/backbone.git", + "_target": "~1.2.1", + "_originalSource": "backbone" +} \ No newline at end of file diff --git a/libs/backbone/LICENSE b/libs/backbone/LICENSE new file mode 100644 index 0000000..184d1b9 --- /dev/null +++ b/libs/backbone/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2010-2015 Jeremy Ashkenas, DocumentCloud + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/libs/backbone/backbone-min.js b/libs/backbone/backbone-min.js new file mode 100644 index 0000000..f29903b --- /dev/null +++ b/libs/backbone/backbone-min.js @@ -0,0 +1,2 @@ +(function(t){var e=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){e.Backbone=t(e,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(s){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var s=t.Backbone;var n=[].slice;e.VERSION="1.2.1";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,s){return i[e](this[r],t,s)};case 4:return function(t,s,n){return i[e](this[r],t,s,n)};default:return function(){var t=n.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var o=function(t,e,r){i.each(e,function(e,s){if(i[s])t.prototype[s]=a(e,s,r)})};var h=e.Events={};var u=/\s+/;var l=function(t,e,r,s,n){var a=0,o;if(r&&typeof r==="object"){if(s!==void 0&&"context"in n&&n.context===void 0)n.context=s;for(o=i.keys(r);a