aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss18
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts40
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html19
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss9
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts11
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.scss2
6 files changed, 66 insertions, 33 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss
index 862da7c18..704d908c3 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss
+++ b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.scss
@@ -1,20 +1,24 @@
1.custom-markup-container { 1.custom-markup-container {
2 2
3 ::ng-deep .peertube-container { 3 ::ng-deep .peertube-container {
4 margin: 30px 0 15px;
5 4
6 h4 { 5 &.layout-row {
7 margin-bottom: 0;
8 }
9
10 .layout-row {
11 display: flex; 6 display: flex;
12 flex-direction: row; 7 flex-direction: row;
8 flex-wrap: wrap;
13 } 9 }
14 10
15 .layout-column { 11 &.layout-column {
16 display: flex; 12 display: flex;
17 flex-direction: column; 13 flex-direction: column;
18 } 14 }
15
16 .header {
17 margin: 30px 0 15px;
18 }
19
20 h4 {
21 margin-bottom: 0;
22 }
19 } 23 }
20} 24}
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index aa5dbe643..729cd296b 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -168,11 +168,15 @@ export class CustomMarkupService {
168 168
169 const model = { 169 const model = {
170 onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false, 170 onlyDisplayTitle: this.buildBoolean(data.onlyDisplayTitle) ?? false,
171 maxRows: this.buildNumber(data.maxRows) ?? -1,
172
171 sort: data.sort || '-publishedAt', 173 sort: data.sort || '-publishedAt',
174 count: this.buildNumber(data.count) || 10,
175
172 categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [], 176 categoryOneOf: this.buildArrayNumber(data.categoryOneOf) ?? [],
173 languageOneOf: this.buildArrayString(data.languageOneOf) ?? [], 177 languageOneOf: this.buildArrayString(data.languageOneOf) ?? [],
174 filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined, 178
175 count: this.buildNumber(data.count) || 10 179 filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined
176 } 180 }
177 181
178 this.dynamicElementService.setModel(component, model) 182 this.dynamicElementService.setModel(component, model)
@@ -183,11 +187,16 @@ export class CustomMarkupService {
183 private containerBuilder (el: HTMLElement) { 187 private containerBuilder (el: HTMLElement) {
184 const data = el.dataset as ContainerMarkupData 188 const data = el.dataset as ContainerMarkupData
185 189
190 // Move inner HTML in the new element we'll create
191 const content = el.innerHTML
192 el.innerHTML = ''
193
186 const root = document.createElement('div') 194 const root = document.createElement('div')
195 root.innerHTML = content
187 196
188 const layoutClass = data.layout 197 const layoutClass = data.layout
189 ? 'layout-' + data.layout 198 ? 'layout-' + data.layout
190 : 'layout-row' 199 : 'layout-column'
191 200
192 root.classList.add('peertube-container', layoutClass) 201 root.classList.add('peertube-container', layoutClass)
193 202
@@ -195,16 +204,23 @@ export class CustomMarkupService {
195 root.setAttribute('width', data.width) 204 root.setAttribute('width', data.width)
196 } 205 }
197 206
198 if (data.title) { 207 if (data.title || data.description) {
199 const titleElement = document.createElement('h4') 208 const headerElement = document.createElement('div')
200 titleElement.innerText = data.title 209 headerElement.classList.add('header')
201 root.appendChild(titleElement) 210
202 } 211 if (data.title) {
212 const titleElement = document.createElement('h4')
213 titleElement.innerText = data.title
214 headerElement.appendChild(titleElement)
215 }
216
217 if (data.description) {
218 const descriptionElement = document.createElement('div')
219 descriptionElement.innerText = data.description
220 headerElement.append(descriptionElement)
221 }
203 222
204 if (data.description) { 223 root.insertBefore(headerElement, root.firstChild)
205 const descriptionElement = document.createElement('div')
206 descriptionElement.innerText = data.description
207 root.appendChild(descriptionElement)
208 } 224 }
209 225
210 return root 226 return root
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html
index a2fd2fe40..15ef9d418 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html
@@ -1,8 +1,13 @@
1<div class="videos"> 1<div class="root">
2 <my-video-miniature 2 <div class="videos" [ngStyle]="limitRowsStyle()">
3 *ngFor="let video of videos" 3
4 [video]="video" [user]="getUser()" [displayAsRow]="false" 4 <div class="video-wrapper" *ngFor="let video of videos">
5 [displayVideoActions]="false" [displayOptions]="displayOptions" 5 <my-video-miniature
6 > 6 [video]="video" [user]="getUser()" [displayAsRow]="false"
7 </my-video-miniature> 7 [displayVideoActions]="false" [displayOptions]="displayOptions"
8 >
9 </my-video-miniature>
10 </div>
11
12 </div>
8</div> 13</div>
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss
index 6b7274480..5a9a926fe 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss
@@ -1,10 +1,7 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3@import '_miniature';
3 4
4my-video-miniature { 5.root {
5 @include margin-right(15px); 6 @include grid-videos-miniature-layout;
6
7 display: inline-block;
8 min-width: $video-thumbnail-width;
9 max-width: $video-thumbnail-width;
10} 7}
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
index fe084afd9..d4402dd9f 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
@@ -20,6 +20,7 @@ export class VideosListMarkupComponent implements OnInit {
20 @Input() count: number 20 @Input() count: number
21 @Input() onlyDisplayTitle: boolean 21 @Input() onlyDisplayTitle: boolean
22 @Input() filter: VideoFilter 22 @Input() filter: VideoFilter
23 @Input() maxRows: number
23 24
24 videos: Video[] 25 videos: Video[]
25 26
@@ -43,6 +44,16 @@ export class VideosListMarkupComponent implements OnInit {
43 return this.auth.getUser() 44 return this.auth.getUser()
44 } 45 }
45 46
47 limitRowsStyle () {
48 if (this.maxRows <= 0) return {}
49
50 return {
51 'grid-template-rows': `repeat(${this.maxRows}, 1fr)`,
52 'grid-auto-rows': '0', // Set height to 0 for autogenerated grid rows
53 'overflow-y': 'hidden' // Hide grid items that overflow
54 }
55 }
56
46 ngOnInit () { 57 ngOnInit () {
47 if (this.onlyDisplayTitle) { 58 if (this.onlyDisplayTitle) {
48 for (const key of Object.keys(this.displayOptions)) { 59 for (const key of Object.keys(this.displayOptions)) {
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
index dd9ab18a8..c8dda2900 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.scss
@@ -51,7 +51,7 @@ $icon-size: 16px;
51} 51}
52 52
53.margin-content { 53.margin-content {
54 @include grid-videos-miniature-layout; 54 @include grid-videos-miniature-layout-with-margins;
55} 55}
56 56
57.display-as-row.videos { 57.display-as-row.videos {