todo.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!doctype html>
  2. <html data-trap="App: path">
  3. <head>
  4. <title data-trap="#title"></title>
  5. <style>
  6. [data-trap] {
  7. display: none
  8. }
  9. </style>
  10. <script src="../bower_components/amber/support/amber.js"></script>
  11. <script type='text/javascript' src='../bower_components/amber/support/requirejs/require.min.js'></script>
  12. <link rel="stylesheet" href="todo.css"/>
  13. <script type="text/javascript">
  14. var blackboard;
  15. require.config({
  16. shim: {
  17. 'amber_lib/xontent/jquery.xontent': {
  18. deps: [ 'jquery' ]
  19. }
  20. },
  21. paths: {
  22. 'gh_herby_trapped': '../js',
  23. 'gh_herby_trapped_todo': 'js',
  24. 'gh_herby_trapped_todo/_source': 'st'
  25. }
  26. });
  27. require(
  28. ["amber/devel",
  29. "gh_herby_trapped/Trapped-Processors", "gh_herby_trapped_todo/Trapped-Todo", "amber_lib/xontent/jquery.xontent" ],
  30. function (smalltalk) {
  31. smalltalk.defaultAmdNamespace = 'gh_herby_trapped_todo';
  32. smalltalk.initialize();
  33. $(function () {
  34. smalltalk.Browser._openOn_(smalltalk.App);
  35. blackboard = smalltalk.App._new();
  36. smalltalk.Trapped._start_([blackboard]);
  37. });
  38. }
  39. );
  40. </script>
  41. </head>
  42. <body>
  43. <h2 data-trap="#title"></h2>
  44. <div data-trap=": (guardContents (#todos #notNil))">
  45. <span data-trap="#remaining"></span> of <span data-trap="#todos #size"></span> remaning
  46. [ <a href="" data-trap=": (signal archive) whenClicked">archive</a> ]
  47. <ul>
  48. <script type="application/x-beacon" data-trap="#todos: loopContents" data-xontent="until end"></script>
  49. <li>
  50. <label>
  51. <input type="checkbox" data-trap="done: inputChecked"/>
  52. <span data-trap="done: (replace ^ with ^done-) (attr class). text" ></span>
  53. </label>
  54. </li>
  55. </ul>
  56. <form data-trap=": (signal addTodo) whenSubmitted">
  57. <input type="text" data-trap="#todoText: inputValue" size="30" placeholder="add new todo here"/>
  58. <input type="submit" class="btn-primary" value="add"/>
  59. </form>
  60. </div>
  61. <p data-trap=": (guardContents (#todos #isNil))">Loading (fake 2 sec pause)...</p>
  62. </body>
  63. </html>