<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No follower found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>Your instance doesn't have any follower.</ng-container>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No host found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>Your instance is not following anyone.</ng-container>
<ng-template pTemplate="rowexpansion" let-redundancy>
<tr *ngIf="redundancy.redundancies.files.length !== 0">
- <td class="expand-cell" [attr.colspan]="getColspan()">
+ <td class="expand-cell" myAutoColspan>
<div *ngFor="let file of redundancy.redundancies.files" class="expansion-block">
<my-video-redundancy-information [redundancyElement]="file"></my-video-redundancy-information>
</div>
</tr>
<tr *ngIf="redundancy.redundancies.streamingPlaylists.length !== 0">
- <td class="expand-cell" [attr.colspan]="getColspan()">
+ <td class="expand-cell" myAutoColspan>
<div *ngFor="let playlist of redundancy.redundancies.streamingPlaylists">
<my-video-redundancy-information [redundancyElement]="playlist"></my-video-redundancy-information>
</div>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="isDisplayingRemoteVideos()" i18n>Your instance doesn't mirror any video.</ng-container>
<ng-container *ngIf="!isDisplayingRemoteVideos()" i18n>Your instance has no mirrored videos.</ng-container>
})
}
- getColspan () {
- if (this.isDisplayingRemoteVideos()) return 5
-
- return 4
- }
-
isDisplayingRemoteVideos () {
return this.displayType === 'remote-videos'
}
<ng-template pTemplate="rowexpansion" let-registration>
<tr>
- <td colspan="9">
+ <td myAutoColspan>
<div class="moderation-expanded">
<div class="left">
<div class="d-flex">
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="9">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No registrations found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No registrations found.</ng-container>
<ng-template pTemplate="rowexpansion" let-videoBlock>
<tr>
- <td class="expand-cell" colspan="6">
+ <td class="expand-cell" myAutoColspan>
<div class="d-flex moderation-expanded">
<div class="left">
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No blocked video found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No blocked video found.</ng-container>
<ng-template pTemplate="rowexpansion" let-videoComment>
<tr>
- <td class="expand-cell" colspan="5">
+ <td class="expand-cell" myAutoColspan>
<div [innerHTML]="videoComment.textHtml"></div>
</td>
</tr>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="7">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No comments found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No comments found.</ng-container>
<ng-template pTemplate="rowexpansion" let-user>
<tr class="user-blocked-reason">
- <td colspan="7">
+ <td myAutoColspan>
<span i18n class="ban-reason-label">Ban reason:</span>
{{ user.blockedReason }}
</td>
<ng-template pTemplate="rowexpansion" let-video>
<tr>
- <td class="video-info expand-cell" colspan="7">
+ <td class="video-info expand-cell" myAutoColspan>
<div>
<div *ngIf="isWebTorrent(video)">
WebTorrent:
<ng-template pTemplate="rowexpansion" let-runnerJob>
<tr>
- <td colspan="9">
+ <td myAutoColspan>
<div class="mt-2 fs-7 font-monospace">
Parent job: {{ runnerJob.parent?.uuid || '-' }} <br />
Processed on {{ (runnerJob.startedAt || '-') }} <br />
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="9">
+ <td myAutoColspan>
<div class="no-results">
<ng-container i18n>No runner jobs found.</ng-container>
</div>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container i18n>No remote runners found.</ng-container>
</div>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="4">
+ <td myAutoColspan>
<div class="no-results">
<ng-container i18n>No registration token found for remote runners.</ng-container>
</div>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container i18n>No ownership change request found.</ng-container>
</div>
<ng-template pTemplate="rowexpansion" let-videoImport>
<tr class="video-import-error" *ngIf="videoImport.error">
- <td colspan="6">
+ <td myAutoColspan>
<pre>{{ videoImport.error }}</pre>
</td>
</tr>
<ng-template pTemplate="rowexpansion" let-abuse>
<tr>
- <td *ngIf="isAdminView()" class="expand-cell" colspan="8">
+ <td *ngIf="isAdminView()" class="expand-cell" myAutoColspan>
<my-abuse-details [abuse]="abuse" [isAdminView]="true"></my-abuse-details>
</td>
- <td *ngIf="!isAdminView()" class="expand-cell" colspan="6">
+ <td *ngIf="!isAdminView()" class="expand-cell" myAutoColspan>
<my-abuse-details [abuse]="abuse" [isAdminView]="false"></my-abuse-details>
</td>
</tr>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="6">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No abuses found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No abuses found.</ng-container>
--- /dev/null
+import { AfterViewInit, Directive, ElementRef, Renderer2 } from '@angular/core'
+
+@Directive({
+ selector: '[myAutoColspan]'
+})
+export class AutoColspanDirective implements AfterViewInit {
+
+ constructor (
+ private host: ElementRef,
+ private renderer: Renderer2
+ ) { }
+
+ ngAfterViewInit () {
+ const el = this.host.nativeElement as HTMLElement
+ const table = el.closest('table')
+ if (!table) throw new Error('table element not found')
+
+ const th = table.querySelectorAll('th')
+
+ this.renderer.setAttribute(el, 'colspan', th.length + '')
+ }
+}
+export * from './auto-colspan.directive'
export * from './autofocus.directive'
export * from './bytes.pipe'
export * from './defer-loading.directive'
import { SharedGlobalIconModule } from '../shared-icons'
import { AccountService, SignupLabelComponent } from './account'
import {
+ AutoColspanDirective,
AutofocusDirective,
BytesPipe,
DeferLoadingDirective,
DurationFormatterPipe,
AutofocusDirective,
DeferLoadingDirective,
+ AutoColspanDirective,
InfiniteScrollerDirective,
PeerTubeTemplateDirective,
DurationFormatterPipe,
AutofocusDirective,
DeferLoadingDirective,
+ AutoColspanDirective,
InfiniteScrollerDirective,
PeerTubeTemplateDirective,
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="3">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No account found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No account found.</ng-container>
<ng-template pTemplate="emptymessage">
<tr>
- <td colspan="3">
+ <td myAutoColspan>
<div class="no-results">
<ng-container *ngIf="search" i18n>No server found matching current filters.</ng-container>
<ng-container *ngIf="!search" i18n>No server found.</ng-container>