diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-06 14:43:32 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-06 14:43:32 +0200 |
| commit | 1f008dfc777022582e5e0cf0823175e66c2790cf (patch) | |
| tree | d6564e3aa209a7f9a1600bed4ae4187c587945ab /src/app | |
| parent | d8ffe52b67e983b9b317b2e5dcb138ac996eaa31 (diff) | |
| download | DevHive-Angular-1f008dfc777022582e5e0cf0823175e66c2790cf.tar DevHive-Angular-1f008dfc777022582e5e0cf0823175e66c2790cf.tar.gz DevHive-Angular-1f008dfc777022582e5e0cf0823175e66c2790cf.zip | |
starting development of rating system
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/components/post/post.component.css | 5 | ||||
| -rw-r--r-- | src/app/components/post/post.component.html | 2 | ||||
| -rw-r--r-- | src/app/components/post/post.component.ts | 7 | ||||
| -rw-r--r-- | src/app/services/rating.service.ts | 17 |
4 files changed, 24 insertions, 7 deletions
diff --git a/src/app/components/post/post.component.css b/src/app/components/post/post.component.css index 1b88c7d..07d931f 100644 --- a/src/app/components/post/post.component.css +++ b/src/app/components/post/post.component.css @@ -76,11 +76,6 @@ hr { /* Rating */ -/* Temporary, until ratings are implemented fully */ -.rating { - display: none !important; -} - .rating { display: flex; flex-direction: column; diff --git a/src/app/components/post/post.component.html b/src/app/components/post/post.component.html index 4ba4d43..4584591 100644 --- a/src/app/components/post/post.component.html +++ b/src/app/components/post/post.component.html @@ -30,7 +30,7 @@ </div> </section> <section class="rating"> - <button class="vote"> + <button class="vote" (click)="upVotePost()"> ᐃ </button> <summary class="score"> diff --git a/src/app/components/post/post.component.ts b/src/app/components/post/post.component.ts index 387f56f..39391ad 100644 --- a/src/app/components/post/post.component.ts +++ b/src/app/components/post/post.component.ts @@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { Guid } from 'guid-typescript'; import { PostService } from 'src/app/services/post.service'; +import { RatingService } from 'src/app/services/rating.service'; import { UserService } from 'src/app/services/user.service'; import { User } from 'src/models/identity/user'; import { Post } from 'src/models/post'; @@ -19,7 +20,7 @@ export class PostComponent implements OnInit { public timeCreated: string; @Input() paramId: string; - constructor(private _postService: PostService, private _userService: UserService, private _router: Router) + constructor(private _postService: PostService, private _ratingServe: RatingService, private _userService: UserService, private _router: Router) { } ngOnInit(): void { @@ -54,4 +55,8 @@ export class PostComponent implements OnInit { goToPostPage(): void { this._router.navigate(['/post/' + this.post.postId]); } + + upVotePost(): void { + + } } diff --git a/src/app/services/rating.service.ts b/src/app/services/rating.service.ts new file mode 100644 index 0000000..630a43c --- /dev/null +++ b/src/app/services/rating.service.ts @@ -0,0 +1,17 @@ +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import * as FormData from 'form-data'; +import { Guid } from 'guid-typescript'; +import { Observable } from 'rxjs'; +import { Post } from 'src/models/post'; +import { AppConstants } from '../app-constants.module'; +import { TokenService } from './token.service'; + + +@Injectable({ + providedIn: 'root' +}) +export class RatingService { + constructor(private _http: HttpClient, private _tokenService: TokenService) + { } +} |
