Client: little refractoring

This commit is contained in:
Chocobozzz 2017-05-05 16:08:43 +02:00
parent c24ac1c18e
commit 1f0215a908
23 changed files with 58 additions and 104 deletions

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
@Component({
template: '<router-outlet></router-outlet>'
template: '<router-outlet></router-outlet>'
})
export class FriendsComponent {

View File

@ -6,7 +6,6 @@ import { AuthHttp, RestExtractor, RestDataSource, User } from '../../../shared';
@Injectable()
export class UserService {
// TODO: merge this constant with account
private static BASE_USERS_URL = '/api/v1/users/';
constructor(

View File

@ -1,7 +1,3 @@
.glyphicon-remove {
cursor: pointer;
}
.add-user {
margin-top: 10px;
}

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
@Component({
template: '<router-outlet></router-outlet>'
template: '<router-outlet></router-outlet>'
})
export class UsersComponent {

View File

@ -6,32 +6,32 @@ import { UserListComponent } from './user-list';
export const UsersRoutes: Routes = [
{
path: 'users',
component: UsersComponent,
children: [
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
},
{
path: 'list',
component: UserListComponent,
data: {
meta: {
title: 'Users list'
}
}
},
{
path: 'add',
component: UserAddComponent,
data: {
meta: {
title: 'Add a user'
}
path: 'users',
component: UsersComponent,
children: [
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
},
{
path: 'list',
component: UserListComponent,
data: {
meta: {
title: 'Users list'
}
}
]
}
},
{
path: 'add',
component: UserAddComponent,
data: {
meta: {
title: 'Add a user'
}
}
}
]
}
];

View File

@ -1,7 +0,0 @@
.cell-id {
width: 40px;
}
.cell-reason {
width: 200px;
}

View File

@ -6,8 +6,7 @@ import { Utils, VideoAbuseService, VideoAbuse } from '../../../shared';
@Component({
selector: 'my-video-abuse-list',
templateUrl: './video-abuse-list.component.html',
styleUrls: [ './video-abuse-list.component.scss' ]
templateUrl: './video-abuse-list.component.html'
})
export class VideoAbuseListComponent {
videoAbusesSource = null;

View File

@ -5,24 +5,24 @@ import { VideoAbuseListComponent } from './video-abuse-list';
export const VideoAbusesRoutes: Routes = [
{
path: 'video-abuses',
component: VideoAbusesComponent
,
children: [
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
},
{
path: 'list',
component: VideoAbuseListComponent,
data: {
meta: {
title: 'Video abuses list'
}
path: 'video-abuses',
component: VideoAbusesComponent
,
children: [
{
path: '',
redirectTo: 'list',
pathMatch: 'full'
},
{
path: 'list',
component: VideoAbuseListComponent,
data: {
meta: {
title: 'Video abuses list'
}
}
]
}
}
]
}
];

View File

@ -1,5 +1,4 @@
<menu>
<div class="panel-block">
<a routerLink="/admin/users/list" routerLinkActive="active">
<span class="hidden-xs glyphicon glyphicon-user"></span>

View File

@ -1,4 +1,3 @@
export * from './loader';
export * from './sort-field.type';
export * from './rate-type.type';
export * from './video.model';

View File

@ -1 +0,0 @@
export * from './loader.component';

View File

@ -1,3 +1,4 @@
export * from './loader.component';
export * from './video-list.component';
export * from './video-miniature.component';
export * from './video-sort.component';

View File

@ -23,19 +23,6 @@
my-video-miniature {
text-align: left;
transition: all 0.5s ease;
&.ng-enter {
opacity: 0;
}
&.ng-enter-active {
opacity: 1;
}
&.ng-leave {
opacity: 0;
}
}
.no-video {

View File

@ -76,10 +76,7 @@ export class VideoListComponent implements OnInit, OnDestroy {
this.loading.next(true);
this.videos = [];
this.changeDetector.detectChanges();
let observable = null;
if (this.search.value) {
observable = this.videoService.searchVideos(this.search, this.pagination, this.sort);
} else {
@ -150,8 +147,6 @@ export class VideoListComponent implements OnInit, OnDestroy {
} else {
this.pagination.currentPage = 1;
}
this.changeDetector.detectChanges();
}
private navigateToNewParams() {

View File

@ -1,4 +1,4 @@
<div class="video-miniature" (mouseenter)="onHover()" (mouseleave)="onBlur()">
<div class="video-miniature">
<a
[routerLink]="['/videos/watch', video.id]" [attr.title]="video.description"
class="video-miniature-thumbnail"

View File

@ -1,5 +1,3 @@
@import "../../../sass/pre-customizations.scss";
.video-miniature {
margin-top: 30px;
display: inline-block;
@ -71,7 +69,7 @@
}
.video-miniature-tags {
// Fix for chrome when tags a long
// Fix for chrome when tags are long
width: 201px;
.video-miniature-tag {
@ -81,7 +79,6 @@
top: -2px;
.label {
line-height: $line-height-base;
transition: background-color 0.2s;
}
}

View File

@ -17,8 +17,6 @@ export class VideoMiniatureComponent {
@Input() user: User;
@Input() video: Video;
hovering = false;
constructor(
private notificationsService: NotificationsService,
private confirmService: ConfirmService,
@ -33,14 +31,6 @@ export class VideoMiniatureComponent {
return this.video.name;
}
onBlur() {
this.hovering = false;
}
onHover() {
this.hovering = true;
}
isVideoNSFWForThisUser() {
return this.video.isVideoNSFWForUser(this.user);
}

View File

@ -22,12 +22,14 @@
<div *ngIf="videoNotFound" id="video-not-found">Video not found :'(</div>
</div>
<!-- P2P informations -->
<div id="torrent-info" class="row">
<div id="torrent-info-download" class="col-md-4 col-sm-4 col-xs-4">Download: {{ downloadSpeed | bytes }}/s</div>
<div id="torrent-info-upload" class="col-md-4 col-sm-4 col-xs-4">Upload: {{ uploadSpeed | bytes }}/s</div>
<div id="torrent-info-peers" class="col-md-4 col-sm-4 col-xs-4">Number of peers: {{ numPeers }}</div>
</div>
<!-- Video informations -->
<div *ngIf="video !== null" id="video-info">
<div class="row video-name-views">
<div class="col-xs-8 col-md-8 video-name">

View File

@ -13,6 +13,10 @@
.embed-responsive {
height: 500px;
@media screen and (max-width: 600px) {
height: 300px;
}
}
#torrent-info {
@ -25,12 +29,6 @@
}
}
.embed-responsive {
@media screen and (max-width: 600px) {
height: 300px;
}
}
#video-info {
.video-name-views {
font-weight: bold;

View File

@ -5,7 +5,7 @@ import { TagInputModule } from 'ng2-tag-input';
import { VideosRoutingModule } from './videos-routing.module';
import { VideosComponent } from './videos.component';
import { VideoAddComponent, VideoUpdateComponent } from './video-edit';
import { VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list';
import { LoaderComponent, VideoListComponent, VideoMiniatureComponent, VideoSortComponent } from './video-list';
import {
VideoWatchComponent,
VideoMagnetComponent,
@ -13,7 +13,7 @@ import {
VideoShareComponent,
WebTorrentService
} from './video-watch';
import { LoaderComponent, VideoService } from './shared';
import { VideoService } from './shared';
import { SharedModule } from '../shared';
@NgModule({