Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quite messy and hacky in some areas at the moment; not so bad in othe…
…rs. Yay.
- Loading branch information
0 parents
commit 6a15918
Showing
74 changed files
with
2,506 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
tmp/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "frameworks/sproutcore"] | ||
path = frameworks/sproutcore | ||
url = git://github.com/sproutit/sproutcore.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# =========================================================================== | ||
# Project: Hedwig | ||
# Copyright: ©2010 My Company, Inc. | ||
# =========================================================================== | ||
|
||
# Add initial buildfile information here | ||
config :all, :required => :sproutcore, :theme=>:pig, :url_prefix => "/static/suite/", | ||
:html5_manifest=> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
============================================================================= | ||
Project: Hedwig | ||
Copyright: ©2010 My Company, Inc. | ||
============================================================================= | ||
|
||
TODO: Describe Your Project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// ========================================================================== | ||
// Project: Hedwig.articleController | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
|
||
/** @class | ||
(Document Your Controller Here) | ||
@extends SC.Object | ||
*/ | ||
Hedwig.articleController = SC.ObjectController.create( | ||
/** @scope Hedwig.articleController.prototype */ { | ||
contentBinding: "Hedwig.guideBrowserController.selection", | ||
contentBindingDefault: SC.Binding.single(), | ||
|
||
demoFor: function(href) { | ||
if (this.get("demos")) return this.get("demos")[href]; | ||
return ""; | ||
}, | ||
|
||
replacementFor: function(href) { | ||
return "<div class='hedwig-demo' href='" + href + "' style='width:300px;height:200px;background-color:red;'></div>"; | ||
}, | ||
|
||
openDemo: function(href) { | ||
console.error("DEMO: " + href); | ||
} | ||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// ========================================================================== | ||
// Project: Hedwig.demoController | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
/*jslint evil:true */ | ||
|
||
/** @class | ||
(Document Your Controller Here) | ||
@extends SC.Object | ||
*/ | ||
Hedwig.demoController = SC.ObjectController.create( | ||
/** @scope Hedwig.demoController.prototype */ { | ||
|
||
demo: null, | ||
demoSource: function() { | ||
return Hedwig.articleController.demoFor(this.get("demo")); | ||
}.property("demo").cacheable(), | ||
|
||
openDemo: function() { | ||
try { | ||
var source = this.get("demoSource"); | ||
|
||
//err... yes, this very badly immitates CommonJS modules. Sorry. :( | ||
var obj = {}; | ||
var res = function (exports) { | ||
// load module | ||
eval(source); | ||
}(obj); | ||
|
||
var demoPanel = Hedwig.DemoPanel.generateWithView(obj.getDemoView()); | ||
demoPanel.append(); | ||
this._openDemoPanel = demoPanel; | ||
|
||
} catch (e) { | ||
|
||
} | ||
}, | ||
|
||
closeDemo: function() { | ||
this._openDemoPanel.remove(); | ||
} | ||
|
||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// ========================================================================== | ||
// Project: Hedwig.guideController | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
|
||
/** @class | ||
(Document Your Controller Here) | ||
@extends SC.Object | ||
*/ | ||
Hedwig.guideController = SC.ObjectController.create( | ||
/** @scope Hedwig.guideController.prototype */ { | ||
contentBinding: "Hedwig.guidesController.currentGuide", | ||
|
||
/** | ||
This builds a normalized tree structure usable by a TreeController. | ||
We do this because the guide format is in "pretty" JSON-- that is, its format makes sense to read. | ||
Property names such as "children" are not as friendly as "sections". | ||
*/ | ||
guideTree: function() { | ||
var content = this.get("content"); | ||
if (!content) return SC.Object.create(); | ||
|
||
var ret = SC.Object.create(content); | ||
ret.set("treeItemIsExpanded", YES); | ||
|
||
ret.set("treeItemChildren", content.sections.map(function(section){ | ||
var ret = SC.Object.create(section); | ||
ret.set("treeItemIsExpanded", YES); | ||
ret.set("treeItemChildren", section.articles.map(function(article){ | ||
var ret = SC.Object.create(article); | ||
ret.set("contents", ret.get("content")); // whoops. Preprocessor FAIL. It should have named it "contents," huh? | ||
return ret; | ||
})); | ||
return ret; | ||
})); | ||
|
||
return ret; | ||
}.property("content").cacheable() | ||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// ========================================================================== | ||
// Project: Hedwig.guideBrowserController | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
|
||
/** @class | ||
(Document Your Controller Here) | ||
@extends SC.Object | ||
*/ | ||
Hedwig.guideBrowserController = SC.TreeController.create( | ||
/** @scope Hedwig.guideBrowserController.prototype */ { | ||
contentBinding: "Hedwig.guideController.guideTree", | ||
|
||
|
||
treeItemChildrenKey: "treeItemChildren", | ||
treeItemIsGrouped: YES, | ||
treeItemIsExpandedKey: "treeItemIsExpanded", | ||
|
||
allowsMultipleSelection: NO, | ||
allowsEmptySelection: NO, | ||
|
||
_getSelectionIndexSet: function(){ | ||
var ao = this.get("arrangedObjects"); | ||
return this.get("selection").indexSetForSource(ao); | ||
}, | ||
|
||
hasPreviousArticle: function() { | ||
return !!this.get("previousArticle"); | ||
}.property("previousArticle").cacheable(), | ||
|
||
hasNextArticle: function() { | ||
return !!this.get("nextArticle"); | ||
}.property("nextArticle").cacheable(), | ||
|
||
previousArticle: function() { | ||
var ao = this.get("arrangedObjects"), set = this.get("selection").indexSetForSource(ao); | ||
if (!set) return NO; | ||
|
||
var first = set.get("min"); | ||
var indexes = ao.contentGroupIndexes(null, ao); | ||
|
||
// now start trying indexes | ||
var idx = first - 1; | ||
for (; idx >= 0; idx--) { | ||
if (!indexes.contains(idx)) return ao.objectAt(idx); | ||
} | ||
return null; | ||
}.property("selection", "arrangedObjects").cacheable(), | ||
|
||
nextArticle: function(){ | ||
var ao = this.get("arrangedObjects"), set = this.get("selection").indexSetForSource(ao); | ||
if (!set) return; | ||
|
||
var last = set.get("max"); | ||
var indexes = ao.contentGroupIndexes(null, ao); | ||
|
||
// now start trying indexes | ||
var idx = last, len = ao.get("length"); | ||
for (; idx < len; idx++) { | ||
if (!indexes.contains(idx)) return ao.objectAt(idx); | ||
} | ||
return null; | ||
}.property("arrangedObjects", "selection").cacheable() | ||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// ========================================================================== | ||
// Project: Hedwig.guidesController | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
|
||
/** @class | ||
(Document Your Controller Here) | ||
@extends SC.Object | ||
*/ | ||
// for now, we are hard-coding the guide in... | ||
Hedwig.guidesController = SC.ObjectController.create( | ||
/** @scope Hedwig.guidesController.prototype */ { | ||
|
||
currentGuide: null, | ||
loadGuide: function(path) { | ||
console.error(path); | ||
SC.Request.getUrl(path).json().notify(this, "didLoadGuide").send(); | ||
}, | ||
|
||
didLoadGuide: function(response) { | ||
// obviously I have no error handling right now. Did I mention I'm in a bit of a hurry? | ||
// /me crosses fingers | ||
if (SC.ok(response)) { | ||
this.set("currentGuide", response.get("body")); | ||
} | ||
} | ||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// ========================================================================== | ||
// Project: Hedwig | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
SC.LOG_TOUCH_EVENTS = YES; | ||
/** @namespace | ||
My cool new app. Describe your application. | ||
@extends SC.Object | ||
*/ | ||
Hedwig = SC.Application.create( | ||
/** @scope Hedwig.prototype */ { | ||
|
||
NAMESPACE: 'Hedwig', | ||
VERSION: '0.1.0', | ||
|
||
// This is your application store. You will use this store to access all | ||
// of your model data. You can also set a data source on this store to | ||
// connect to a backend server. The default setup below connects the store | ||
// to any fixtures you define. | ||
store: SC.Store.create().from(SC.Record.fixtures) | ||
|
||
// TODO: Add global constants or singleton objects needed by your app here. | ||
|
||
}) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// ========================================================================== | ||
// Project: Hedwig | ||
// Copyright: ©2010 My Company, Inc. | ||
// ========================================================================== | ||
/*globals Hedwig */ | ||
|
||
// This is the function that will start your app running. The default | ||
// implementation will load any fixtures you have created then instantiate | ||
// your controllers and awake the elements on your page. | ||
// | ||
// As you develop your application you will probably want to override this. | ||
// See comments for some pointers on what to do next. | ||
// | ||
Hedwig.main = function main() { | ||
Hedwig.makeFirstResponder(Hedwig.START); | ||
|
||
} ; | ||
|
||
function main() { Hedwig.main(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"title": "Writing Touch Applications", | ||
"sections": [ | ||
{ | ||
"title": "Introduction", | ||
"articles": [ | ||
"articles/touch/a-brief-touch", | ||
"articles/touch/touch-events" | ||
] | ||
}, | ||
{ | ||
"title": "Built-In Support", | ||
"articles": [ | ||
"articles/controls/button/touch", | ||
"articles/controls/scroll/touch" | ||
] | ||
}, | ||
{ | ||
"title": "Advanced Concepts", | ||
"articles": [ | ||
"articles/touch/capturing", | ||
"articles/touch/releasing" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"title":"Writing Touch Applications","sections":[{"title":"Introduction","articles":[{"content":"<h1>A Brief Touch on Touches</h1>\n\n<p>Some text goes here.</p>\n\n<p>Note that links like the below must appear on empty lines with no preceding whitespace.</p>\n\n<p><a href='touch-demo.js' class='demo'>touch-demo.js</a></p>","errors":[],"demos":{"touch-demo.js":"var MyExampleView = SC.View.extend({\n backgroundColor: \"green\"\n});\n\n// bootstrap code :)\nexports.getDemoView = function() {\n return MyExampleView;\n};"},"articleDirectory":"articles/touch/","outputDirectory":"build/","title":"A Brief Touch on Touches","any":"metadata","goes":"Here","damn":"gruber","this":"is still eye-readable","and":"He is wrong about touch apps."},{"content":"","errors":[],"demos":{},"articleDirectory":"articles/touch/","outputDirectory":"build/"}]},{"title":"Built-In Support","articles":[{"error":{"message":"No such file or directory","stack":"Error: No such file or directory\n at Object.readFileSync (fs:74:20)\n at Object.readFile (/Users/alex/.seeds/packages/core-support/0.2.1/lib/fs.js:348:37)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:9:27\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:22:48\n at Object.process (/Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:30:38)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/bin/hoo-worker:55:17\n at Stream.<anonymous> (/Volumes/Docs/Work/web/hedwig/docs/hoo/packages/spawn/lib/spawn.js:63:25)\n at IOWatcher.callback (net:310:14)\n at node.js:818:9","errno":2},"file":"build/articles/controls/button/touch.json"},{"error":{"message":"No such file or directory","stack":"Error: No such file or directory\n at Object.readFileSync (fs:74:20)\n at Object.readFile (/Users/alex/.seeds/packages/core-support/0.2.1/lib/fs.js:348:37)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:9:27\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:22:48\n at Object.process (/Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:30:38)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/bin/hoo-worker:55:17\n at Stream.<anonymous> (/Volumes/Docs/Work/web/hedwig/docs/hoo/packages/spawn/lib/spawn.js:63:25)\n at IOWatcher.callback (net:310:14)\n at node.js:818:9","errno":2},"file":"build/articles/controls/scroll/touch.json"}]},{"title":"Advanced Concepts","articles":[{"error":{"message":"No such file or directory","stack":"Error: No such file or directory\n at Object.readFileSync (fs:74:20)\n at Object.readFile (/Users/alex/.seeds/packages/core-support/0.2.1/lib/fs.js:348:37)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:9:27\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:22:48\n at Object.process (/Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:30:38)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/bin/hoo-worker:55:17\n at Stream.<anonymous> (/Volumes/Docs/Work/web/hedwig/docs/hoo/packages/spawn/lib/spawn.js:63:25)\n at IOWatcher.callback (net:310:14)\n at node.js:818:9","errno":2},"file":"build/articles/touch/capturing.json"},{"error":{"message":"No such file or directory","stack":"Error: No such file or directory\n at Object.readFileSync (fs:74:20)\n at Object.readFile (/Users/alex/.seeds/packages/core-support/0.2.1/lib/fs.js:348:37)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:9:27\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:22:48\n at Object.process (/Volumes/Docs/Work/web/hedwig/docs/hoo/lib/guide.js:30:38)\n at /Volumes/Docs/Work/web/hedwig/docs/hoo/bin/hoo-worker:55:17\n at Stream.<anonymous> (/Volumes/Docs/Work/web/hedwig/docs/hoo/packages/spawn/lib/spawn.js:63:25)\n at IOWatcher.callback (net:310:14)\n at node.js:818:9","errno":2},"file":"build/articles/touch/releasing.json"}]}],"file":"build/guides/touch"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<% content_for :loading do %> | ||
<% # Any HTML in this file will be visible on screen while your page loads | ||
# its application JavaScript. SproutCore applications are optimized for | ||
# caching and startup very fast, so your users will often only see this | ||
# content for a brief moment on their first app load, if at all. | ||
%> | ||
<p class="loading">Loading...<p> | ||
|
||
<% end %> |
Oops, something went wrong.