+
diff --git a/client/src/app/app.component.scss b/client/src/app/app.component.scss
index e02c2d5b0..1a9a196ff 100644
--- a/client/src/app/app.component.scss
+++ b/client/src/app/app.component.scss
@@ -8,7 +8,7 @@ menu {
margin-right: 20px;
border-right: 1px solid rgba(0, 0, 0, 0.2);
- .panel_button {
+ .panel-button {
margin: 8px;
cursor: pointer;
transition: margin 0.2s;
@@ -27,6 +27,6 @@ menu {
}
}
-.panel_block:not(:last-child) {
+.panel-block:not(:last-child) {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 81b700a21..2a1486fb2 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { HTTP_PROVIDERS } from '@angular/http';
-import { RouteConfig, Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS } from '@angular/router-deprecated';
+import { Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Routes } from '@angular/router';
import { FriendService } from './friends';
import { LoginComponent } from './login';
@@ -16,27 +16,23 @@ import {
VideoWatchComponent,
VideoService
} from './videos';
+import { SearchService } from './shared'; // Temporary
-@RouteConfig([
+@Routes([
{
path: '/users/login',
- name: 'UserLogin',
component: LoginComponent
},
{
path: '/videos/list',
- name: 'VideosList',
- component: VideoListComponent,
- useAsDefault: true
+ component: VideoListComponent
},
{
path: '/videos/watch/:id',
- name: 'VideosWatch',
component: VideoWatchComponent
},
{
path: '/videos/add',
- name: 'VideosAdd',
component: VideoAddComponent
}
])
@@ -46,7 +42,7 @@ import {
template: require('./app.component.html'),
styles: [ require('./app.component.scss') ],
directives: [ ROUTER_DIRECTIVES, SearchComponent ],
- providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService ]
+ providers: [ AuthService, FriendService, HTTP_PROVIDERS, ROUTER_PROVIDERS, VideoService, SearchService ]
})
export class AppComponent {
@@ -75,12 +71,13 @@ export class AppComponent {
field: search.field,
search: search.value
};
- this.router.navigate(['VideosList', params]);
+ this.router.navigate(['/videos/list', params]);
} else {
- this.router.navigate(['VideosList']);
+ this.router.navigate(['/videos/list']);
}
}
+ // FIXME
logout() {
// this._authService.logout();
}
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 768594ac4..bcfa021fa 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
-import { Router } from '@angular/router-deprecated';
+import { Router } from '@angular/router';
import { AuthService, AuthStatus, User } from '../shared';
@@ -26,7 +26,7 @@ export class LoginComponent {
this.authService.setStatus(AuthStatus.LoggedIn);
- this.router.navigate(['VideosList']);
+ this.router.navigate(['/videos/list']);
},
error => {
if (error.error === 'invalid_grant') {
diff --git a/client/src/app/shared/search/index.ts b/client/src/app/shared/search/index.ts
index a49a4f1a9..a897ed099 100644
--- a/client/src/app/shared/search/index.ts
+++ b/client/src/app/shared/search/index.ts
@@ -1,3 +1,4 @@
export * from './search-field.type';
export * from './search.component';
export * from './search.model';
+export * from './search.service';
diff --git a/client/src/app/shared/search/search.component.ts b/client/src/app/shared/search/search.component.ts
index c14c2d99c..ed1ce807a 100644
--- a/client/src/app/shared/search/search.component.ts
+++ b/client/src/app/shared/search/search.component.ts
@@ -1,9 +1,10 @@
-import { Component, EventEmitter, Output } from '@angular/core';
+import { Component, EventEmitter, Output, OnInit } from '@angular/core';
import { DROPDOWN_DIRECTIVES} from 'ng2-bootstrap/components/dropdown';
import { Search } from './search.model';
import { SearchField } from './search-field.type';
+import { SearchService } from './search.service'; // Temporary
@Component({
selector: 'my-search',
@@ -11,7 +12,7 @@ import { SearchField } from './search-field.type';
directives: [ DROPDOWN_DIRECTIVES ]
})
-export class SearchComponent {
+export class SearchComponent implements OnInit {
@Output() search = new EventEmitter
();
fieldChoices = {
@@ -26,6 +27,21 @@ export class SearchComponent {
value: ''
};
+ constructor(private searchService: SearchService) {}
+
+ ngOnInit() {
+ this.searchService.searchChanged.subscribe(
+ newSearchCriterias => {
+ // Put a field by default
+ if (!newSearchCriterias.field) {
+ newSearchCriterias.field = 'name';
+ }
+
+ this.searchCriterias = newSearchCriterias;
+ }
+ );
+ }
+
get choiceKeys() {
return Object.keys(this.fieldChoices);
}
@@ -35,6 +51,7 @@ export class SearchComponent {
$event.stopPropagation();
this.searchCriterias.field = choice;
+ this.doSearch();
}
doSearch() {
diff --git a/client/src/app/shared/search/search.service.ts b/client/src/app/shared/search/search.service.ts
new file mode 100644
index 000000000..787c02d2b
--- /dev/null
+++ b/client/src/app/shared/search/search.service.ts
@@ -0,0 +1,15 @@
+import { Injectable } from '@angular/core';
+import { Subject } from 'rxjs/Subject';
+
+import { Search } from './search.model';
+
+// This class is needed to communicate between videos/list and search component
+// Remove it when we'll be able to subscribe to router changes
+@Injectable()
+export class SearchService {
+ searchChanged: Subject;
+
+ constructor() {
+ this.searchChanged = new Subject();
+ }
+}
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 614403d79..65417f751 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -9,6 +9,7 @@ export class Video {
magnetUri: string;
name: string;
podUrl: string;
+ tags: string[];
thumbnailPath: string;
private static createByString(author: string, podUrl: string) {
@@ -42,6 +43,7 @@ export class Video {
magnetUri: string,
name: string,
podUrl: string,
+ tags: string[],
thumbnailPath: string
}) {
this.author = hash.author;
@@ -53,6 +55,7 @@ export class Video {
this.magnetUri = hash.magnetUri;
this.name = hash.name;
this.podUrl = hash.podUrl;
+ this.tags = hash.tags;
this.thumbnailPath = hash.thumbnailPath;
this.by = Video.createByString(hash.author, hash.podUrl);
diff --git a/client/src/app/videos/video-add/video-add.component.html b/client/src/app/videos/video-add/video-add.component.html
index 6b2eb9377..bcd78c7cb 100644
--- a/client/src/app/videos/video-add/video-add.component.html
+++ b/client/src/app/videos/video-add/video-add.component.html
@@ -21,12 +21,12 @@
ngControl="tags" #tags="ngForm" [disabled]="isTagsInputDisabled" (keyup)="onTagKeyPress($event)" [(ngModel)]="currentTag"
>
- A tag should be between 2 and 10 characters long
+ A tag should be between 2 and 10 characters (alphanumeric) long