mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Merge branch 'master' into alpha38
Conflicts: ionic/components/nav/view-controller.ts ionic/components/tabs/tab.ts
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import {Directive, ElementRef} from 'angular2/angular2';
|
import {Directive, ElementRef, Renderer} from 'angular2/angular2';
|
||||||
|
|
||||||
import {IonicConfig} from '../../config/config';
|
import {IonicConfig} from '../../config/config';
|
||||||
|
|
||||||
@ -13,7 +13,8 @@ export class Button {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
config: IonicConfig,
|
config: IonicConfig,
|
||||||
elementRef: ElementRef
|
elementRef: ElementRef,
|
||||||
|
renderer: Renderer
|
||||||
) {
|
) {
|
||||||
let element = elementRef.nativeElement;
|
let element = elementRef.nativeElement;
|
||||||
|
|
||||||
@ -21,6 +22,12 @@ export class Button {
|
|||||||
element.classList.add('disable-hover');
|
element.classList.add('disable-hover');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO this isn't working in the popup
|
||||||
|
if (element.hasAttribute('type')) {
|
||||||
|
let type = element.getAttribute("type");
|
||||||
|
renderer.setElementAttribute(elementRef, type, "");
|
||||||
|
}
|
||||||
|
|
||||||
if (element.hasAttribute('ion-item')) {
|
if (element.hasAttribute('ion-item')) {
|
||||||
// no need to put on these icon classes for an ion-item
|
// no need to put on these icon classes for an ion-item
|
||||||
return;
|
return;
|
||||||
|
@ -4,6 +4,7 @@ import {FORM_DIRECTIVES, NgControl, NgControlGroup,
|
|||||||
import {OverlayController} from '../overlay/overlay-controller';
|
import {OverlayController} from '../overlay/overlay-controller';
|
||||||
import {IonicConfig} from '../../config/config';
|
import {IonicConfig} from '../../config/config';
|
||||||
import {Animation} from '../../animations/animation';
|
import {Animation} from '../../animations/animation';
|
||||||
|
import {Button} from '../button/button';
|
||||||
import * as util from 'ionic/util';
|
import * as util from 'ionic/util';
|
||||||
|
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ export class Popup {
|
|||||||
* template: '', // String (optional). The html template to place in the popup body.
|
* template: '', // String (optional). The html template to place in the popup body.
|
||||||
* templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
|
* templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
|
||||||
* okText: '', // String (default: 'OK'). The text of the OK button.
|
* okText: '', // String (default: 'OK'). The text of the OK button.
|
||||||
* okType: '', // String (default: 'primary'). The type of the OK button.
|
* okType: '', // String (default: ''). The type of the OK button.
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -115,7 +116,7 @@ export class Popup {
|
|||||||
}
|
}
|
||||||
let button = {
|
let button = {
|
||||||
text: opts.okText || 'OK',
|
text: opts.okText || 'OK',
|
||||||
type: opts.okType || 'primary',
|
type: opts.okType || '',
|
||||||
onTap: (event, popupRef) => {
|
onTap: (event, popupRef) => {
|
||||||
// Allow it to close
|
// Allow it to close
|
||||||
//resolve();
|
//resolve();
|
||||||
@ -148,9 +149,9 @@ export class Popup {
|
|||||||
* template: '', // String (optional). The html template to place in the popup body.
|
* template: '', // String (optional). The html template to place in the popup body.
|
||||||
* templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
|
* templateUrl: '', // String (optional). The URL of an html template to place in the popup body.
|
||||||
* cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.
|
* cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.
|
||||||
* cancelType: '', // String (default: 'primary'). The type of the Cancel button.
|
* cancelType: '', // String (default: ''). The type of the Cancel button.
|
||||||
* okText: '', // String (default: 'OK'). The text of the OK button.
|
* okText: '', // String (default: 'OK'). The text of the OK button.
|
||||||
* okType: '', // String (default: 'primary'). The type of the OK button.
|
* okType: '', // String (default: ''). The type of the OK button.
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -164,14 +165,14 @@ export class Popup {
|
|||||||
}
|
}
|
||||||
let okButton = {
|
let okButton = {
|
||||||
text: opts.okText || 'OK',
|
text: opts.okText || 'OK',
|
||||||
type: opts.okType || 'primary',
|
type: opts.okType || '',
|
||||||
onTap: (event, popupRef) => {
|
onTap: (event, popupRef) => {
|
||||||
// Allow it to close
|
// Allow it to close
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let cancelButton = {
|
let cancelButton = {
|
||||||
text: opts.cancelText || 'Cancel',
|
text: opts.cancelText || 'Cancel',
|
||||||
type: opts.cancelType || 'primary',
|
type: opts.cancelType || '',
|
||||||
isCancel: true,
|
isCancel: true,
|
||||||
onTap: (event, popupRef) => {
|
onTap: (event, popupRef) => {
|
||||||
// Allow it to close
|
// Allow it to close
|
||||||
@ -204,9 +205,9 @@ export class Popup {
|
|||||||
* inputType: // String (default: 'text'). The type of input to use.
|
* inputType: // String (default: 'text'). The type of input to use.
|
||||||
* inputPlaceholder: // String (default: ''). A placeholder to use for the input.
|
* inputPlaceholder: // String (default: ''). A placeholder to use for the input.
|
||||||
* cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.
|
* cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.
|
||||||
* cancelType: '', // String (default: 'primary'). The type of the Cancel button.
|
* cancelType: '', // String (default: ''). The type of the Cancel button.
|
||||||
* okText: '', // String (default: 'OK'). The text of the OK button.
|
* okText: '', // String (default: 'OK'). The text of the OK button.
|
||||||
* okType: '', // String (default: 'primary'). The type of the OK button.
|
* okType: '', // String (default: ''). The type of the OK button.
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
@ -220,7 +221,7 @@ export class Popup {
|
|||||||
}
|
}
|
||||||
let okButton = {
|
let okButton = {
|
||||||
text: opts.okText || 'OK',
|
text: opts.okText || 'OK',
|
||||||
type: opts.okType || 'primary',
|
type: opts.okType || '',
|
||||||
onTap: (event, popupRef) => {
|
onTap: (event, popupRef) => {
|
||||||
// Allow it to close
|
// Allow it to close
|
||||||
}
|
}
|
||||||
@ -228,7 +229,7 @@ export class Popup {
|
|||||||
|
|
||||||
let cancelButton = {
|
let cancelButton = {
|
||||||
text: opts.cancelText || 'Cancel',
|
text: opts.cancelText || 'Cancel',
|
||||||
type: opts.cancelType || 'primary',
|
type: opts.cancelType || '',
|
||||||
isCancel: true,
|
isCancel: true,
|
||||||
onTap: (event, popupRef) => {
|
onTap: (event, popupRef) => {
|
||||||
// Allow it to close
|
// Allow it to close
|
||||||
@ -264,10 +265,10 @@ export class Popup {
|
|||||||
|
|
||||||
const OVERLAY_TYPE = 'popup';
|
const OVERLAY_TYPE = 'popup';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ion-popup'
|
selector: 'ion-popup'
|
||||||
})
|
})
|
||||||
|
// TODO add button type to button: [type]="button.type"
|
||||||
@View({
|
@View({
|
||||||
template:
|
template:
|
||||||
'<backdrop (click)="_cancel($event)" tappable disable-activated></backdrop>' +
|
'<backdrop (click)="_cancel($event)" tappable disable-activated></backdrop>' +
|
||||||
@ -284,7 +285,7 @@ const OVERLAY_TYPE = 'popup';
|
|||||||
'<button *ng-for="#button of buttons" (click)="buttonTapped(button, $event)" [inner-html]="button.text"></button>' +
|
'<button *ng-for="#button of buttons" (click)="buttonTapped(button, $event)" [inner-html]="button.text"></button>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</popup-wrapper>',
|
'</popup-wrapper>',
|
||||||
directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor]
|
directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor, Button]
|
||||||
})
|
})
|
||||||
|
|
||||||
class PopupCmp {
|
class PopupCmp {
|
||||||
|
@ -32,8 +32,7 @@ class E2EApp {
|
|||||||
title: "New Album",
|
title: "New Album",
|
||||||
template: "Enter a name for this new album you're so keen on adding",
|
template: "Enter a name for this new album you're so keen on adding",
|
||||||
inputPlaceholder: "Title",
|
inputPlaceholder: "Title",
|
||||||
okText: "Save",
|
okText: "Save"
|
||||||
okType: "secondary"
|
|
||||||
}).then((name) => {
|
}).then((name) => {
|
||||||
this.promptResult = name;
|
this.promptResult = name;
|
||||||
this.promptOpen = false;
|
this.promptOpen = false;
|
||||||
|
Reference in New Issue
Block a user