[API] Begin adding toolbar

This commit is contained in:
Victor Woeltjen 2016-06-17 11:43:18 -07:00
parent 96316de6e4
commit c289a27305
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1 @@
This is a toolbar.

View File

@ -1,8 +1,9 @@
define([ define([
"text!./todo.html", "text!./todo.html",
"text!./todo-task.html", "text!./todo-task.html",
"text!./todo-toolbar.html",
"zepto" "zepto"
], function (todoTemplate, taskTemplate, $) { ], function (todoTemplate, taskTemplate, toolbarTemplate, $) {
/** /**
* @param {mct.MCT} mct * @param {mct.MCT} mct
*/ */
@ -100,10 +101,27 @@ define([
$message.toggle(tasks.length < 1); $message.toggle(tasks.length < 1);
}; };
function TodoToolbarView(domainObject) {
this.domainObject = domainObject;
}
TodoToolbarView.prototype.show = function (container) {
$(container).append($(toolbarTemplate));
};
TodoToolbarView.prototype.destroy = function () {
};
mct.type('example.todo', todoType); mct.type('example.todo', todoType);
mct.view(mct.regions.main, function (domainObject) { mct.view(mct.regions.main, function (domainObject) {
return todoType.check(domainObject) && new TodoView(domainObject); return todoType.check(domainObject) && new TodoView(domainObject);
}); });
mct.view(mct.regions.toolbar, function (domainObject) {
return todoType.check(domainObject) && new TodoToolbarView(domainObject);
});
return mct; return mct;
}; };