| 
					
				 | 
			
			
				@@ -1,4 +1,30 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 $(function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  console.log('ready'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Create a model class. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const TodoItem = Backbone.Model.extend({}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Create a model instance. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const todoItem = new TodoItem({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    description: "Remember the milk", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    status: "incomplete", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    id: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Manipulate attributes. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const description = todoItem.get('description'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  todoItem.set('status', 'complete'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Save to the server: needs some configuration. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // todoItem.save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Create a view class. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const TodoView = Backbone.View.extend({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    render: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const html = '<h3>' + this.model.get('description') + '</h3>'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      $(this.el).html(html); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // Create a view instance. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const todoView = new TodoView({ model: todoItem }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  todoView.render(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  $('#app').html(todoView.el); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |