documentation.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Jtalk Smalltalk - documentation</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <meta name="author" content="Nicolas Petton" />
  7. <link rel="stylesheet" type="text/css" href='css/style.css' />
  8. <link rel="stylesheet" type="text/css" href='css/syntax.css' />
  9. <script type='text/javascript' src='js/jquery-1.4.4.min.js'></script>
  10. <script type='text/javascript' src='js/jquery-ui-1.8.9.custom.min.js'></script>
  11. <script type='text/javascript' src='js/jquery.textarea.js'></script>
  12. <script type='text/javascript' src='js/jtalk.js'></script>
  13. <link rel="stylesheet" type="text/css" href="css/jtalk.css"/>
  14. <script type="text/javascript">
  15. var _gaq = _gaq || [];
  16. _gaq.push(['_setAccount', 'UA-2246313-6']);
  17. _gaq.push(['_trackPageview']);
  18. (function() {
  19. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  20. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  21. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  22. })();
  23. </script>
  24. </head>
  25. <body>
  26. <script type="text/javascript">
  27. jQuery(window).scroll(function() {
  28. if(jQuery(window).scrollTop() > 210) {
  29. jQuery('#menu')
  30. .css('position', 'fixed')
  31. .css('top', '0px')
  32. } else {
  33. jQuery('#menu')
  34. .css('position', 'absolute')
  35. .css('top', '210px')
  36. }
  37. });
  38. </script>
  39. <a href="http://github.com/NicolasPetton/jtalk"><img style="position: absolute; top: 0; lef
  40. t: 0; border: 0;" src="https://assets.github.com/img/bec6c51521dcc8148146135149fe06a9cc737577?repo=&url=http%3A%2F%2Fs3.amazonaws.com%2Fgithub%2Fribbons%2Fforkme_left_darkblue_121621.png&path=" alt="Fork me on GitHub"></a>
  41. <div id="wrapper">
  42. <div id="header">
  43. <div class="main">
  44. <img alt="Jtalk, the Smalltalk for web developers" src="images/text_header.png"/>
  45. </div>
  46. </div>
  47. <div id="menu">
  48. <ul>
  49. <li><a href="index.html">Overview</a></li> ·
  50. <li><a href="index.html#download">Download</a></li> ·
  51. <li><a href="documentation.html">Documentation</a></li> ·
  52. <li><a target="_blank" href="https://github.com/NicolasPetton/jtalk">Source</a></li>
  53. </ul>
  54. </div>
  55. <div id="content">
  56. <div class="main">
  57. <div class="box last doc" id="documentation">
  58. <h2>Documentation</h2>
  59. <div class="content">
  60. <h3 id="intro">1. Introduction <a href="#intro">&para;</a></h3>
  61. <p class="warning">This documentation is a work in progress.</p>
  62. <p class="information">Jtalk is a young piece of code and evolves quickly. Some features are still incomplete and you may very well encounter bugs, in which case you can <a href="https://github.com/NicolasPetton/jtalk/issues">file an issue</a> or a pull request on the <a href="https://github.com/NicolasPetton/jtalk">repository</a>.</p>
  63. <p>Jtalk is an implementation of the Smalltalk-80 language. It allows developers to write client-side heavy web applications in Smalltalk. Jtalk includes an integrated development environment with a class browser, workspace and transcript.</p>
  64. <p>Jtalk includes the following features:</p>
  65. <ol>
  66. <li>It is semantically and syntaxically equivalent to <a href="http://www.pharo-project.org">Pharo Smalltalk</a> (the implementation considered as the reference)</li>
  67. <li>It is written in itself and compiles into efficient JavaScript</li>
  68. <li>A canvas API similar to <a href="http://www.seaside.st">Seaside</a> to generate HTML</li>
  69. <li>A <a href="http://www.jquery.com">jQuery</a> binding</li>
  70. </ol>
  71. <h3 id="differences-other-smalltalks">2. Differences with other Smalltalk implementations <a href="#differences-other-smalltalks">&para;</a></h3>
  72. <h3 id="committing">3. Committing changes to disk with the web-based IDE <a href="#committing">&para;</a></h3>
  73. <p>The class browser is able to commit changes to disk. The <code>commit category</code> button will send a PUT request with the compiled JavaScript code of all classes in the selected class category in a file named <code>js/CATEGORY.js</code>.</p>
  74. <p>The easiest way to enable committing is probably to setup a webdav with Apache.</p>
  75. <p class="information">The following steps explain how to setup a webdav for Jtalk with Debian, but the setup on OSX and other Linux distros should be similar.</p>
  76. <h4>Installing Apache and enabling the dav module</h4>
  77. <p>Evaluate the following as root:</p>
  78. <pre>~# apt-get install apache2
  79. ~# a2enmod dav
  80. ~# a2enmod dav_fs</pre>
  81. <h4>Creating a password for the webdav</h4>
  82. <pre>htpasswd -c /etc/apache2/htpasswd-webdav USERNAME</pre>
  83. <h4>Setting up the webdav directory</h4>
  84. <p>Add the following lines to the default vhost (in /etc/apache2/sites-available/default):</p>
  85. <pre>Alias /jtalk/ "/path/to/jtalk/"
  86. &lt;Directory "/path/to/jtalk/"&gt;
  87. Options Indexes MultiViews FollowSymLinks
  88. DirectoryIndex index.html
  89. AllowOverride None
  90. Order allow,deny
  91. allow from all
  92. Dav on
  93. AuthType Basic
  94. AuthName "jtalk"
  95. AuthUserFile /etc/apache2/htpasswd-webdav
  96. &lt;LimitExcept GET OPTIONS&gt;
  97. Require valid-user
  98. &lt;/LimitExcept&gt;
  99. &lt;/Directory&gt;</pre>
  100. <p>Make sure the group <code>www-data</code> has required rights to make changes to files in the webdav directory.</p>
  101. <h4>Restarting Apache</h4>
  102. <p>To restart Apache, evaluate the following: <pre>~# /etc/init.d/apache2 restart</pre> and go to <code>http://localhost/jtalk/</code>.</p>
  103. <p>The class browser should now be able to commit changes to disk.</p>
  104. <h3 id="counter-example">4. The counter example <a href="#counter-example">&para;</a></h3>
  105. <p>The following example is the traditional Seaside-like multi-counter application. The buttons at the bottom of each counter increase or decrease the counter.</p>
  106. <div id="counters"></div>
  107. <script type="text/javascript">
  108. jQuery(document).ready(function() {'#counters'._asJQuery()._append_(smalltalk.Counter._new())._append_(smalltalk.Counter._new())});
  109. </script>
  110. <p>Open a <button onclick="smalltalk.Browser._openOn_(smalltalk.Counter);">browser</button> on the <code>Counter</code> class in the <code>Canvas</code> class category.
  111. <p>Each Jtalk widget is a subclass of <code>Widget</code>. A widget is a graphical component. The <code>#renderOn:</code> method is used to generate HTML using the HTML canvas.</p>
  112. <h3 id="html-canvas">5. The HTML canvas <a href="#html-canvas">&para;</a></h3>
  113. <h3 id="widgets">6. Widgets <a href="#widgets">&para;</a></h3>
  114. <h3 id="jquery">7. jQuery <a href="#jquery">&para;</a></h3>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <div id="footer">
  120. <div class="main">
  121. <p>Copyright © 2011 <a href="https://github.com/NicolasPetton">Nicolas Petton</a>.</p>
  122. <p>Jtalk is an opensource project sponsored by <a href="http://www.objectfusion.fr">objectfusion</a>.</p>
  123. <p>The design of this website was kindly provided by <a href="mailto:neomie.thirion@gmail.com">Noémie Thirion</a>.</p>
  124. </div>
  125. </div>
  126. </body>
  127. </html>