Bläddra i källkod

AppView off code, inlined in html

Herbert Vojčík 11 år sedan
förälder
incheckning
4669bb4334
3 ändrade filer med 4 tillägg och 56 borttagningar
  1. 0 23
      js/Trapped-Demo.js
  2. 4 1
      meta/demo.html
  3. 0 32
      st/Trapped-Demo.st

+ 0 - 23
js/Trapped-Demo.js

@@ -231,29 +231,6 @@ smalltalk.AppModel);
 
 
 
-smalltalk.addClass('AppView', smalltalk.Widget, [], 'Trapped-Demo');
-smalltalk.AppView.comment="<!-- Code from AngularJS Todo example, http://angularjs.org/#todo-html -->\x0a  <body>\x0a    <h2>Todo</h2>\x0a    <div ng-controller=\x22TodoCtrl\x22>\x0a      <span>{{remaining()}} of {{todos.length}} remaining</span>\x0a      [ <a href=\x22\x22 ng-click=\x22archive()\x22>archive</a> ]\x0a      <ul class=\x22unstyled\x22>\x0a        <li ng-repeat=\x22todo in todos\x22>\x0a          <input type=\x22checkbox\x22 ng-model=\x22todo.done\x22>\x0a          <span class=\x22done-{{todo.done}}\x22>{{todo.text}}</span>\x0a        </li>\x0a      </ul>\x0a      <form ng-submit=\x22addTodo()\x22>\x0a        <input type=\x22text\x22 ng-model=\x22todoText\x22  size=\x2230\x22\x0a               placeholder=\x22add new todo here\x22>\x0a        <input class=\x22btn-primary\x22 type=\x22submit\x22 value=\x22add\x22>\x0a      </form>\x0a    </div>\x0a  </body>";
-smalltalk.addMethod(
-smalltalk.method({
-selector: "renderOn:",
-category: 'rendering',
-fn: function (html){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-_st(_st(html)._h2())._trap_([["title"]]);
-_st(_st(html)._div())._trap_processors_([],[["guard", [["todos"], ["notNil"]]], ["widget", "TemporaryWidget"]]);
-$ctx1.sendIdx["trap:processors:"]=1;
-_st(_st(html)._p())._trap_processors_([],[["guard", [["todos"], ["isNil"]]], ["widget", "TemporaryWidget2"]]);
-return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.AppView)})},
-args: ["html"],
-source: "renderOn: html\x0a\x09html h2 trap: #((title)).\x0a    html div trap: #() processors: #((guard ((todos) (notNil))) (widget TemporaryWidget)).\x0a\x09html p trap: #() processors: #((guard ((todos) (isNil))) (widget TemporaryWidget2))",
-messageSends: ["trap:", "h2", "trap:processors:", "div", "p"],
-referencedClasses: []
-}),
-smalltalk.AppView);
-
-
-
 smalltalk.addClass('TemporaryWidget', smalltalk.Widget, [], 'Trapped-Demo');
 smalltalk.TemporaryWidget.comment="<!-- Code from AngularJS Todo example, http://angularjs.org/#todo-html -->\x0a  <body>\x0a    <h2>Todo</h2>\x0a    <div ng-controller=\x22TodoCtrl\x22>\x0a      <span>{{remaining()}} of {{todos.length}} remaining</span>\x0a      [ <a href=\x22\x22 ng-click=\x22archive()\x22>archive</a> ]\x0a      <ul class=\x22unstyled\x22>\x0a        <li ng-repeat=\x22todo in todos\x22>\x0a          <input type=\x22checkbox\x22 ng-model=\x22todo.done\x22>\x0a          <span class=\x22done-{{todo.done}}\x22>{{todo.text}}</span>\x0a        </li>\x0a      </ul>\x0a      <form ng-submit=\x22addTodo()\x22>\x0a        <input type=\x22text\x22 ng-model=\x22todoText\x22  size=\x2230\x22\x0a               placeholder=\x22add new todo here\x22>\x0a        <input class=\x22btn-primary\x22 type=\x22submit\x22 value=\x22add\x22>\x0a      </form>\x0a    </div>\x0a  </body>";
 smalltalk.addMethod(

+ 4 - 1
meta/demo.html

@@ -29,7 +29,10 @@
             }
     );
 </script>
-<div data-trap="App: (widget AppView)">
+<div>
+    <h2 data-trap="App (title)"></h2>
+    <div data-trap="App: (guard ((todos) (notNil))) (widget TemporaryWidget)"></div>
+    <p data-trap="App: (guard ((todos) (isNil))) (widget TemporaryWidget2)"></p>
 </div>
 </body>
 </html>

+ 0 - 32
st/Trapped-Demo.st

@@ -121,38 +121,6 @@ archive
     self todos: self todosNotDone
 ! !
 
-Widget subclass: #AppView
-	instanceVariableNames: ''
-	package: 'Trapped-Demo'!
-!AppView commentStamp!
-<!!-- Code from AngularJS Todo example, http://angularjs.org/#todo-html -->
-  <body>
-    <h2>Todo</h2>
-    <div ng-controller="TodoCtrl">
-      <span>{{remaining()}} of {{todos.length}} remaining</span>
-      [ <a href="" ng-click="archive()">archive</a> ]
-      <ul class="unstyled">
-        <li ng-repeat="todo in todos">
-          <input type="checkbox" ng-model="todo.done">
-          <span class="done-{{todo.done}}">{{todo.text}}</span>
-        </li>
-      </ul>
-      <form ng-submit="addTodo()">
-        <input type="text" ng-model="todoText"  size="30"
-               placeholder="add new todo here">
-        <input class="btn-primary" type="submit" value="add">
-      </form>
-    </div>
-  </body>!
-
-!AppView methodsFor: 'rendering'!
-
-renderOn: html
-	html h2 trap: #((title)).
-    html div trap: #() processors: #((guard ((todos) (notNil))) (widget TemporaryWidget)).
-	html p trap: #() processors: #((guard ((todos) (isNil))) (widget TemporaryWidget2))
-! !
-
 Widget subclass: #TemporaryWidget
 	instanceVariableNames: ''
 	package: 'Trapped-Demo'!