Browse Source

Moving Todo example to its own directory

Herbert Vojčík 10 years ago
parent
commit
c256fa1bf6

+ 8 - 8
js/Trapped-Demo.js → example-todo/js/Trapped-Todo.js

@@ -1,8 +1,8 @@
-define("gh_herby_trapped/Trapped-Demo", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "gh_herby_trapped/Trapped-Backend", "amber_core/Kernel-Objects", "amber_core/Canvas", "gh_herby_trapped/Trapped-Frontend"], function(smalltalk,nil,_st){
-smalltalk.addPackage('Trapped-Demo');
-smalltalk.packages["Trapped-Demo"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped"};
+define("gh_herby_trapped_todo/Trapped-Todo", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "gh_herby_trapped/Trapped-Backend", "amber_core/Kernel-Objects", "amber_core/Canvas", "gh_herby_trapped/Trapped-Frontend"], function(smalltalk,nil,_st){
+smalltalk.addPackage('Trapped-Todo');
+smalltalk.packages["Trapped-Todo"].transport = {"type":"amd","amdNamespace":"gh_herby_trapped_todo"};
 
-smalltalk.addClass('App', smalltalk.ListKeyedIsolatedEntity, [], 'Trapped-Demo');
+smalltalk.addClass('App', smalltalk.ListKeyedIsolatedEntity, [], 'Trapped-Todo');
 smalltalk.App.comment="// Code from AngularJS Todo example, http://angularjs.org/#todo-js\x0afunction TodoCtrl($scope) {\x0a  $scope.todos = [\x0a    {text:'learn angular', done:true},\x0a    {text:'build an angular app', done:false}];\x0a \x0a  $scope.addTodo = function() {\x0a    $scope.todos.push({text:$scope.todoText, done:false});\x0a    $scope.todoText = '';\x0a  };\x0a \x0a  $scope.remaining = function() {\x0a    var count = 0;\x0a    angular.forEach($scope.todos, function(todo) {\x0a      count += todo.done ? 0 : 1;\x0a    });\x0a    return count;\x0a  };\x0a \x0a  $scope.archive = function() {\x0a    var oldTodos = $scope.todos;\x0a    $scope.todos = [];\x0a    angular.forEach(oldTodos, function(todo) {\x0a      if (!todo.done) $scope.todos.push(todo);\x0a    });\x0a  };\x0a}";
 smalltalk.addMethod(
 smalltalk.method({
@@ -48,7 +48,7 @@ smalltalk.App);
 
 
 
-smalltalk.addClass('AppModel', smalltalk.Object, ['title', 'todos', 'todoText'], 'Trapped-Demo');
+smalltalk.addClass('AppModel', smalltalk.Object, ['title', 'todos', 'todoText'], 'Trapped-Todo');
 smalltalk.AppModel.comment="// Code from AngularJS Todo example, http://angularjs.org/#todo-js\x0afunction TodoCtrl($scope) {\x0a  $scope.todos = [\x0a    {text:'learn angular', done:true},\x0a    {text:'build an angular app', done:false}];\x0a \x0a  $scope.addTodo = function() {\x0a    $scope.todos.push({text:$scope.todoText, done:false});\x0a    $scope.todoText = '';\x0a  };\x0a \x0a  $scope.remaining = function() {\x0a    var count = 0;\x0a    angular.forEach($scope.todos, function(todo) {\x0a      count += todo.done ? 0 : 1;\x0a    });\x0a    return count;\x0a  };\x0a \x0a  $scope.archive = function() {\x0a    var oldTodos = $scope.todos;\x0a    $scope.todos = [];\x0a    angular.forEach(oldTodos, function(todo) {\x0a      if (!todo.done) $scope.todos.push(todo);\x0a    });\x0a  };\x0a}";
 smalltalk.addMethod(
 smalltalk.method({
@@ -231,7 +231,7 @@ smalltalk.AppModel);
 
 
 
-smalltalk.addClass('TodoItemWidget', smalltalk.Widget, [], 'Trapped-Demo');
+smalltalk.addClass('TodoItemWidget', smalltalk.Widget, [], 'Trapped-Todo');
 smalltalk.TodoItemWidget.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({
@@ -265,10 +265,10 @@ smalltalk.TodoItemWidget);
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classDoneXxx",
-category: '*Trapped-Demo',
+category: '*Trapped-Todo',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
+return smalltalk.withContext(function($ctx1) {
 var $1;
 $1=self._dataToView_((function(carrier){
 return smalltalk.withContext(function($ctx2) {

+ 5 - 5
st/Trapped-Demo.st → example-todo/st/Trapped-Todo.st

@@ -1,7 +1,7 @@
-Smalltalk current createPackage: 'Trapped-Demo'!
+Smalltalk current createPackage: 'Trapped-Todo'!
 ListKeyedIsolatedEntity subclass: #App
 	instanceVariableNames: ''
-	package: 'Trapped-Demo'!
+	package: 'Trapped-Todo'!
 !App commentStamp!
 // Code from AngularJS Todo example, http://angularjs.org/#todo-js
 function TodoCtrl($scope) {
@@ -46,7 +46,7 @@ initialize
 
 Object subclass: #AppModel
 	instanceVariableNames: 'title todos todoText'
-	package: 'Trapped-Demo'!
+	package: 'Trapped-Todo'!
 !AppModel commentStamp!
 // Code from AngularJS Todo example, http://angularjs.org/#todo-js
 function TodoCtrl($scope) {
@@ -123,7 +123,7 @@ archive
 
 Widget subclass: #TodoItemWidget
 	instanceVariableNames: ''
-	package: 'Trapped-Demo'!
+	package: 'Trapped-Todo'!
 !TodoItemWidget commentStamp!
 <!!-- Code from AngularJS Todo example, http://angularjs.org/#todo-html -->
   <body>
@@ -155,7 +155,7 @@ renderOn: html
 			trap: #('text') ]
 ! !
 
-!TrappedProcessor class methodsFor: '*Trapped-Demo'!
+!TrappedProcessor class methodsFor: '*Trapped-Todo'!
 
 classDoneXxx
 	^self dataToView: [ :carrier | carrier target class: 'done-', carrier value ]

+ 0 - 0
meta/demo.css → example-todo/todo.css


+ 6 - 5
meta/demo.html → example-todo/todo.html

@@ -9,7 +9,7 @@
     </style>
     <script src="../bower_components/amber/support/amber.js"></script>
     <script type='text/javascript' src='../bower_components/amber/support/requirejs/require.min.js'></script>
-    <link rel="stylesheet" href="demo.css"/>
+    <link rel="stylesheet" href="todo.css"/>
 </head>
 <body>
 <script type="text/javascript">
@@ -17,14 +17,15 @@
     require.config({
         paths: {
             'gh_herby_trapped': '../js',
-            'gh_herby_trapped/_source': '../st'
+            'gh_herby_trapped_todo': 'js',
+            'gh_herby_trapped_todo/_source': 'st'
         }
     });
     require(
             ["amber/devel",
-                "gh_herby_trapped/Trapped-Backend", "gh_herby_trapped/Trapped-Frontend", "gh_herby_trapped/Trapped-Processors", "gh_herby_trapped/Trapped-Demo" ],
+                "gh_herby_trapped/Trapped-Processors", "gh_herby_trapped_todo/Trapped-Todo" ],
             function (smalltalk) {
-                smalltalk.defaultAmdNamespace = 'gh_herby_trapped';
+                smalltalk.defaultAmdNamespace = 'gh_herby_trapped_todo';
                 smalltalk.initialize();
 
                 $(function () {
@@ -51,6 +52,6 @@
         <input type="submit" class="btn-primary" value="add"/>
     </form>
 </div>
-<p data-trap=": (guardContents (#todos #isNil))">Loading ...</p>
+<p data-trap=": (guardContents (#todos #isNil))">Loading (fake 2 sec pause)...</p>
 </body>
 </html>

+ 1 - 1
meta/devel.html

@@ -14,7 +14,7 @@
     });
     require(
             ["amber/devel",
-                "gh_herby_trapped/Trapped-Backend", "gh_herby_trapped/Trapped-Tests" ],
+                "gh_herby_trapped/Trapped-Backend", "gh_herby_trapped/Trapped-Processors", "gh_herby_trapped/Trapped-Tests" ],
             function (smalltalk) {
                 smalltalk.defaultAmdNamespace = 'gh_herby_trapped';
                 smalltalk.initialize();