aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-31 17:32:35 +0200
committerChocobozzz <me@florianbigard.com>2018-08-31 17:43:39 +0200
commit4b54f1360ebb5b1aeb70544981f2721e9a03f0bb (patch)
treeff54ca875a4bb22a361a7a8befceb3eb80424114
parent9a629c6efbe39dfac290347670ca41b0d7100f41 (diff)
downloadPeerTube-4b54f1360ebb5b1aeb70544981f2721e9a03f0bb.tar.gz
PeerTube-4b54f1360ebb5b1aeb70544981f2721e9a03f0bb.tar.zst
PeerTube-4b54f1360ebb5b1aeb70544981f2721e9a03f0bb.zip
Fix videos overview tags section
-rw-r--r--client/src/app/menu/menu.component.scss8
-rw-r--r--client/src/app/videos/video-list/video-overview.component.html4
-rw-r--r--server/models/utils.ts13
3 files changed, 14 insertions, 11 deletions
diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss
index 8539c0e56..f8c7d8519 100644
--- a/client/src/app/menu/menu.component.scss
+++ b/client/src/app/menu/menu.component.scss
@@ -137,7 +137,7 @@ menu {
137 137
138 &.icon-videos-subscriptions { 138 &.icon-videos-subscriptions {
139 position: relative; 139 position: relative;
140 top: -2px; 140 top: -1px;
141 background-image: url('../../assets/images/menu/subscriptions.svg'); 141 background-image: url('../../assets/images/menu/subscriptions.svg');
142 } 142 }
143 143
@@ -148,23 +148,23 @@ menu {
148 148
149 &.icon-videos-trending { 149 &.icon-videos-trending {
150 position: relative; 150 position: relative;
151 top: -2px; 151 top: -1px;
152 background-image: url('../../assets/images/menu/trending.svg'); 152 background-image: url('../../assets/images/menu/trending.svg');
153 } 153 }
154 154
155 &.icon-videos-recently-added { 155 &.icon-videos-recently-added {
156 width: 23px; 156 width: 23px;
157 height: 23px; 157 height: 23px;
158 position: relative;
159 top: -1px;
160 background-image: url('../../assets/images/menu/recently-added.svg'); 158 background-image: url('../../assets/images/menu/recently-added.svg');
161 } 159 }
162 160
163 &.icon-videos-local { 161 &.icon-videos-local {
164 width: 23px; 162 width: 23px;
165 height: 23px; 163 height: 23px;
164
166 position: relative; 165 position: relative;
167 top: -1px; 166 top: -1px;
167
168 background-image: url('../../assets/images/menu/home.svg'); 168 background-image: url('../../assets/images/menu/home.svg');
169 } 169 }
170 170
diff --git a/client/src/app/videos/video-list/video-overview.component.html b/client/src/app/videos/video-list/video-overview.component.html
index 84a4c70ee..be9db3d90 100644
--- a/client/src/app/videos/video-list/video-overview.component.html
+++ b/client/src/app/videos/video-list/video-overview.component.html
@@ -4,7 +4,7 @@
4 4
5 <div class="section" *ngFor="let object of overview.categories"> 5 <div class="section" *ngFor="let object of overview.categories">
6 <div class="section-title" i18n> 6 <div class="section-title" i18n>
7 <a routerLink="/search" [queryParams]="{ categoryOneOf: [ object.category.id ] }">Category {{ object.category.label }}</a> 7 <a routerLink="/search" [queryParams]="{ categoryOneOf: [ object.category.id ] }">{{ object.category.label }}</a>
8 </div> 8 </div>
9 9
10 <div> 10 <div>
@@ -14,7 +14,7 @@
14 14
15 <div class="section" *ngFor="let object of overview.tags"> 15 <div class="section" *ngFor="let object of overview.tags">
16 <div class="section-title" i18n> 16 <div class="section-title" i18n>
17 <a routerLink="/search" [queryParams]="{ categoryOneOf: [ object.category.id ] }">Tag {{ object.tag }}</a> 17 <a routerLink="/search" [queryParams]="{ tagOneOf: [ object.tag ] }">{{ object.tag }}</a>
18 </div> 18 </div>
19 19
20 <div> 20 <div>
diff --git a/server/models/utils.ts b/server/models/utils.ts
index edb8e1161..e0bf091ad 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -4,7 +4,11 @@ type SortType = { sortModel: any, sortValue: string }
4 4
5// Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ] 5// Translate for example "-name" to [ [ 'name', 'DESC' ], [ 'id', 'ASC' ] ]
6function getSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) { 6function getSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) {
7 const { direction, field } = buildDirectionAndField(value) 7 let { direction, field } = buildDirectionAndField(value)
8
9 if (field.toLowerCase() === 'match') { // Search
10 field = Sequelize.col('similarity')
11 }
8 12
9 return [ [ field, direction ], lastSort ] 13 return [ [ field, direction ], lastSort ]
10} 14}
@@ -13,10 +17,9 @@ function getVideoSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) {
13 let { direction, field } = buildDirectionAndField(value) 17 let { direction, field } = buildDirectionAndField(value)
14 18
15 // Alias 19 // Alias
16 if (field.toLowerCase() === 'match') field = Sequelize.col('similarity') 20 if (field.toLowerCase() === 'match') { // Search
17 21 field = Sequelize.col('similarity')
18 // Sort by aggregation 22 } else if (field.toLowerCase() === 'trending') { // Sort by aggregation
19 if (field.toLowerCase() === 'trending') {
20 return [ 23 return [
21 [ Sequelize.fn('COALESCE', Sequelize.fn('SUM', Sequelize.col('VideoViews.views')), '0'), direction ], 24 [ Sequelize.fn('COALESCE', Sequelize.fn('SUM', Sequelize.col('VideoViews.views')), '0'), direction ],
22 25