From a79e958ffc9cafdfbf558d4d5cef055c27452419 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 27 May 2016 16:46:06 -0700 Subject: [PATCH] [API] Show tasks from todo --- tutorials/todo/bundle.js | 52 +++++----------------------------------- tutorials/todo/todo.js | 8 ++++--- 2 files changed, 11 insertions(+), 49 deletions(-) diff --git a/tutorials/todo/bundle.js b/tutorials/todo/bundle.js index 5a4b16b09d..01ee89915c 100644 --- a/tutorials/todo/bundle.js +++ b/tutorials/todo/bundle.js @@ -4,56 +4,16 @@ define([ ], function ( legacyRegistry, TodoController - ) { +) { legacyRegistry.register("tutorials/todo", { "name": "To-do Plugin", "description": "Allows creating and editing to-do lists.", "extensions": { - "xviews": [ + "stylesheets": [ { - "key": "example.todo", - "type": "example.todo", - "glyph": "2", - "name": "List", - "templateUrl": "templates/todo.html", - "editable": true, - "toolbar": { - "sections": [ - { - "items": [ - { - "text": "Add Task", - "glyph": "+", - "method": "addTask", - "control": "button" - } - ] - }, - { - "items": [ - { - "glyph": "Z", - "method": "removeTask", - "control": "button" - } - ] - } - ] - } + "stylesheetUrl": "css/todo.css" } - ], - "controllers": [ - { - "key": "TodoController", - "implementation": TodoController, - "depends": [ "$scope", "dialogService" ] - } - ], - "stylesheets": [ - { - "stylesheetUrl": "css/todo.css" - } - ] - } -}); + ] + } + }); }); diff --git a/tutorials/todo/todo.js b/tutorials/todo/todo.js index 0ac86205f3..f6a889b60b 100644 --- a/tutorials/todo/todo.js +++ b/tutorials/todo/todo.js @@ -14,7 +14,9 @@ define([ description: "A list of things that need to be done." }, initialize: function (model) { - model.tasks = []; + model.tasks = [ + { description: "This is a task." } + ]; }, creatable: true }); @@ -45,7 +47,7 @@ define([ var $els = $(elements); var tasks = domainObject.getModel().tasks; var $message = $els.find('.example-message'); - var $list = $els.find('example-todo-task-list'); + var $list = $els.find('.example-todo-task-list'); var $buttons = { all: $els.find('.example-todo-button-all'), incomplete: $els.find('.example-todo-button-incomplete'), @@ -66,7 +68,6 @@ define([ Object.keys($buttons).forEach(function (k) { $buttons[k].toggleClass('selected', state.filter === k); }); - tasks = tasks.filter(filters[state.filter]); $list.empty(); @@ -76,6 +77,7 @@ define([ .prop('checked', task.completed); $taskEls.find('.example-task-description') .text(task.description); + $list.append($taskEls); }); $message.toggle(tasks.length < 1);