[API] Expose Dialog as constructor

...and use it that way from todo plugin
This commit is contained in:
Victor Woeltjen 2016-08-11 16:04:26 -07:00
parent 8861644f2d
commit 93872ce074
6 changed files with 10 additions and 11 deletions

View File

@ -31,10 +31,12 @@
<script type="text/javascript">
require(['main'], function (mct) {
require([
'./tutorials/todo/todo',
'./example/imagery/bundle',
'./example/eventGenerator/bundle',
'./example/generator/bundle',
], function () {
], function (todo) {
todo(mct);
mct.run();
})
});

View File

@ -4,7 +4,6 @@ define([
'uuid',
'./api/api',
'text!./adapter/templates/edit-object-replacement.html',
'./ui/Dialog',
'./Selection',
'./api/objects/object-utils'
], function (
@ -13,7 +12,6 @@ define([
uuid,
api,
editObjectTemplate,
Dialog,
Selection,
objectUtils
) {
@ -119,10 +117,6 @@ define([
});
};
MCT.prototype.dialog = function (view, title) {
return new Dialog(view, title).show();
};
MCT.prototype.start = function () {
this.legacyExtension('runs', {
depends: ['navigationService'],

View File

@ -3,19 +3,22 @@ define([
'./TimeConductor',
'./View',
'./objects/ObjectAPI',
'./composition/CompositionAPI'
'./composition/CompositionAPI',
'./ui/Dialog'
], function (
Type,
TimeConductor,
View,
ObjectAPI,
CompositionAPI
CompositionAPI,
Dialog
) {
return {
Type: Type,
TimeConductor: new TimeConductor(),
View: View,
Objects: ObjectAPI,
Composition: CompositionAPI
Composition: CompositionAPI,
Dialog: Dialog
};
});

View File

@ -163,7 +163,7 @@ define([
destroy: function () {}
};
mct.dialog(view, "Add a Task").then(function () {
new mct.Dialog(view, "Add a Task").show().then(function () {
var description = $dialog.find('input').val();
var tasks = self.mutableObject.get('tasks');
tasks.push({ description: description });