From a7edadf4f9e0d5b5889dd44e064a2d4b5c05a79b Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 8 Jan 2016 09:04:08 -0600 Subject: [PATCH] refactor(alert): body property renamed to message --- ionic/components/alert/alert.ios.scss | 19 ++++++------ ionic/components/alert/alert.md.scss | 11 ++++--- ionic/components/alert/alert.scss | 2 +- ionic/components/alert/alert.ts | 36 ++++++++++++++++------ ionic/components/alert/test/basic/index.ts | 2 +- 5 files changed, 44 insertions(+), 26 deletions(-) diff --git a/ionic/components/alert/alert.ios.scss b/ionic/components/alert/alert.ios.scss index 144a17e97d..1b93a8fe18 100644 --- a/ionic/components/alert/alert.ios.scss +++ b/ionic/components/alert/alert.ios.scss @@ -18,10 +18,10 @@ $alert-ios-title-font-size: 17px !default; $alert-ios-sub-title-font-size: 14px !default; $alert-ios-sub-title-text-color: #666 !default; -$alert-ios-body-padding: 0px 16px 24px !default; -$alert-ios-body-text-color: inherit !default; -$alert-ios-body-text-align: center !default; -$alert-ios-body-font-size: 13px !default; +$alert-ios-message-padding: 0px 16px 24px !default; +$alert-ios-message-text-color: inherit !default; +$alert-ios-message-text-align: center !default; +$alert-ios-message-font-size: 13px !default; $alert-ios-input-padding: 6px !default; $alert-ios-input-margin-top: 10px !default; @@ -64,11 +64,12 @@ ion-alert { color: $alert-ios-sub-title-text-color; } -.alert-body { - padding: $alert-ios-body-padding; - color: $alert-ios-body-text-color; - text-align: $alert-ios-body-text-align; - font-size: $alert-ios-body-font-size; +.alert-message, +.alert-inputs { + padding: $alert-ios-message-padding; + color: $alert-ios-message-text-color; + text-align: $alert-ios-message-text-align; + font-size: $alert-ios-message-font-size; } .alert-input { diff --git a/ionic/components/alert/alert.md.scss b/ionic/components/alert/alert.md.scss index 355d24408f..097ade1abe 100644 --- a/ionic/components/alert/alert.md.scss +++ b/ionic/components/alert/alert.md.scss @@ -15,8 +15,8 @@ $alert-md-head-padding: 24px 24px 10px 24px !default; $alert-md-title-font-size: 20px !default; $alert-md-sub-title-font-size: 15px !default; -$alert-md-body-padding: 10px 24px 24px 24px !default; -$alert-md-body-text-color: rgba(0,0,0,.5) !default; +$alert-md-message-padding: 10px 24px 24px 24px !default; +$alert-md-message-text-color: rgba(0,0,0,.5) !default; $alert-md-input-border-color: #dedede !default; $alert-md-input-text-color: #000000 !default; @@ -51,9 +51,10 @@ $alert-md-buttons-justify-content: flex-end !default; font-size: $alert-md-sub-title-font-size; } -.alert-body { - padding: $alert-md-body-padding; - color: $alert-md-body-text-color; +.alert-message, +.alert-inputs { + padding: $alert-md-message-padding; + color: $alert-md-message-text-color; } .alert-input { diff --git a/ionic/components/alert/alert.scss b/ionic/components/alert/alert.scss index 24feed628f..f10f0c5056 100644 --- a/ionic/components/alert/alert.scss +++ b/ionic/components/alert/alert.scss @@ -50,7 +50,7 @@ ion-alert { font-weight: normal; } -.alert-body { +.alert-message { overflow: auto; &:empty { diff --git a/ionic/components/alert/alert.ts b/ionic/components/alert/alert.ts index 13c441c1f2..67832532e8 100644 --- a/ionic/components/alert/alert.ts +++ b/ionic/components/alert/alert.ts @@ -19,7 +19,7 @@ import {isDefined} from '../../util/util'; * An alert is created from an array of `buttons` and optionally an array of * `inputs`. Each button includes properties for its `text`, and optionally a * `handler`. If a handler returns `false` then the alert will not be dismissed. - * An alert can also optionally have a `title`, `subTitle` and `body`. + * An alert can also optionally have a `title`, `subTitle` and `message`. * * All buttons will show up in the order they have been added to the `buttons` * array, from left to right. Note: The right most button (the last one in the @@ -50,7 +50,7 @@ import {isDefined} from '../../util/util'; * presentConfirm() { * let alert = Alert.create({ * title: 'Confirm purchase', - * body: 'Do you want to buy this book?', + * message: 'Do you want to buy this book?', * buttons: [ * { * text: 'Cancel', @@ -141,10 +141,20 @@ export class Alert extends ViewController { } /** - * @param {string} body Alert body content + * @private */ - setBody(body) { - this.data.body = body; + setBody(message) { + // deprecated warning + console.warn('Alert setBody() has been renamed to setMessage()'); + + this.setMessage(message); + } + + /** + * @param {string} message Alert message content + */ + setMessage(message) { + this.data.message = message; } /** @@ -182,7 +192,7 @@ export class Alert extends ViewController { '

{{d.title}}

' + '

{{d.subTitle}}

' + '' + - '
{{d.body}}
' + + '
{{d.message}}
' + '
' + '' + '