renamed dialog and notification 'actions' to 'options'

This commit is contained in:
Henry
2015-10-22 14:14:21 -07:00
parent 0628398b01
commit 0053989de8
6 changed files with 34 additions and 34 deletions

View File

@ -52,17 +52,17 @@ define(
unknownProgress: !knownProgress, unknownProgress: !knownProgress,
unknownDuration: false, unknownDuration: false,
severity: MessageSeverity.INFO, severity: MessageSeverity.INFO,
actions: [ options: [
{ {
label: "Cancel Operation", label: "Cancel Operation",
action: function () { callback: function () {
$log.debug("Operation cancelled"); $log.debug("Operation cancelled");
dialogService.dismiss(); dialogService.dismiss();
} }
}, },
{ {
label: "Do something else...", label: "Do something else...",
action: function () { callback: function () {
$log.debug("Something else pressed"); $log.debug("Something else pressed");
} }
} }
@ -97,17 +97,17 @@ define(
title: "Error Dialog Example", title: "Error Dialog Example",
actionText: "Something happened, and it was not good.", actionText: "Something happened, and it was not good.",
severity: MessageSeverity.ERROR, severity: MessageSeverity.ERROR,
actions: [ options: [
{ {
label: "Try Again", label: "Try Again",
action: function () { callback: function () {
$log.debug("Try Again Pressed"); $log.debug("Try Again Pressed");
dialogService.dismiss(); dialogService.dismiss();
} }
}, },
{ {
label: "Cancel", label: "Cancel",
action: function () { callback: function () {
$log.debug("Cancel Pressed"); $log.debug("Cancel Pressed");
dialogService.dismiss(); dialogService.dismiss();
} }
@ -130,10 +130,10 @@ define(
" dialog. This dialog can be used to draw the user's" + " dialog. This dialog can be used to draw the user's" +
" attention to an event.", " attention to an event.",
severity: MessageSeverity.INFO, severity: MessageSeverity.INFO,
actions: [ options: [
{ {
label: "OK", label: "OK",
action: function () { callback: function () {
$log.debug("OK Pressed"); $log.debug("OK Pressed");
dialogService.dismiss(); dialogService.dismiss();
} }

View File

@ -55,19 +55,19 @@ define(
var actions = [ var actions = [
{ {
label: "Try Again", label: "Try Again",
action: function () { callback: function () {
$log.debug("Try Again pressed"); $log.debug("Try Again pressed");
} }
}, },
{ {
label: "Remove", label: "Remove",
action: function () { callback: function () {
$log.debug("Remove pressed"); $log.debug("Remove pressed");
} }
}, },
{ {
label: "Cancel", label: "Cancel",
action: function () { callback: function () {
$log.debug("Cancel pressed"); $log.debug("Cancel pressed");
} }
} }
@ -97,13 +97,13 @@ define(
title: "Example error notification " + messageCounter++, title: "Example error notification " + messageCounter++,
hint: "An error has occurred", hint: "An error has occurred",
severity: MessageSeverity.ERROR, severity: MessageSeverity.ERROR,
primaryAction: { primaryOption: {
label: 'Retry', label: 'Retry',
action: function() { callback: function() {
$log.info('Retry clicked'); $log.info('Retry clicked');
} }
}, },
actions: getExampleActions()}); options: getExampleActions()});
}; };
/** /**
* Launch a new notification with a severity of 'Alert'. * Launch a new notification with a severity of 'Alert'.
@ -114,13 +114,13 @@ define(
title: "Alert notification " + (messageCounter++), title: "Alert notification " + (messageCounter++),
hint: "This is an alert message", hint: "This is an alert message",
severity: MessageSeverity.ALERT, severity: MessageSeverity.ALERT,
primaryAction: { primaryOption: {
label: 'Retry', label: 'Retry',
action: function() { callback: function() {
$log.info('Retry clicked'); $log.info('Retry clicked');
} }
}, },
actions: getExampleActions()}); options: getExampleActions()});
}; };

View File

@ -19,15 +19,15 @@
ng-show="ngModel.progress !== undefined || ngModel.unknownProgress"></mct-include> ng-show="ngModel.progress !== undefined || ngModel.unknownProgress"></mct-include>
</div> </div>
<div class="bottom-bar"> <div class="bottom-bar">
<a ng-repeat="dialogAction in ngModel.actions" <a ng-repeat="dialogOption in ngModel.options"
class="s-btn major" class="s-btn major"
ng-click="dialogAction.action()"> ng-click="dialogOption.callback()">
{{dialogAction.label}} {{dialogOption.label}}
</a> </a>
<a class="s-btn major" <a class="s-btn major"
ng-if="ngModel.primaryAction" ng-if="ngModel.primaryOption"
ng-click="ngModel.primaryAction.action()"> ng-click="ngModel.primaryOption.callback()">
{{ngModel.primaryAction.label}} {{ngModel.primaryOption.label}}
</a> </a>
</div> </div>

View File

@ -178,7 +178,7 @@ define(
* A user action that can be performed from a blocking dialog. These * A user action that can be performed from a blocking dialog. These
* actions will be rendered as buttons within a blocking dialog. * actions will be rendered as buttons within a blocking dialog.
* *
* @typedef DialogAction * @typedef DialogOption
* @property {string} label a label to be displayed as the button * @property {string} label a label to be displayed as the button
* text for this action * text for this action
* @property {function} action a function to be called when the * @property {function} action a function to be called when the
@ -207,12 +207,12 @@ define(
* impossible to provide an estimate for. Providing a true value for * impossible to provide an estimate for. Providing a true value for
* this attribute will indicate to the user that the progress and * this attribute will indicate to the user that the progress and
* duration cannot be estimated. * duration cannot be estimated.
* @property {DialogAction} primaryAction an action that will * @property {DialogOption} primaryOption an action that will
* be added to the dialog as a button. The primary action can be * be added to the dialog as a button. The primary action can be
* used as the suggested course of action for the user. Making it * used as the suggested course of action for the user. Making it
* distinct from other actions allows it to be styled differently, * distinct from other actions allows it to be styled differently,
* and treated preferentially in banner mode. * and treated preferentially in banner mode.
* @property {DialogAction[]} actions a list of actions that will * @property {DialogOption[]} options a list of actions that will
* be added to the dialog as buttons. * be added to the dialog as buttons.
*/ */

View File

@ -14,10 +14,10 @@
ng-model="active.notification"> ng-model="active.notification">
</mct-include> </mct-include>
</span> </span>
<a ng-hide="active.notification.primaryAction === undefined" <a ng-hide="active.notification.primaryOption === undefined"
class="banner-elem l-action s-action" class="banner-elem l-action s-action"
ng-click="action(active.notification.primaryAction.action, $event)"> ng-click="action(active.notification.primaryOption.callback, $event)">
{{active.notification.primaryAction.label}} {{active.notification.primaryOption.label}}
</a> </a>
<a class="banner-elem ui-symbol close" ng-click="dismiss(active.notification, $event)"> <a class="banner-elem ui-symbol close" ng-click="dismiss(active.notification, $event)">
&#x78;</a> &#x78;</a>

View File

@ -37,13 +37,13 @@ define(
"use strict"; "use strict";
/** /**
* A representation of a user action. Actions are provided to * A representation of a user action. Options are provided to
* dialogs and notifications and are shown as buttons. * dialogs and notifications and are shown as buttons.
* *
* @typedef {object} NotificationAction * @typedef {object} NotificationOption
* @property {string} label the label to appear on the button for * @property {string} label the label to appear on the button for
* this action * this action
* @property {function} action a callback function to be invoked * @property {function} callback a callback function to be invoked
* when the button is clicked * when the button is clicked
*/ */
@ -67,12 +67,12 @@ define(
* be automatically minimized or dismissed (depending on severity). * be automatically minimized or dismissed (depending on severity).
* Additionally, if the provided value is a number, it will be used * Additionally, if the provided value is a number, it will be used
* as the delay period before being dismissed. * as the delay period before being dismissed.
* @property {NotificationAction} primaryAction the default user * @property {NotificationOption} primaryOption the default user
* response to * response to
* this message. Will be represented as a button with the provided * this message. Will be represented as a button with the provided
* label and action. May be used by banner notifications to display * label and action. May be used by banner notifications to display
* only the most important option to users. * only the most important option to users.
* @property {NotificationAction[]} actions any additional * @property {NotificationOption[]} options any additional
* actions the user can take. Will be represented as additional buttons * actions the user can take. Will be represented as additional buttons
* that may or may not be available from a banner. * that may or may not be available from a banner.
*/ */