Permalink
Browse files

Quite messy and hacky in some areas at the moment; not so bad in othe…

…rs. Yay.
  • Loading branch information...
0 parents commit 6a15918fb23dc317fe09fdcd365cdf49873ee514 @ialexi ialexi committed Apr 16, 2010
Showing with 2,506 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +8 −0 Buildfile
  4. +7 −0 README
  5. +30 −0 apps/hedwig/controllers/article.js
  6. +46 −0 apps/hedwig/controllers/demo.js
  7. +42 −0 apps/hedwig/controllers/guide.js
  8. +67 −0 apps/hedwig/controllers/guide_browser.js
  9. +30 −0 apps/hedwig/controllers/guides.js
  10. +27 −0 apps/hedwig/core.js
  11. +19 −0 apps/hedwig/main.js
  12. +26 −0 apps/hedwig/resources/guide/touch.guide
  13. +1 −0 apps/hedwig/resources/guide/touch.json
  14. +9 −0 apps/hedwig/resources/loading.rhtml
  15. +118 −0 apps/hedwig/resources/main_page.js
  16. 0 apps/hedwig/resources/style.css
  17. +11 −0 apps/hedwig/responders/DEMO.js
  18. +18 −0 apps/hedwig/responders/NORMAL.js
  19. +8 −0 apps/hedwig/responders/SOURCE.js
  20. +8 −0 apps/hedwig/responders/START.js
  21. +15 −0 apps/hedwig/tests/controllers/article.js
  22. +15 −0 apps/hedwig/tests/controllers/demo.js
  23. +15 −0 apps/hedwig/tests/controllers/guide.js
  24. +15 −0 apps/hedwig/tests/controllers/guide_browser.js
  25. +15 −0 apps/hedwig/tests/controllers/guides.js
  26. +15 −0 apps/hedwig/tests/views/demo_panel.js
  27. +41 −0 apps/hedwig/views/demo_panel.js
  28. +102 −0 docs/.json
  29. +98 −0 docs/build/articles/touch/a-brief-touch.html
  30. +1 −0 docs/build/articles/touch/a-brief-touch.json
  31. +15 −0 docs/build/articles/touch/a-brief-touch.md
  32. +8 −0 docs/build/articles/touch/touch-demo.js
  33. +92 −0 docs/build/articles/touch/touch-events.html
  34. +1 −0 docs/build/articles/touch/touch-events.json
  35. 0 docs/build/articles/touch/touch-events.md
  36. +26 −0 docs/build/guides/touch.guide
  37. +1 −0 docs/build/guides/touch.json
  38. +98 −0 docs/build/template.haml
  39. +1 −0 docs/hoo
  40. +15 −0 docs/src/articles/touch/a-brief-touch.md
  41. +8 −0 docs/src/articles/touch/touch-demo.js
  42. 0 docs/src/articles/touch/touch-events.md
  43. +26 −0 docs/src/guides/touch.guide
  44. +98 −0 docs/src/template.haml
  45. +98 −0 docs/template.haml
  46. +1 −0 frameworks/sproutcore
  47. +1 −0 themes/pig/Buildfile
  48. +2 −0 themes/pig/build
  49. +2 −0 themes/pig/build-d
  50. +113 −0 themes/pig/chance/README.md
  51. +173 −0 themes/pig/chance/chance.rb
  52. +202 −0 themes/pig/chance/lib/css.rb
  53. +388 −0 themes/pig/chance/lib/slicedice.rb
  54. 0 themes/pig/chance/sc-theme.rb
  55. +126 −0 themes/pig/chance/scripts/setup.rb
  56. +4 −0 themes/pig/pig.js
  57. BIN themes/pig/resources/images/1.png
  58. BIN themes/pig/resources/images/2.png
  59. +59 −0 themes/pig/resources/theme.css
  60. +3 −0 themes/pig/src/master-detail/master-detail.css
  61. +7 −0 themes/pig/src/master-detail/master-detail.js
  62. +15 −0 themes/pig/src/paper/paper.css
  63. +3 −0 themes/pig/src/paper/paper.js
  64. +38 −0 themes/pig/src/paper/toolbar/buttons.css
  65. +15 −0 themes/pig/src/paper/toolbar/chromeless.js
  66. +27 −0 themes/pig/src/paper/toolbar/icon.js
  67. BIN themes/pig/src/paper/toolbar/next.png
  68. BIN themes/pig/src/paper/toolbar/next.psd
  69. BIN themes/pig/src/paper/toolbar/previous.png
  70. BIN themes/pig/src/paper/toolbar/previous.psd
  71. +4 −0 themes/pig/src/paper/toolbar/toolbar.css
  72. +3 −0 themes/pig/src/static-content.css
  73. BIN themes/pig/src/tree/bg.png
  74. +21 −0 themes/pig/src/tree/tree.css
@@ -0,0 +1,2 @@
+tmp/
+.DS_Store
@@ -0,0 +1,3 @@
+[submodule "frameworks/sproutcore"]
+ path = frameworks/sproutcore
+ url = git://github.com/sproutit/sproutcore.git
@@ -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
7 README
@@ -0,0 +1,7 @@
+=============================================================================
+Project: Hedwig
+Copyright: ©2010 My Company, Inc.
+=============================================================================
+
+TODO: Describe Your Project
+
@@ -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);
+ }
+}) ;
@@ -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();
+ }
+
+}) ;
@@ -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()
+}) ;
@@ -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()
+}) ;
@@ -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"));
+ }
+ }
+}) ;
@@ -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.
+
+}) ;
@@ -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(); }
@@ -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"
+ ]
+ }
+ ]
+}
@@ -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"}
@@ -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.

0 comments on commit 6a15918

Please sign in to comment.