Refactored DialogService a little

This commit is contained in:
Henry
2015-10-09 11:57:47 -07:00
parent fe3e3325e1
commit 85300d3743
7 changed files with 44 additions and 83 deletions

View File

@@ -1,20 +1,20 @@
<div class="l-message message-severity-{{ngModel.dialog.severity}}">
<div class="l-message message-severity-{{ngModel.severity}}">
<div class="ui-symbol type-icon message-type"></div>
<div class="message-contents">
<div class="top-bar">
<div class="title">{{ngModel.dialog.title}}</div>
<div class="hint" ng-hide="ngModel.dialog.hint === undefined">{{ngModel.dialog.hint}}</div>
<div class="title">{{ngModel.title}}</div>
<div class="hint" ng-hide="ngModel.hint === undefined">{{ngModel.hint}}</div>
</div>
<div class="message-body">
<div class="message-action">
{{ngModel.dialog.actionText}} message-severity-{{ngModel.dialog.severity}}
{{ngModel.actionText}} message-severity-{{ngModel.severity}}
</div>
<mct-include key="'progress-bar'"
ng-model="ngModel"
ng-hide="ngModel.dialog.progress === undefined"></mct-include>
ng-hide="ngModel.progress === undefined"></mct-include>
</div>
<div class="bottom-bar">
<a ng-repeat="dialogAction in ngModel.dialog.actions"
<a ng-repeat="dialogAction in ngModel.actions"
class="s-btn major"
ng-click="dialogAction.action()">
{{dialogAction.label}}

View File

@@ -6,7 +6,7 @@
</div>
</div>
<div class="abs message-body">
<mct-include ng-repeat="msg in ngModel.dialog.messages" key="'message'" ng-model="msg.ngModel"></mct-include>
<mct-include ng-repeat="msg in ngModel.dialog.messages" key="'message'" ng-model="msg"></mct-include>
<!-- <ul>
<li ng-repeat="msg in ngModel.dialog.messages">
&lt;!&ndash;Message: {{msg.title}}&ndash;&gt;

View File

@@ -55,7 +55,7 @@ define(
this.dialogVisible = false;
};
DialogService.prototype.getDialogResponse = function (key, model, resultGetter) {
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
// We will return this result as a promise, because user
// input is asynchronous.
var deferred = this.$q.defer(),
@@ -90,7 +90,7 @@ define(
this.overlay = this.overlayService.createOverlay(
key,
model,
"t-dialog"
typeClass || "t-dialog"
);
// Track that a dialog is already visible, to
@@ -235,54 +235,12 @@ define(
* @returns {boolean}
*/
DialogService.prototype.showBlockingMessage = function(dialogModel) {
if (this.canShowDialog(dialogModel)) {
// Add the overlay using the OverlayService, which
// will handle actual insertion into the DOM
this.overlay = this.overlayService.createOverlay(
"overlay-blocking-message",
{ dialog: dialogModel },
"t-dialog-sm"
);
this.dialogVisible = true;
if (this.canShowDialog) {
this.getDialogResponse("overlay-blocking-message", dialogModel, undefined, "t-dialog-sm");
return true;
} else {
//Could not show a dialog, so return indication of this to
//client code.
return false;
}
};
DialogService.prototype.showMessageList = function(dialogModel) {
var self = this;
// Cancel function; this will be passed in to the
// overlay-dialog template and associated with a
// Cancel or X button click
function cancel() {
//deferred.reject(); // Not sure what this does
self.dismiss();
}
if (this.canShowDialog(dialogModel)) {
// Add the overlay using the OverlayService, which
// will handle actual insertion into the DOM
this.overlay = this.overlayService.createOverlay(
"overlay-message-list",
{
dialog: dialogModel,
cancel: cancel
},
"t-dialog"
);
this.dialogVisible = true;
return true;
} else {
//Could not show a dialog, so return indication of this to
//client code.
return false;
}
};
return DialogService;