Skip to content

Commit

Permalink
Fixed #507
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Jun 22, 2016
1 parent 7134019 commit efd402a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 9 additions & 2 deletions components/dialog/dialog.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,Renderer} from '@angular/core';
import {Component,ElementRef,AfterViewInit,AfterViewChecked,OnDestroy,Input,Output,EventEmitter,Renderer,ContentChild} from '@angular/core';
import {DomHandler} from '../dom/domhandler';
import {Header} from '../common';

@Component({
selector: 'p-dialog',
Expand All @@ -8,7 +9,10 @@ import {DomHandler} from '../dom/domhandler';
[style.display]="visible ? 'block' : 'none'" [style.width.px]="width" [style.height.px]="height" (mousedown)="moveOnTop()">
<div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top"
(mousedown)="initDrag($event)" (mouseup)="endDrag($event)">
<span class="ui-dialog-title">{{header}}</span>
<span class="ui-dialog-title" *ngIf="header">{{header}}</span>
<span class="ui-dialog-title" *ngIf="headerFacet">
<ng-content select="header"></ng-content>
</span>
<a [ngClass]="{'ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all':true,'ui-state-hover':hoverCloseIcon}" href="#" role="button" *ngIf="closable"
(click)="hide($event)" (mouseenter)="hoverCloseIcon=true" (mouseleave)="hoverCloseIcon=false">
<span class="fa fa-fw fa-close"></span>
Expand All @@ -22,6 +26,7 @@ import {DomHandler} from '../dom/domhandler';
(mousedown)="initResize($event)"></div>
</div>
`,
directives: [Header],
providers: [DomHandler]
})
export class Dialog implements AfterViewInit,AfterViewChecked,OnDestroy {
Expand Down Expand Up @@ -53,6 +58,8 @@ export class Dialog implements AfterViewInit,AfterViewChecked,OnDestroy {
@Input() closable: boolean = true;

@Input() responsive: boolean;

@ContentChild(Header) headerFacet;

@Output() onBeforeShow: EventEmitter<any> = new EventEmitter();

Expand Down
10 changes: 7 additions & 3 deletions showcase/demo/dialog/dialogdemo.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,15 @@ <h3>Getting Started</h3>
<p>By default dialog is hidden and enabling the visible property displays the dialog. As visible supports
two-way binding, hiding the dialog with close button updates the visible state as false.</p>

<h3>Footer</h3>
<p>Footer area is defined using the footer element.</p>
<h3>Header and Footer</h3>
<p>Header and Footer sections are useful to include custom content. Note that Header and Footer components should be imported and defined
at directives section of your component for this to work.</p>
<pre>
<code class="language-markup" pCode>
&lt;p-dialog header="Title" [(visible)]="display"&gt;
&lt;p-dialog [(visible)]="display"&gt;
&lt;header&gt;
Header content here
&lt;/header&gt;
Content
&lt;footer&gt;
Footer content here
Expand Down

0 comments on commit efd402a

Please sign in to comment.