Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (37 sloc) 1.13 KB
import {Component, Input} from '@angular/core'
import {ActivatedRoute} from '@angular/router'
@Component({
selector: '.image-detail-row',
template: `
<td>
<a [routerLink]="imageRouteFor(rowData)">
<i class="fa fa-eye"></i> {{rowData.title}}
</a>
</td>
<td>{{rowData.size | number}}</td>
<td>{{rowData.dateTaken | date}}</td>
<td>{{rowData.width | number}} x {{rowData.height | number}}</td>
<td>{{rowData.portrait ? "Portrait" : ""}}{{rowData.landscape ? "Landscape" : ""}}</td>
<td>{{rowData.tags}}</td>
`
})
export class ImageDetailRow {
@Input() public rowData: any
private isEditRoute: boolean = false;
constructor(
private route: ActivatedRoute) {
}
public ngOnInit() {
this.route.url
.subscribe((urlPaths) => {
this.isEditRoute = urlPaths[0] && urlPaths[0].path && urlPaths[0].path === 'edit';
})
}
public imageRouteFor(img) {
return [
'/images',
this.isEditRoute ? 'edit' : 'view',
img.id
]
}
}
You can’t perform that action at this time.