[Frontend] Mods to OverlayService

open #159
open #170
OverlayService can now be passed typeClass,
which is added to the CSS class of the overlay's
mct-include tag - intent is to allow the overlay
to size itself based on the type of content to be
displayed;
This commit is contained in:
Charles Hacskaylo
2015-10-07 12:11:30 -07:00
parent ad4292f1e9
commit 7f529eec68
2 changed files with 11 additions and 4 deletions

View File

@ -89,7 +89,8 @@ define(
// will handle actual insertion into the DOM // will handle actual insertion into the DOM
this.overlay = this.overlayService.createOverlay( this.overlay = this.overlayService.createOverlay(
key, key,
model model,
"t-dialog"
); );
// Track that a dialog is already visible, to // Track that a dialog is already visible, to
@ -230,6 +231,7 @@ define(
* progress, as well as a series of actions that * progress, as well as a series of actions that
* the user can take if necessary * the user can take if necessary
* @param {DialogModel} dialogModel defines options for the dialog * @param {DialogModel} dialogModel defines options for the dialog
* @param {typeClass} string tells overlayService that this overlay should use appropriate CSS class
* @returns {boolean} * @returns {boolean}
*/ */
DialogService.prototype.showBlockingMessage = function(dialogModel) { DialogService.prototype.showBlockingMessage = function(dialogModel) {
@ -238,7 +240,8 @@ define(
// will handle actual insertion into the DOM // will handle actual insertion into the DOM
this.overlay = this.overlayService.createOverlay( this.overlay = this.overlayService.createOverlay(
"blocking-message", "blocking-message",
{dialog: dialogModel} {dialog: dialogModel},
"t-dialog-sm"
); );
this.dialogVisible = true; this.dialogVisible = true;
return true; return true;

View File

@ -28,7 +28,7 @@ define(
// Template to inject into the DOM to show the dialog; really just points to // Template to inject into the DOM to show the dialog; really just points to
// the a specific template that can be included via mct-include // the a specific template that can be included via mct-include
var TEMPLATE = '<mct-include ng-model="overlay" key="key"></mct-include>'; var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>';
/** /**
@ -72,7 +72,7 @@ define(
* included overlay template (this will be passed * included overlay template (this will be passed
* in via ng-model) * in via ng-model)
*/ */
OverlayService.prototype.createOverlay = function (key, overlayModel) { OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
// Create a new scope for this overlay // Create a new scope for this overlay
var scope = this.newScope(), var scope = this.newScope(),
element; element;
@ -87,9 +87,13 @@ define(
// If no model is supplied, just fill in a default "cancel" // If no model is supplied, just fill in a default "cancel"
overlayModel = overlayModel || { cancel: dismiss }; overlayModel = overlayModel || { cancel: dismiss };
// If no typeClass is specified, set to default "t-dialog"
typeClass = typeClass || 't-dialog';
// Populate the scope; will be passed directly to the template // Populate the scope; will be passed directly to the template
scope.overlay = overlayModel; scope.overlay = overlayModel;
scope.key = key; scope.key = key;
scope.typeClass = typeClass;
// Create the overlay element and add it to the document's body // Create the overlay element and add it to the document's body
element = this.$compile(TEMPLATE)(scope); element = this.$compile(TEMPLATE)(scope);