[API] Show dialog via mct

This commit is contained in:
Victor Woeltjen 2016-07-28 15:57:15 -07:00
parent 87682607a5
commit 62d90a8114
2 changed files with 11 additions and 3 deletions

View File

@ -1,14 +1,21 @@
define([], function () {
function ActionDialogDecorator(actionService) {
function ActionDialogDecorator(mct, actionService) {
this.actionService = actionService;
this.mct = mct;
}
ActionDialogDecorator.prototype.getActions = function (context) {
var mct = this.mct;
return this.actionService.getActions(context).map(function (action) {
if (action.dialogService) {
action.dialogService = Object.create(action.dialogService);
action.dialogService.getUserInput = function (form, value) {
window.alert("Get user input!");
mct.dialog({
show: function (container) {
container.textContent = JSON.stringify(value);
},
destroy: function () {}
}, form.title);
return Promise.resolve(value);
}
}

View File

@ -47,7 +47,8 @@ define([
{
type: "decorator",
provides: "actionService",
implementation: ActionDialogDecorator
implementation: ActionDialogDecorator,
depends: [ "mct" ]
}
]
}