<div>
    <h2>
        <span jhiTranslate="baeldungApp.post.home.title">Posts</span>
        <button class="btn btn-primary float-right create-post" [routerLink]="['/', { outlets: { popup: ['post-new'] } }]">
            <span class="fa fa-plus"></span>
            <span  jhiTranslate="baeldungApp.post.home.createLabel">
            Create new Post
            </span>
        </button>
    </h2>
    <jhi-alert></jhi-alert>
    <div class="row">
    </div>
    <br/>
    <div class="table-responsive" *ngIf="posts">
        <table class="table table-striped">
            <thead>
            <tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
            <th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="title"><span jhiTranslate="baeldungApp.post.title">Title</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="content"><span jhiTranslate="baeldungApp.post.content">Content</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="creationDate"><span jhiTranslate="baeldungApp.post.creationDate">Creation Date</span> <span class="fa fa-sort"></span></th>
            <th jhiSortBy="creator.login"><span jhiTranslate="baeldungApp.post.creator">Creator</span> <span class="fa fa-sort"></span></th>
            <th></th>
            </tr>
            </thead>
            <tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
            <tr *ngFor="let post of posts ;trackBy: trackId">
                <td><a [routerLink]="['../post', post.id ]">{{post.id}}</a></td>
                <td>{{post.title}}</td>
                <td>{{post.content}}</td>
                <td>{{post.creationDate | date:'mediumDate'}}</td>
                <td>
                    {{post.creator?.login}}
                </td>
                <td class="text-right">
                    <div class="btn-group flex-btn-group-container">
                        <button type="submit"
                                [routerLink]="['../post', post.id ]"
                                class="btn btn-info btn-sm">
                            <span class="fa fa-eye"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.view">View</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'post/'+ post.id + '/edit'} }]"
                                replaceUrl="true"
                                class="btn btn-primary btn-sm">
                            <span class="fa fa-pencil"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.edit">Edit</span>
                        </button>
                        <button type="submit"
                                [routerLink]="['/', { outlets: { popup: 'post/'+ post.id + '/delete'} }]"
                                replaceUrl="true"
                                class="btn btn-danger btn-sm">
                            <span class="fa fa-remove"></span>
                            <span class="hidden-md-down" jhiTranslate="entity.action.delete">Delete</span>
                        </button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
