Permalink
Browse files

This keeps getting better.

  • Loading branch information...
1 parent 493c8e6 commit 89a2099d4b2bdf8099e7fb76bf537b076e6c9279 @ialexi committed Apr 16, 2010
@@ -19,7 +19,13 @@ Hedwig.demoController = SC.ObjectController.create(
return Hedwig.articleController.demoFor(this.get("demo"));
}.property("demo").cacheable(),
+ nowShowing: "front",
openDemo: function() {
+ this.set("nowShowing", "front");
+ if (this._openDemoPanel) {
+ return; // in this case, we've done everything we need.
+ }
+
try {
var source = this.get("ex");
@@ -41,17 +47,16 @@ Hedwig.demoController = SC.ObjectController.create(
closeDemo: function() {
this._openDemoPanel.remove();
+ this._openDemoPanel = null;
},
openSource: function() {
- var sourcePanel = Hedwig.SourcePanel.create();
- sourcePanel.append();
- this._openSourcePanel = sourcePanel;
+ this.set("nowShowing", "back");
},
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();
+ this.set("nowShowing", "front");
},
preparedSource: function() {
@@ -1,7 +1,7 @@
/*global Hedwig */
-require("responders/NORMAL");
+require("responders/DEMO");
Hedwig.SOURCE = SC.Responder.create({
- nextResponder: Hedwig.NORMAL,
+ nextResponder: Hedwig.DEMO,
didBecomeFirstResponder: function() {
Hedwig.demoController.openSource();
},
@@ -11,7 +11,8 @@ Hedwig.SOURCE = SC.Responder.create({
},
closeSource: function() {
- Hedwig.makeFirstResponder(Hedwig.NORMAL);
+ Hedwig.makeFirstResponder(Hedwig.DEMO);
+ Hedwig.invokeLater("sendAction", 150, "closeDemo");
},
showDemo: function() {
@@ -12,6 +12,53 @@
*/
Hedwig.DemoPanel = SC.PanelPane.extend(SC.Animatable,
/** @scope Hedwig.DemoPanel.prototype */ {
+ modalPane: SC.ModalPane.extend(SC.Animatable, {
+ classNames: 'for-sc-panel',
+ transitions: {
+ opacity: 0.25
+ },
+ style: {opacity: 0.0 }
+ }),
+
+ transitions: {
+ transform: {
+ duration: 0.5,
+ timing: SC.Animatable.TRANSITION_EASE_IN_OUT
+ },
+ opacity: {
+ duration: 0.5,
+ timing: SC.Animatable.TRANSITION_EASE_IN_OUT,
+ action: function(){
+ if (this.style.opacity === 0) this._call_when_done();
+ }
+ }
+ },
+ style: { opacity: 0.0, transform: "scale3d(.1,.1,1)" },
+ layout: { width: 250, height: 480 },
+ theme: "popover",
+
+ append: function() {
+ sc_super();
+ this.invokeLater("sizeUp", 1);
+ },
+
+ sizeUp: function() {
+ this.adjust({
+ opacity: 1,
+ transform: "scale3d(1,1,1)"
+ });
+ this.modalPane.adjust("opacity", 0.50);
+ },
+
+ remove: function() {
+ this._call_when_done = arguments.callee.base;
+ this.adjust({
+ opacity: 0,
+ transform: "scale3d(.1,.1,1)"
+ });
+ this.modalPane.adjust("opacity", 0);
+ },
+
classNames: "demo".w(),
defaultResponder: Hedwig,
@@ -26,12 +73,6 @@ Hedwig.DemoPanel.generateWithView = function(view) {
childViews: "front back".w(),
init: function() {
sc_super();
- SC.Timer.schedule({
- interval: 1000,
- target: this,
- action: "flip",
- repeats: YES
- });
if (SC.Animatable.enableCSS3DTransforms) {
this.back.flip(180, YES);
@@ -40,6 +81,7 @@ Hedwig.DemoPanel.generateWithView = function(view) {
}
},
+ nowShowingBinding: "Hedwig.demoController.nowShowing",
nowShowing: "none",
flip: function() {
if (this.get("nowShowing") == "back") this.set("nowShowing", "front");
@@ -71,7 +113,7 @@ Hedwig.DemoPanel.generateWithView = function(view) {
classNames: "flippable".w(),
transitions: {
"transform": {
- "duration": 0.5, timing: SC.Animatable.TRANSITION_EASE_IN_OUT
+ "duration": 0.6, timing: SC.Animatable.TRANSITION_EASE_IN_OUT
}
},
style: {
@@ -1,50 +0,0 @@
-// ==========================================================================
-// Project: Hedwig.DemoPanel
-// Copyright: ©2010 My Company, Inc.
-// ==========================================================================
-/*globals Hedwig */
-
-/** @class
-
- (Document Your View Here)
-
- @extends SC.View
-*/
-Hedwig.SourcePanel = SC.PanelPane.extend(SC.Animatable,
-/** @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"
- })
-
- })
- })
-});

0 comments on commit 89a2099

Please sign in to comment.