Permalink
Browse files

Too many changes, because this is changing so rapidly.

  • Loading branch information...
1 parent 6a15918 commit 008ee5bfd812b5367ba59c574f71bce3be2719bf @ialexi ialexi committed Apr 16, 2010
View
@@ -1,7 +0,0 @@
-=============================================================================
-Project: Hedwig
-Copyright: ©2010 My Company, Inc.
-=============================================================================
-
-TODO: Describe Your Project
-
@@ -21,7 +21,7 @@ Hedwig.articleController = SC.ObjectController.create(
},
replacementFor: function(href) {
- return "<div class='hedwig-demo' href='" + href + "' style='width:300px;height:200px;background-color:red;'></div>";
+ return "<div class='hedwig-demo' href='" + href + "' style=''></div>";
},
openDemo: function(href) {
@@ -15,13 +15,13 @@ Hedwig.demoController = SC.ObjectController.create(
/** @scope Hedwig.demoController.prototype */ {
demo: null,
- demoSource: function() {
+ content: function() {
return Hedwig.articleController.demoFor(this.get("demo"));
}.property("demo").cacheable(),
openDemo: function() {
try {
- var source = this.get("demoSource");
+ var source = this.get("ex");
//err... yes, this very badly immitates CommonJS modules. Sorry. :(
var obj = {};
@@ -41,6 +41,32 @@ Hedwig.demoController = SC.ObjectController.create(
closeDemo: function() {
this._openDemoPanel.remove();
- }
+ },
+
+ openSource: function() {
+ var sourcePanel = Hedwig.SourcePanel.create();
+ sourcePanel.append();
+ this._openSourcePanel = sourcePanel;
+ },
+
+ closeSource: function() {
+ console.error("WHY MUST YOU INSIST ON CLOSING THE SOURCE CODE! IT IS AGAINST EVERYTHING I BELIEVE IN! I'M GONNA CRY!");
+ this._openSourcePanel.remove();
+ },
+
+ preparedSource: function() {
+ var h = this.get("highlighted");
+ var linecount = h.split("\n").length;
+
+ var output = "<div class='line-numbers'>";
+ for (var idx = 0; idx<linecount; idx++){
+ output += "<span>" + (idx+1) + "</span>";
+ }
+ output += "</div>";
+ output += "<div class='code'>";
+ output += h;
+ output += "</div>";
+ return output;
+ }.property("highlighted").cacheable()
}) ;
Oops, something went wrong.
@@ -0,0 +1,3 @@
+body {
+ overflow: hidden;
+}
@@ -1,11 +1,20 @@
/*global Hedwig */
+require("responders/NORMAL");
Hedwig.DEMO = SC.Responder.create({
+ nextResponder: Hedwig.NORMAL,
didBecomeFirstResponder: function() {
Hedwig.demoController.openDemo();
},
- closeDemo: function() {
+ willLoseFirstResponder: function() {
Hedwig.demoController.closeDemo();
+ },
+
+ closeDemo: function() {
Hedwig.makeFirstResponder(Hedwig.NORMAL);
+ },
+
+ showSource: function() {
+ Hedwig.makeFirstResponder(Hedwig.SOURCE);
}
});
@@ -1,8 +1,20 @@
/*global Hedwig */
-require("DEMO.js");
+require("responders/NORMAL");
Hedwig.SOURCE = SC.Responder.create({
- nextResponder: Hedwig.DEMO,
+ nextResponder: Hedwig.NORMAL,
didBecomeFirstResponder: function() {
-
+ Hedwig.demoController.openSource();
+ },
+
+ willLoseFirstResponder: function() {
+ Hedwig.demoController.closeSource();
+ },
+
+ closeSource: function() {
+ Hedwig.makeFirstResponder(Hedwig.NORMAL);
+ },
+
+ showDemo: function() {
+ Hedwig.makeFirstResponder(Hedwig.DEMO);
}
});
@@ -15,24 +15,29 @@ Hedwig.DemoPanel = SC.PanelPane.extend(
defaultResponder: Hedwig,
layout: { top: 0, bottom: 0, width: 768, centerX: 0 },
contentView: null,
- theme: "popover"
+ theme: "pig"
});
Hedwig.DemoPanel.generateWithView = function(view) {
return Hedwig.DemoPanel.create({
contentView: SC.WorkspaceView.design({
topToolbar: SC.ToolbarView.design({
+ layout: { top: 0, height: 44, left: 0, right: 0 },
childViews: "close source".w(), // not "closed" source-- close & source
close: SC.ButtonView.design({
layout: { left: 7, centerY: 0, height: 30, width: 100 },
title: "Close",
- action: "closeDemo"
+ action: "closeDemo",
+ controlSize: SC.AUTO_CONTROL_SIZE,
+ isCancel: YES
}),
source: SC.ButtonView.design({
layout: { right: 7, centerY: 0, height: 30, width: 100 },
title: "Source",
- action: "showDemoSource"
+ action: "showSource",
+ controlSize: SC.AUTO_CONTROL_SIZE,
+ isDefault: YES
})
}),
contentView: view
@@ -0,0 +1,49 @@
+// ==========================================================================
+// Project: Hedwig.DemoPanel
+// Copyright: ©2010 My Company, Inc.
+// ==========================================================================
+/*globals Hedwig */
+
+/** @class
+
+ (Document Your View Here)
+
+ @extends SC.View
+*/
+Hedwig.SourcePanel = SC.PanelPane.extend(
+/** @scope Hedwig.DemoPanel.prototype */ {
+ defaultResponder: Hedwig,
+ layout: { top: 0, bottom: 0, width: 768, centerX: 0 },
+ contentView: null,
+ theme: "pig",
+ contentView: SC.WorkspaceView.design({
+ topToolbar: SC.ToolbarView.design({
+ layout: { top: 0, height: 44, left: 0, right: 0 },
+ childViews: "close source".w(), // not "closed" source-- close & source
+ close: SC.ButtonView.design({
+ layout: { left: 7, centerY: 0, height: 30, width: 100 },
+ title: "Close",
+ action: "closeSource",
+ controlSize: SC.AUTO_CONTROL_SIZE,
+ isCancel: YES
+ }),
+
+ source: SC.ButtonView.design({
+ layout: { right: 7, centerY: 0, height: 30, width: 100 },
+ title: "Demo",
+ action: "showDemo",
+ controlSize: SC.AUTO_CONTROL_SIZE,
+ isDefault: YES
+ })
+ }),
+ contentView: SC.ScrollView.design({
+ classNames: "source".w(),
+ borderStyle: SC.BORDER_NONE,
+ contentView: SC.StaticContentView.design({
+ classNames: "source".w(),
+ contentBinding: "Hedwig.demoController.preparedSource"
+ })
+
+ })
+ })
+});
Oops, something went wrong.
@@ -5,4 +5,176 @@ var MyExampleView = SC.View.extend({
// bootstrap code :)
exports.getDemoView = function() {
return MyExampleView;
-};
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
+var MyExampleView = SC.View.extend({
+ backgroundColor: "red"
+});
+
+// bootstrap code :)
+exports.getDemoView = function() {
+ return MyExampleView;
+};
+
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 008ee5b

Please sign in to comment.