mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
[API] Show tasks from todo
This commit is contained in:
parent
03cb0ccb57
commit
a79e958ffc
@ -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": [
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
{
|
||||
"key": "TodoController",
|
||||
"implementation": TodoController,
|
||||
"depends": [ "$scope", "dialogService" ]
|
||||
}
|
||||
],
|
||||
"stylesheets": [
|
||||
{
|
||||
"stylesheetUrl": "css/todo.css"
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user