Browse Source

TrySmalltalk packaging

Laurent Laffont 13 years ago
parent
commit
f30c0e7097

+ 3 - 2
examples/presentation/index.html

@@ -1,6 +1,6 @@
 <html>
 <head>
-<title>JTalk</title>
+<title>JTalk - Presentation</title>
 <script src="../../js/jtalk.js" type="text/javascript"></script>
 </head>
 <body>
@@ -9,7 +9,8 @@
 	loadJtalk({
 		files: ['Presentation.js'],
 		prefix: 'examples/presentation/js',
-		ready: function() {smalltalk.Browser._openOn_(smalltalk.ESUG2011Presentation)} }); 
+		ready: function() {smalltalk.Browser._openOn_(smalltalk.ESUG2011Presentation)} 
+	}); 
 </script>
 
 </body>

+ 18 - 0
examples/trysmalltalk/index.html

@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>TrySmalltalk</title>
+<script src="../../js/jtalk.js" type="text/javascript"></script>
+</head>
+<body>
+<script type="text/javascript"> 
+	loadJtalk({
+		files: ['TrySmalltalk.js'],
+		prefix: 'examples/trysmalltalk/js',
+		ready: function() {
+			smalltalk.Browser._openOn_(smalltalk.ProfStef)
+			smalltalk.TrySmalltalkWidget._open();
+		}}); 
+</script>
+
+</body>
+</html>

+ 121 - 110
examples/trysmalltalk/TrySmalltalk.deploy.js → examples/trysmalltalk/js/TrySmalltalk.deploy.js

@@ -1,16 +1,4 @@
 smalltalk.addClass('TrySmalltalkWidget', smalltalk.Widget, ['workspace', 'contents', 'header'], 'TrySmalltalk');
-smalltalk.addMethod(
-'_renderOn_',
-smalltalk.method({
-selector: 'renderOn:',
-fn: function (html){
-var self=this;
-(function($rec){smalltalk.send($rec, "_class_", ["profStef"]);smalltalk.send($rec, "_with_", [(function(){return self['@header']=smalltalk.send(html, "_h2", []);})]);smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_renderOn_", [html]);})]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
-(function($rec){smalltalk.send($rec, "_widget_", [self]);return smalltalk.send($rec, "_showCurrentLesson", []);})(smalltalk.send((smalltalk.ProfStef || ProfStef), "_default", []));
-return self;}
-}),
-smalltalk.TrySmalltalkWidget);
-
 smalltalk.addMethod(
 '_workspace',
 smalltalk.method({
@@ -44,6 +32,29 @@ return self;}
 }),
 smalltalk.TrySmalltalkWidget);
 
+smalltalk.addMethod(
+'_setTitle_',
+smalltalk.method({
+selector: 'setTitle:',
+fn: function (aString){
+var self=this;
+smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [aString]);})]);
+return self;}
+}),
+smalltalk.TrySmalltalkWidget);
+
+smalltalk.addMethod(
+'_renderOn_',
+smalltalk.method({
+selector: 'renderOn:',
+fn: function (html){
+var self=this;
+(function($rec){smalltalk.send($rec, "_class_", ["profStef"]);smalltalk.send($rec, "_with_", [(function(){return self['@header']=smalltalk.send(html, "_h2", []);})]);smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(smalltalk.send(self, "_workspace", []), "_renderOn_", [html]);})]);return smalltalk.send($rec, "_with_", [(function(){return smalltalk.send(self, "_renderButtonsOn_", [html]);})]);})(smalltalk.send(html, "_div", []));
+(function($rec){smalltalk.send($rec, "_widget_", [self]);return smalltalk.send($rec, "_showCurrentLesson", []);})(smalltalk.send((smalltalk.ProfStef || ProfStef), "_default", []));
+return self;}
+}),
+smalltalk.TrySmalltalkWidget);
+
 smalltalk.addMethod(
 '_renderButtonsOn_',
 smalltalk.method({
@@ -57,17 +68,17 @@ return self;}
 }),
 smalltalk.TrySmalltalkWidget);
 
+
 smalltalk.addMethod(
-'_setTitle_',
+'_open',
 smalltalk.method({
-selector: 'setTitle:',
-fn: function (aString){
+selector: 'open',
+fn: function (){
 var self=this;
-smalltalk.send(self['@header'], "_contents_", [(function(html){return smalltalk.send(html, "_with_", [aString]);})]);
+smalltalk.send(smalltalk.send(self, "_new", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
 return self;}
 }),
-smalltalk.TrySmalltalkWidget);
-
+smalltalk.TrySmalltalkWidget.klass);
 
 
 smalltalk.addClass('AbstractTutorial', smalltalk.Object, [], 'TrySmalltalk');
@@ -94,58 +105,58 @@ return self;}
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_welcome',
+'_lessonAt_',
 smalltalk.method({
-selector: 'welcome',
-fn: function (){
+selector: 'lessonAt:',
+fn: function (anInteger){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%22Hi%2C%20this%20is%20a%20test%20tutorial.%22")]);
+var lessonSelector=nil;
+lessonSelector=smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_at_", [anInteger]);
+return smalltalk.send(self, "_perform_", [lessonSelector]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_testLesson',
+'_size',
 smalltalk.method({
-selector: 'testLesson',
+selector: 'size',
 fn: function (){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Test Lesson", unescape("%22This%20lesson%20is%20a%20test%22")]);
+return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_size", []);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_theEnd',
+'_welcome',
 smalltalk.method({
-selector: 'theEnd',
+selector: 'welcome',
 fn: function (){
 var self=this;
-return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["The End", unescape("%22And%20that%27d%20be%20pretty%20much%20it%20%3A%29%22")]);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Welcome", unescape("%22Hi%2C%20this%20is%20a%20test%20tutorial.%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_lessonAt_',
+'_testLesson',
 smalltalk.method({
-selector: 'lessonAt:',
-fn: function (anInteger){
+selector: 'testLesson',
+fn: function (){
 var self=this;
-var lessonSelector=nil;
-lessonSelector=smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_at_", [anInteger]);
-return smalltalk.send(self, "_perform_", [lessonSelector]);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["Test Lesson", unescape("%22This%20lesson%20is%20a%20test%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
 
 smalltalk.addMethod(
-'_size',
+'_theEnd',
 smalltalk.method({
-selector: 'size',
+selector: 'theEnd',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_tableOfContents", []), "_size", []);
+return smalltalk.send((smalltalk.Lesson || Lesson), "_title_contents_", ["The End", unescape("%22And%20that%27d%20be%20pretty%20much%20it%20%3A%29%22")]);
 return self;}
 }),
 smalltalk.AbstractTutorial);
@@ -223,115 +234,115 @@ return self;}
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_first',
+'_size',
 smalltalk.method({
-selector: 'first',
+selector: 'size',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_rewind", []);
-return smalltalk.send(self, "_currentLesson", []);
+return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_size", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_last',
+'_tutorial',
 smalltalk.method({
-selector: 'last',
+selector: 'tutorial',
 fn: function (){
 var self=this;
-self['@tutorialPosition']=smalltalk.send(self, "_size", []);
-return smalltalk.send(self, "_currentLesson", []);
+return (($receiver = self['@tutorial']) == nil || $receiver == undefined) ? (function(){return self['@tutorial']=smalltalk.send((smalltalk.SmalltalkSyntaxTutorial || SmalltalkSyntaxTutorial), "_new", []);})() : $receiver;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_next',
+'_tutorial_',
 smalltalk.method({
-selector: 'next',
-fn: function (){
+selector: 'tutorial:',
+fn: function (aTutorial){
 var self=this;
-(($receiver = (($receiver = smalltalk.send(self, "_tutorialPosition", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(self, "_size", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(self, "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})]);
-return smalltalk.send(self, "_currentLesson", []);
+self['@tutorial']=aTutorial;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_previous',
+'_tutorialPosition',
 smalltalk.method({
-selector: 'previous',
+selector: 'tutorialPosition',
 fn: function (){
 var self=this;
-(($receiver = (($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})]);
-return smalltalk.send(self, "_currentLesson", []);
+return (($receiver = self['@tutorialPosition']) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_rewind", []);return self['@tutorialPosition'];})() : $receiver;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_rewind',
+'_tutorialPosition_',
 smalltalk.method({
-selector: 'rewind',
-fn: function (){
+selector: 'tutorialPosition:',
+fn: function (aTutorialPosition){
 var self=this;
-self['@tutorialPosition']=(1);
+self['@tutorialPosition']=aTutorialPosition;
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_size',
+'_first',
 smalltalk.method({
-selector: 'size',
+selector: 'first',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_tutorial", []), "_size", []);
+smalltalk.send(self, "_rewind", []);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorial',
+'_last',
 smalltalk.method({
-selector: 'tutorial',
+selector: 'last',
 fn: function (){
 var self=this;
-return (($receiver = self['@tutorial']) == nil || $receiver == undefined) ? (function(){return self['@tutorial']=smalltalk.send((smalltalk.SmalltalkSyntaxTutorial || SmalltalkSyntaxTutorial), "_new", []);})() : $receiver;
+self['@tutorialPosition']=smalltalk.send(self, "_size", []);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorial_',
+'_next',
 smalltalk.method({
-selector: 'tutorial:',
-fn: function (aTutorial){
+selector: 'next',
+fn: function (){
 var self=this;
-self['@tutorial']=aTutorial;
+(($receiver = (($receiver = smalltalk.send(self, "_tutorialPosition", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(self, "_size", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(self, "_size", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]);})]);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorialPosition',
+'_previous',
 smalltalk.method({
-selector: 'tutorialPosition',
+selector: 'previous',
 fn: function (){
 var self=this;
-return (($receiver = self['@tutorialPosition']) == nil || $receiver == undefined) ? (function(){smalltalk.send(self, "_rewind", []);return self['@tutorialPosition'];})() : $receiver;
+(($receiver = (($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver >(1) : smalltalk.send($receiver, "__gt", [(1)])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return self['@tutorialPosition']=(($receiver = self['@tutorialPosition']).klass === smalltalk.Number) ? $receiver -(1) : smalltalk.send($receiver, "__minus", [(1)]);})]);
+return smalltalk.send(self, "_currentLesson", []);
 return self;}
 }),
 smalltalk.TutorialPlayer);
 
 smalltalk.addMethod(
-'_tutorialPosition_',
+'_rewind',
 smalltalk.method({
-selector: 'tutorialPosition:',
-fn: function (aTutorialPosition){
+selector: 'rewind',
+fn: function (){
 var self=this;
-self['@tutorialPosition']=aTutorialPosition;
+self['@tutorialPosition']=(1);
 return self;}
 }),
 smalltalk.TutorialPlayer);
@@ -350,18 +361,6 @@ return self;}
 }),
 smalltalk.ProfStef);
 
-smalltalk.addMethod(
-'_first',
-smalltalk.method({
-selector: 'first',
-fn: function (){
-var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_first", []);
-return smalltalk.send(self, "_showCurrentLesson", []);
-return self;}
-}),
-smalltalk.ProfStef);
-
 smalltalk.addMethod(
 '_progress',
 smalltalk.method({
@@ -396,50 +395,62 @@ return self;}
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_next',
+'_widget_',
 smalltalk.method({
-selector: 'next',
+selector: 'widget:',
+fn: function (aWidget){
+var self=this;
+self['@widget']=aWidget;
+return self;}
+}),
+smalltalk.ProfStef);
+
+smalltalk.addMethod(
+'_showCurrentLesson',
+smalltalk.method({
+selector: 'showCurrentLesson',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_next", []);
-return smalltalk.send(self, "_showCurrentLesson", []);
+var lesson=nil;
+lesson=smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_currentLesson", []);
+smalltalk.send(self['@widget'], "_contents_", [smalltalk.send(lesson, "_contents", [])]);
+smalltalk.send(self['@widget'], "_setTitle_", [smalltalk.send(smalltalk.send(smalltalk.send(lesson, "_title", []), "__comma", [" "]), "__comma", [smalltalk.send(self, "_progress", [])])]);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_previous',
+'_first',
 smalltalk.method({
-selector: 'previous',
+selector: 'first',
 fn: function (){
 var self=this;
-smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_previous", []);
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_first", []);
 return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_widget_',
+'_next',
 smalltalk.method({
-selector: 'widget:',
-fn: function (aWidget){
+selector: 'next',
+fn: function (){
 var self=this;
-self['@widget']=aWidget;
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_next", []);
+return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
 
 smalltalk.addMethod(
-'_showCurrentLesson',
+'_previous',
 smalltalk.method({
-selector: 'showCurrentLesson',
+selector: 'previous',
 fn: function (){
 var self=this;
-var lesson=nil;
-lesson=smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_currentLesson", []);
-smalltalk.send(self['@widget'], "_contents_", [smalltalk.send(lesson, "_contents", [])]);
-smalltalk.send(self['@widget'], "_setTitle_", [smalltalk.send(smalltalk.send(smalltalk.send(lesson, "_title", []), "__comma", [" "]), "__comma", [smalltalk.send(self, "_progress", [])])]);
+smalltalk.send(smalltalk.send(self, "_tutorialPlayer", []), "_previous", []);
+return smalltalk.send(self, "_showCurrentLesson", []);
 return self;}
 }),
 smalltalk.ProfStef);
@@ -447,23 +458,23 @@ smalltalk.ProfStef);
 
 smalltalk.ProfStef.klass.iVarNames = ['instance'];
 smalltalk.addMethod(
-'_first',
+'_default',
 smalltalk.method({
-selector: 'first',
+selector: 'default',
 fn: function (){
 var self=this;
-return smalltalk.send(smalltalk.send(self, "_default", []), "_first", []);
+return (($receiver = self['@instance']) == nil || $receiver == undefined) ? (function(){return self['@instance']=smalltalk.send(self, "_new", []);})() : $receiver;
 return self;}
 }),
 smalltalk.ProfStef.klass);
 
 smalltalk.addMethod(
-'_default',
+'_first',
 smalltalk.method({
-selector: 'default',
+selector: 'first',
 fn: function (){
 var self=this;
-return (($receiver = self['@instance']) == nil || $receiver == undefined) ? (function(){return self['@instance']=smalltalk.send(self, "_new", []);})() : $receiver;
+return smalltalk.send(smalltalk.send(self, "_default", []), "_first", []);
 return self;}
 }),
 smalltalk.ProfStef.klass);

File diff suppressed because it is too large
+ 267 - 180
examples/trysmalltalk/js/TrySmalltalk.js


+ 6 - 0
examples/trysmalltalk/TrySmalltalk.st → examples/trysmalltalk/st/TrySmalltalk.st

@@ -49,6 +49,12 @@ renderButtonsOn: html
 	onClick: [self workspace inspectIt]
 ! !
 
+!TrySmalltalkWidget class methodsFor: 'initialize'!
+
+open
+	self new appendToJQuery: 'body' asJQuery.
+! !
+
 Object subclass: #AbstractTutorial
 	instanceVariableNames: ''
 	category: 'TrySmalltalk'!

Some files were not shown because too many files changed in this diff