|
@@ -2,374 +2,503 @@ define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,re
|
|
|
var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
|
|
|
var $pkg = $core.addPackage("MiniMVP");
|
|
|
$pkg.innerEval = function (expr) { return eval(expr); };
|
|
|
-$pkg.imports = ["amber/web/Web", "amber/web/Web-JQuery", "silk/Silk"];
|
|
|
-//>>excludeStart("imports", pragmas.excludeImports);
|
|
|
-$pkg.isReady = new Promise(function (resolve, reject) { requirejs(["amber/web/Web", "amber/web/Web-JQuery", "silk/Silk"], function () {resolve();}, reject); });
|
|
|
-//>>excludeEnd("imports");
|
|
|
$pkg.transport = {"type":"amd","amdNamespace":"mini-mvp"};
|
|
|
|
|
|
-$core.addClass("MiniMVP", $globals.Object, [], "MiniMVP");
|
|
|
+$core.addClass("MiniPresenter", $globals.Object, ["frame", "dataBlock"], "MiniMVP");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "alert:after:",
|
|
|
-protocol: "action",
|
|
|
+selector: "dataBlock",
|
|
|
+protocol: "accessing",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: ["aString", "aNumberOfMilliseconds"],
|
|
|
-source: "alert: aString after: aNumberOfMilliseconds\x0a\x09[ Terminal alert: aString ] valueWithTimeout: aNumberOfMilliseconds",
|
|
|
-referencedClasses: ["Terminal"],
|
|
|
+args: [],
|
|
|
+source: "dataBlock\x0a\x09^ dataBlock",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+return $self.dataBlock;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "dataBlock:",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "dataBlock: anObject\x0a\x09dataBlock := anObject",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+$self.dataBlock=anObject;
|
|
|
+return self;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "frame",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "frame\x0a\x09^ frame",
|
|
|
+referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["valueWithTimeout:", "alert:"]
|
|
|
-}, function ($methodClass){ return function (aString,aNumberOfMilliseconds){
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
+return $self.frame;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "frame:",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "frame: anObject\x0a\x09frame := anObject",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+$self.frame=anObject;
|
|
|
+return self;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "hide",
|
|
|
+protocol: "private",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "hide\x0a\x09(self frame asDomNode at: 'style') at: #display put: 'none'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["at:put:", "at:", "asDomNode", "frame"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv((function(){
|
|
|
+$recv($recv($recv($self._frame())._asDomNode())._at_("style"))._at_put_("display","none");
|
|
|
+return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"hide",{})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $recv($globals.Terminal)._alert_(aString);
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "present:",
|
|
|
+protocol: "actions",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "present: anObject\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-}))._valueWithTimeout_(aNumberOfMilliseconds);
|
|
|
+$self._subclassResponsibility();
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"alert:after:",{aString:aString,aNumberOfMilliseconds:aNumberOfMilliseconds})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"present:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniPresenter);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "augmentPage",
|
|
|
-protocol: "starting",
|
|
|
+selector: "refresh",
|
|
|
+protocol: "actions",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "augmentPage\x0a '#lambda-status' asSilk on: #click bind: [ self doInspectStatus ].\x0a\x09'#console-log' asSilk on: #click bind: [ self doConsoleLog ].\x0a\x09'#timeout-alert' asSilk on: #click bind: [ self alert: 'REMINDER!' after: 5000 ].\x0a\x09'#amber-with' asBrush onClick: [ self doAmberWith ].\x0a\x09'#silk-tag' asSilk on: #click bind: [ self doSilkTAG ].\x0a\x09'#jquery-append' asJQuery click: [ self doJQueryAppend ]",
|
|
|
+source: "refresh\x0a\x09self dataBlock value\x0a\x09\x09ifNil: [ self hide ]\x0a\x09\x09ifNotNil: [ :data | self show; present: data ]",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["on:bind:", "asSilk", "doInspectStatus", "doConsoleLog", "alert:after:", "onClick:", "asBrush", "doAmberWith", "doSilkTAG", "click:", "asJQuery", "doJQueryAppend"]
|
|
|
+messageSends: ["ifNil:ifNotNil:", "value", "dataBlock", "hide", "show", "present:"]
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-[$recv(["#lambda-status"._asSilk()
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["asSilk"]=1
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0])._on_bind_("click",(function(){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $self._doInspectStatus();
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}))
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["on:bind:"]=1
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0];
|
|
|
-[$recv(["#console-log"._asSilk()
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["asSilk"]=2
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0])._on_bind_("click",(function(){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $self._doConsoleLog();
|
|
|
+var $1;
|
|
|
+$1=$recv($self._dataBlock())._value();
|
|
|
+if($1 == null || $1.a$nil){
|
|
|
+$self._hide();
|
|
|
+} else {
|
|
|
+var data;
|
|
|
+data=$1;
|
|
|
+$self._show();
|
|
|
+$self._present_(data);
|
|
|
+}
|
|
|
+return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"refresh",{})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
-}))
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "show",
|
|
|
+protocol: "private",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: [],
|
|
|
+source: "show\x0a\x09(self frame asDomNode at: 'style') removeProperty: 'display'",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["removeProperty:", "at:", "asDomNode", "frame"]
|
|
|
+}, function ($methodClass){ return function (){
|
|
|
+var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["on:bind:"]=2
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-][0];
|
|
|
-[$recv(["#timeout-alert"._asSilk()
|
|
|
+$recv($recv($recv($self._frame())._asDomNode())._at_("style"))._removeProperty_("display");
|
|
|
+return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["asSilk"]=3
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"show",{})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
-][0])._on_bind_("click",(function(){
|
|
|
+}; }),
|
|
|
+$globals.MiniPresenter);
|
|
|
+
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "shows:in:",
|
|
|
+protocol: "instance creation",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["aBlock", "aDommable"],
|
|
|
+source: "shows: aBlock in: aDommable\x0a\x09^ super new\x0a\x09\x09dataBlock: aBlock;\x0a\x09\x09frame: aDommable;\x0a\x09\x09hide;\x0a\x09\x09yourself",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["dataBlock:", "new", "frame:", "hide", "yourself"]
|
|
|
+}, function ($methodClass){ return function (aBlock,aDommable){
|
|
|
+var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $self._alert_after_("REMINDER!",(5000));
|
|
|
+var $1;
|
|
|
+$1=[(
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
|
|
|
+$ctx1.supercall = true,
|
|
|
//>>excludeEnd("ctx");
|
|
|
-}))
|
|
|
+($methodClass.superclass||$boot.nilAsClass).fn.prototype._new.call($self))
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["on:bind:"]=3
|
|
|
+,$ctx1.supercall = false
|
|
|
//>>excludeEnd("ctx");
|
|
|
][0];
|
|
|
-$recv("#amber-with"._asBrush())._onClick_((function(){
|
|
|
+$recv($1)._dataBlock_(aBlock);
|
|
|
+$recv($1)._frame_(aDommable);
|
|
|
+$recv($1)._hide();
|
|
|
+return $recv($1)._yourself();
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $self._doAmberWith();
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}));
|
|
|
-$recv("#silk-tag"._asSilk())._on_bind_("click",(function(){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $self._doSilkTAG();
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}));
|
|
|
-$recv("#jquery-append"._asJQuery())._click_((function(){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $self._doJQueryAppend();
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}));
|
|
|
-return self;
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"augmentPage",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"shows:in:",{aBlock:aBlock,aDommable:aDommable})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniPresenter.a$cls);
|
|
|
|
|
|
+
|
|
|
+$core.addClass("MiniLeafPresenter", $globals.MiniPresenter, ["factory"], "MiniMVP");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "doAmberWith",
|
|
|
-protocol: "action",
|
|
|
+selector: "factory",
|
|
|
+protocol: "accessing",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "doAmberWith\x0a\x09'#output-list' asBrush with: [ :html | html li: 'Amber Web #with: added me!' ]",
|
|
|
+source: "factory\x0a\x09^ factory",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["with:", "asBrush", "li:"]
|
|
|
+messageSends: []
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
+return $self.factory;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniLeafPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "factory:",
|
|
|
+protocol: "accessing",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "factory: anObject\x0a\x09factory := anObject",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: []
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
+$self.factory=anObject;
|
|
|
+return self;
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.MiniLeafPresenter);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "frameContents:",
|
|
|
+protocol: "rendering",
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
+args: ["anObject"],
|
|
|
+source: "frameContents: anObject\x0a\x09self subclassResponsibility",
|
|
|
+referencedClasses: [],
|
|
|
+//>>excludeEnd("ide");
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
+var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv("#output-list"._asBrush())._with_((function(html){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $recv(html)._li_("Amber Web #with: added me!");
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1,1)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-}));
|
|
|
+$self._subclassResponsibility();
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"doAmberWith",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"frameContents:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniLeafPresenter);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "doConsoleLog",
|
|
|
-protocol: "action",
|
|
|
+selector: "present:",
|
|
|
+protocol: "rendering",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "doConsoleLog\x0a\x09| greeting target |\x0a\x09greeting := 'Hello'.\x0a\x09target := 'world'.\x0a\x09console log: #{ #greeting -> greeting. #target -> target. #callback -> [ console log: greeting, ', ', target, '!' ] }",
|
|
|
+args: ["anObject"],
|
|
|
+source: "present: anObject\x0a\x09(self factory value: anObject)\x0a\x09\x09ifNotNil: [ :payload | self frameContents: payload ]",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["log:", ","]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
+messageSends: ["ifNotNil:", "value:", "factory", "frameContents:"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
var self=this,$self=this;
|
|
|
-var greeting,target;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-greeting="Hello";
|
|
|
-target="world";
|
|
|
-[$recv(console)._log_($globals.HashedCollection._newFromPairs_(["greeting",greeting,"target",target,"callback",(function(){
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-return $recv(console)._log_([$recv([$recv($recv(greeting).__comma(", ")).__comma(target)
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx2.sendIdx[","]=2
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0]).__comma("!")
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx2.sendIdx[","]=1
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0]);
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-})]))
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-,$ctx1.sendIdx["log:"]=1
|
|
|
-//>>excludeEnd("ctx");
|
|
|
-][0];
|
|
|
+var $1;
|
|
|
+$1=$recv($self._factory())._value_(anObject);
|
|
|
+if($1 == null || $1.a$nil){
|
|
|
+$1;
|
|
|
+} else {
|
|
|
+var payload;
|
|
|
+payload=$1;
|
|
|
+$self._frameContents_(payload);
|
|
|
+}
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"doConsoleLog",{greeting:greeting,target:target})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"present:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniLeafPresenter);
|
|
|
+
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "doInspectStatus",
|
|
|
-protocol: "action",
|
|
|
+selector: "shows:in:do:",
|
|
|
+protocol: "instance creation",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "doInspectStatus\x0a\x09(self getApi: '/status')\x0a\x09\x09then: {#json. #inspect}\x0a\x09\x09catch: [ :err | Terminal alert: err ]",
|
|
|
-referencedClasses: ["Terminal"],
|
|
|
+args: ["aDataBlock", "aDommable", "aFactoryBlock"],
|
|
|
+source: "shows: aDataBlock in: aDommable do: aFactoryBlock\x0a\x09^ (super shows: aDataBlock in: aDommable)\x0a\x09\x09factory: aFactoryBlock;\x0a\x09\x09yourself",
|
|
|
+referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["then:catch:", "getApi:", "alert:"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
+messageSends: ["factory:", "shows:in:", "yourself"]
|
|
|
+}, function ($methodClass){ return function (aDataBlock,aDommable,aFactoryBlock){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv($self._getApi_("/status"))._then_catch_(["json","inspect"],(function(err){
|
|
|
+var $1;
|
|
|
+$1=[(
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-return $core.withContext(function($ctx2) {
|
|
|
+$ctx1.supercall = true,
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $recv($globals.Terminal)._alert_(err);
|
|
|
+($methodClass.superclass||$boot.nilAsClass).fn.prototype._shows_in_.call($self,aDataBlock,aDommable))
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
|
|
|
+,$ctx1.supercall = false
|
|
|
//>>excludeEnd("ctx");
|
|
|
-}));
|
|
|
-return self;
|
|
|
+][0];
|
|
|
+$recv($1)._factory_(aFactoryBlock);
|
|
|
+return $recv($1)._yourself();
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"doInspectStatus",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"shows:in:do:",{aDataBlock:aDataBlock,aDommable:aDommable,aFactoryBlock:aFactoryBlock})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniLeafPresenter.a$cls);
|
|
|
|
|
|
+
|
|
|
+$core.addClass("AmberWebLeafPresenter", $globals.MiniLeafPresenter, [], "MiniMVP");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "doJQueryAppend",
|
|
|
-protocol: "action",
|
|
|
+selector: "frameContents:",
|
|
|
+protocol: "rendering",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "doJQueryAppend\x0a\x09'#output-list' asJQuery append: '<li>jQuery append added me!</li>'",
|
|
|
+args: ["anObject"],
|
|
|
+source: "frameContents: anObject\x0a\x09self frame contents: anObject",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["append:", "asJQuery"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
+messageSends: ["contents:", "frame"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv("#output-list"._asJQuery())._append_("<li>jQuery append added me!</li>");
|
|
|
+$recv($self._frame())._contents_(anObject);
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"doJQueryAppend",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"frameContents:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.AmberWebLeafPresenter);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+$core.addClass("SilkLeafPresenter", $globals.MiniLeafPresenter, [], "MiniMVP");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "doSilkTAG",
|
|
|
-protocol: "action",
|
|
|
+selector: "frameContents:",
|
|
|
+protocol: "rendering",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "doSilkTAG\x0a\x09'#output-list' asSilk LI: 'Silk TAG: added me!'",
|
|
|
+args: ["anObject"],
|
|
|
+source: "frameContents: anObject\x0a\x09self frame resetContents; << anObject",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["LI:", "asSilk"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
+messageSends: ["resetContents", "frame", "<<"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv("#output-list"._asSilk())._LI_("Silk TAG: added me!");
|
|
|
+var $1;
|
|
|
+$1=$self._frame();
|
|
|
+$recv($1)._resetContents();
|
|
|
+$recv($1).__lt_lt(anObject);
|
|
|
return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"doSilkTAG",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"frameContents:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.SilkLeafPresenter);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+$core.addClass("MiniParentPresenter", $globals.MiniPresenter, [], "MiniMVP");
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "endpoint",
|
|
|
-protocol: "backend",
|
|
|
+selector: "childPresenters",
|
|
|
+protocol: "accessing",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
args: [],
|
|
|
-source: "endpoint\x0a\x09\x22Return something like 'https://<char mess>.execute-api.eu-central-1.amazonaws.com/default'\x22\x0a\x09^ self error: 'Not yet implemented'",
|
|
|
+source: "childPresenters\x0a\x09self subclassResponsibility",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["error:"]
|
|
|
+messageSends: ["subclassResponsibility"]
|
|
|
}, function ($methodClass){ return function (){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $self._error_("Not yet implemented");
|
|
|
+$self._subclassResponsibility();
|
|
|
+return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"endpoint",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"childPresenters",{})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniParentPresenter);
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "getApi:",
|
|
|
-protocol: "backend",
|
|
|
+selector: "present:",
|
|
|
+protocol: "actions",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: ["path"],
|
|
|
-source: "getApi: path\x0a\x09^ Platform fetch: self endpoint, path",
|
|
|
-referencedClasses: ["Platform"],
|
|
|
+args: ["anObject"],
|
|
|
+source: "present: anObject\x0a\x09self childPresenters do: [ :each | each refresh ]",
|
|
|
+referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["fetch:", ",", "endpoint"]
|
|
|
-}, function ($methodClass){ return function (path){
|
|
|
+messageSends: ["do:", "childPresenters", "refresh"]
|
|
|
+}, function ($methodClass){ return function (anObject){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-return $recv($globals.Platform)._fetch_($recv($self._endpoint()).__comma(path));
|
|
|
+$recv($self._childPresenters())._do_((function(each){
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+return $recv(each)._refresh();
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+}));
|
|
|
+return self;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"getApi:",{path:path})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"present:",{anObject:anObject})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP);
|
|
|
+$globals.MiniParentPresenter);
|
|
|
|
|
|
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
-selector: "start",
|
|
|
-protocol: "starting",
|
|
|
+selector: "in:",
|
|
|
+protocol: "instance creation",
|
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
-args: [],
|
|
|
-source: "start\x0a\x09self new augmentPage",
|
|
|
+args: ["aDommable"],
|
|
|
+source: "in: aDommable\x0a\x09^ super shows: [ true ] in: aDommable",
|
|
|
referencedClasses: [],
|
|
|
//>>excludeEnd("ide");
|
|
|
pragmas: [],
|
|
|
-messageSends: ["augmentPage", "new"]
|
|
|
-}, function ($methodClass){ return function (){
|
|
|
+messageSends: ["shows:in:"]
|
|
|
+}, function ($methodClass){ return function (aDommable){
|
|
|
var self=this,$self=this;
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
return $core.withContext(function($ctx1) {
|
|
|
//>>excludeEnd("ctx");
|
|
|
-$recv($self._new())._augmentPage();
|
|
|
-return self;
|
|
|
+return [(
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+$ctx1.supercall = true,
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+($methodClass.superclass||$boot.nilAsClass).fn.prototype._shows_in_.call($self,(function(){
|
|
|
+return true;
|
|
|
+
|
|
|
+}),aDommable))
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
+,$ctx1.supercall = false
|
|
|
+//>>excludeEnd("ctx");
|
|
|
+][0];
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"start",{})});
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"in:",{aDommable:aDommable})});
|
|
|
//>>excludeEnd("ctx");
|
|
|
}; }),
|
|
|
-$globals.MiniMVP.a$cls);
|
|
|
+$globals.MiniParentPresenter.a$cls);
|
|
|
|
|
|
});
|