diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2a390dc..3156263 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -3,13 +3,17 @@ import { Routes, RouterModule } from '@angular/router'; import { AuthGuard, AuthUpdateGuard, AuthenticatedGuard, AnonymousGuard } from './auth/auth.guard'; import { PageBookmarks } from './pages/bookmarks/bookmarks.page'; +import { PageComment } from './pages/comment/comment.page'; import { PageEntry } from './pages/entry/entry.page'; import { PageLogin } from './pages/login/login.page'; import { PageNew } from './pages/new/new.page'; -import { PageNotFound} from './pages/notfound/notfound.page'; +import { PageNotFound } from './pages/notfound/notfound.page'; import { PageSettings } from './pages/settings/settings.page'; import { PageSubmission } from './pages/submission/submission.page'; import { PageTop } from './pages/top/top.page'; +import { PageUser } from './pages/user/user.page'; +import { PageUserComments } from './pages/user/usercomments/usercomments.page'; +import { PageUserEntries } from './pages/user/userentries/userentries.page'; import { UiMain } from './ui/main/main.ui'; @@ -17,7 +21,11 @@ const routes: Routes = [ { path: '', component: UiMain, children: [ { path: '', component: PageTop, canActivate: [ AuthenticatedGuard ] }, + { path: 'c/:id', component: PageComment, canActivate: [ AuthenticatedGuard ] }, { path: 'e/:id', component: PageEntry, canActivate: [ AuthenticatedGuard ] }, + { path: 'u/:username', component: PageUser, canActivate: [ AuthenticatedGuard ] }, + { path: 'u/c/:username', component: PageUserComments, canActivate: [ AuthenticatedGuard ] }, + { path: 'u/e/:username', component: PageUserEntries, canActivate: [ AuthenticatedGuard ] }, { path: 'new', component: PageNew, canActivate: [ AuthenticatedGuard ] }, { path: 'bookmarks', component: PageBookmarks, canActivate: [ AuthenticatedGuard ] }, { path: 'submit', component: PageSubmission, canActivate: [ AuthenticatedGuard ] }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 536b73b..fb10c6f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,6 +17,7 @@ import { I18nPipe } from './utils/i18n.pipe'; import { MomentPipe } from './utils/moment.pipe'; import { AppComponent } from './app.component'; import { PageBookmarks } from './pages/bookmarks/bookmarks.page'; +import { PageComment } from './pages/comment/comment.page'; import { PageEntry } from './pages/entry/entry.page'; import { PageLogin } from './pages/login/login.page'; import { PageNew } from './pages/new/new.page'; @@ -25,6 +26,9 @@ import { PageSettings } from './pages/settings/settings.page'; import { PageSubmission } from './pages/submission/submission.page'; import { PageTop } from './pages/top/top.page'; import { PageUnavailable } from './pages/unavailable/unavailable.page' +import { PageUser } from './pages/user/user.page'; +import { PageUserComments } from './pages/user/usercomments/usercomments.page'; +import { PageUserEntries } from './pages/user/userentries/userentries.page'; import { UiComment } from './ui/comment/comment.ui'; import { UiCommentCount } from './ui/commentcount/commentcount.ui'; import { UiCommentForm } from './ui/commentform/commentform.ui'; @@ -74,6 +78,7 @@ export class XhrInterceptor implements HttpInterceptor { MomentPipe, AppComponent, PageBookmarks, + PageComment, PageEntry, PageLogin, PageNew, @@ -82,6 +87,7 @@ export class XhrInterceptor implements HttpInterceptor { PageSubmission, PageTop, PageUnavailable, + PageUser, PageUserComments, PageUserEntries, UiComment, UiCommentCount, UiCommentForm, diff --git a/src/app/pages/comment/comment.page.html b/src/app/pages/comment/comment.page.html new file mode 100644 index 0000000..02a4cae --- /dev/null +++ b/src/app/pages/comment/comment.page.html @@ -0,0 +1,6 @@ +
+ + + + +
\ No newline at end of file diff --git a/src/app/pages/comment/comment.page.scss b/src/app/pages/comment/comment.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/comment/comment.page.ts b/src/app/pages/comment/comment.page.ts new file mode 100644 index 0000000..f909cbc --- /dev/null +++ b/src/app/pages/comment/comment.page.ts @@ -0,0 +1,39 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; + +import { ActivatedRoute } from '@angular/router'; + +import { CommentService } from '../../services/comment.service'; +import { UiComments } from '../../ui/comments/comments.ui'; + +@Component({ + selector: 'page-comment', + templateUrl: './comment.page.html', + styleUrls: [ './comment.page.scss' ] +}) +export class PageComment implements OnInit { + + id: number; + comment: any; + notfound: boolean = false; + + constructor(private commentService: CommentService, + private route: ActivatedRoute) { } + + ngOnInit(): void { + this.id = +this.route.snapshot.paramMap.get('id'); + this.refresh(); + } + + refresh() { + this.commentService.getComment(this.id).subscribe((data) => { + this.comment = data; + }, (error) => { + if (error.status == 404) { + this.notfound = true; + } + }) + } + + + +} diff --git a/src/app/pages/new/new.page.ts b/src/app/pages/new/new.page.ts index 1b08710..d40b768 100644 --- a/src/app/pages/new/new.page.ts +++ b/src/app/pages/new/new.page.ts @@ -1,7 +1,9 @@ import { Component, OnInit } from '@angular/core'; -import { EntriesService } from '../../services/entries.service'; +import { Router, ActivatedRoute } from '@angular/router'; import { PageEvent } from '@angular/material/paginator'; +import { EntriesService } from '../../services/entries.service'; + @Component({ selector: 'page-new', templateUrl: './new.page.html' @@ -11,31 +13,66 @@ export class PageNew implements OnInit { entries: any; boundRefresh: Function; boundUpdate: Function; + init: boolean = true; - constructor(private entriesService: EntriesService) { } + constructor(private entriesService: EntriesService, private router: Router, private route: ActivatedRoute) { } ngOnInit(): void { - this.refresh(); this.boundRefresh = this.refresh.bind(this); this.boundUpdate = this.update.bind(this); + this.route.queryParams.subscribe(params => { + if (this.init) { + this.entries = {}; + if (params[ 'p' ]) { + this.entries.number = +params[ 'p' ] - 1; + if (this.entries.number < 0) { + this.entries.number = 0; + } + } + + if (params[ 's' ]) { + this.entries.size = +params[ 's' ]; + } + + this.refresh(); + this.init = false; + } + }); } refresh(): void { if (!this.entries) { - this.entriesService.getNew().subscribe((data) => { - this.entries = data; - }) - } else { - this.entries.content = null; - this.entriesService.getNewPages(this.entries.number || 0, this.entries.size || 10).subscribe((data: any) => { - this.entries = data; - }, (error) => { }) + this.entries = {}; } + + this.entries.content = null; + this.entriesService.getNew(this.entries.number || 0, this.entries.size || 30).subscribe((data: any) => { + this.entries = data; + }, (error) => { }) + } update(event: PageEvent) { this.entries.content = null; - this.entriesService.getNewPages(event.pageIndex, event.pageSize).subscribe((data: any) => { + const params: any = { p: null, s: null }; + + if (event.pageIndex != 0) { + params.p = event.pageIndex + 1; + } + + if (event.pageSize != 30) { + params.s = event.pageSize; + } + + this.router.navigate( + [], + { + relativeTo: this.route, + queryParams: params, + queryParamsHandling: 'merge' + }); + + this.entriesService.getNew(event.pageIndex, event.pageSize).subscribe((data: any) => { this.entries = data; }, (error) => { }) } diff --git a/src/app/pages/top/top.page.ts b/src/app/pages/top/top.page.ts index 97e8fb8..4ca638c 100644 --- a/src/app/pages/top/top.page.ts +++ b/src/app/pages/top/top.page.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Input } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; @@ -11,8 +11,7 @@ import { PageEvent } from '@angular/material/paginator'; }) export class PageTop implements OnInit { - - @Input() entries: any; + entries: any; boundRefresh: Function; boundUpdate: Function; init: boolean = true; @@ -48,7 +47,7 @@ export class PageTop implements OnInit { } this.entries.content = null; - this.entriesService.getPages(this.entries.number || 0, this.entries.size || 30).subscribe((data: any) => { + this.entriesService.getRanked(this.entries.number || 0, this.entries.size || 30).subscribe((data: any) => { this.entries = data; }, (error) => { }) @@ -74,7 +73,7 @@ export class PageTop implements OnInit { queryParamsHandling: 'merge' }); - this.entriesService.getPages(event.pageIndex, event.pageSize).subscribe((data: any) => { + this.entriesService.getRanked(event.pageIndex, event.pageSize).subscribe((data: any) => { this.entries = data; }, (error) => { }) } diff --git a/src/app/pages/user/user.page.html b/src/app/pages/user/user.page.html new file mode 100644 index 0000000..7436bfa --- /dev/null +++ b/src/app/pages/user/user.page.html @@ -0,0 +1,27 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + +
{{'user.username' | i18n}}{{user.username}}
{{'user.points' | i18n}}{{user.metadata && user.metadata.points || 0}}
{{'user.about' | i18n}}

{{user.about}}

{{'user.entries' | i18n}}
{{'user.comments' | i18n}}
+
+
\ No newline at end of file diff --git a/src/app/pages/user/user.page.scss b/src/app/pages/user/user.page.scss new file mode 100644 index 0000000..6bbbb5b --- /dev/null +++ b/src/app/pages/user/user.page.scss @@ -0,0 +1,23 @@ +.text { + max-width: 100%; + white-space: break-spaces; + word-break: break-all; +} + + +table { + margin-left: 15px; + margin-bottom: 15px; + + @media screen and (min-width: 576px) { + max-width: 100%; + } + + @media screen and (min-width: 768px) { + max-width: 80%; + } + + @media screen and (min-width: 992px) { + max-width: 50%; + } +} \ No newline at end of file diff --git a/src/app/pages/user/user.page.ts b/src/app/pages/user/user.page.ts new file mode 100644 index 0000000..c2432ac --- /dev/null +++ b/src/app/pages/user/user.page.ts @@ -0,0 +1,35 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; + +import { ActivatedRoute } from '@angular/router'; + + +import { UserService } from '../../services/user.service'; + +@Component({ + selector: 'page-user', + templateUrl: './user.page.html', + styleUrls: [ './user.page.scss' ] +}) +export class PageUser implements OnInit { + + notfound: boolean = false; + username: string; + user: any; + + constructor(private userService: UserService, + private route: ActivatedRoute) { } + + ngOnInit(): void { + this.username = this.route.snapshot.paramMap.get('username'); + this.userService.getUser(this.username).subscribe((data) => { + this.user = data; + }, (error) => { + if (error.status == 404) { + this.notfound = true; + } + }) + } + + + +} diff --git a/src/app/pages/user/usercomments/usercomments.page.html b/src/app/pages/user/usercomments/usercomments.page.html new file mode 100644 index 0000000..da422a0 --- /dev/null +++ b/src/app/pages/user/usercomments/usercomments.page.html @@ -0,0 +1,30 @@ +
+
+ + +
+
+ + {{comment.created + | datef}} + {{'comment.author' | i18n}}{{comment.author}} + +
+
+ {{comment.text}}
+ +
+ + {{'comment.delete' | i18n}} + +
+
+
+ + + {{ (parent ? 'comments.subcomments.showMore' : + 'comments.showMore') | i18n}} + +
+
\ No newline at end of file diff --git a/src/app/pages/user/usercomments/usercomments.page.ts b/src/app/pages/user/usercomments/usercomments.page.ts new file mode 100644 index 0000000..490f9b4 --- /dev/null +++ b/src/app/pages/user/usercomments/usercomments.page.ts @@ -0,0 +1,37 @@ +import { Component, OnInit, Input } from '@angular/core'; + +import { Router, ActivatedRoute } from '@angular/router'; + +import { CommentService } from '../../../services/comment.service'; +import { PageEvent } from '@angular/material/paginator'; + +@Component({ + selector: 'page-usercomments', + templateUrl: './usercomments.page.html' +}) +export class PageUserComments implements OnInit { + + username: string; + comments: any = {}; + init: boolean = true; + + constructor(private commentService: CommentService, private router: Router, private route: ActivatedRoute) { } + + ngOnInit(): void { + this.username = this.route.snapshot.paramMap.get('username'); + this.commentService.getByUser(this.username, this.comments.number || 0, this.comments.size || 30).subscribe((data: any) => { + this.comments = data; + }, (error) => { }) + } + + showMore() { + const oldContent: any[] = this.comments.content; + this.commentService.getByUser(this.username, this.comments.number + 1, this.comments.size).subscribe((data) => { + this.comments = data; + for (let comment of this.comments.content) { + oldContent.push(comment); + } + this.comments.content = oldContent; + }) + } +} diff --git a/src/app/pages/user/userentries/userentries.page.html b/src/app/pages/user/userentries/userentries.page.html new file mode 100644 index 0000000..24cc006 --- /dev/null +++ b/src/app/pages/user/userentries/userentries.page.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/pages/user/userentries/userentries.page.ts b/src/app/pages/user/userentries/userentries.page.ts new file mode 100644 index 0000000..bc33488 --- /dev/null +++ b/src/app/pages/user/userentries/userentries.page.ts @@ -0,0 +1,83 @@ +import { Component, OnInit } from '@angular/core'; + +import { Router, ActivatedRoute } from '@angular/router'; + +import { EntriesService } from '../../../services/entries.service'; +import { PageEvent } from '@angular/material/paginator'; + +@Component({ + selector: 'page-userentries', + templateUrl: './userentries.page.html' +}) +export class PageUserEntries implements OnInit { + + username : string; + entries: any; + boundRefresh: Function; + boundUpdate: Function; + init: boolean = true; + + constructor(private entriesService: EntriesService, private router: Router, private route: ActivatedRoute) { } + + ngOnInit(): void { + this.username = this.route.snapshot.paramMap.get('username'); + this.boundRefresh = this.refresh.bind(this); + this.boundUpdate = this.update.bind(this); + this.route.queryParams.subscribe(params => { + if (this.init) { + this.entries = {}; + if (params[ 'p' ]) { + this.entries.number = +params[ 'p' ] - 1; + if (this.entries.number < 0) { + this.entries.number = 0; + } + } + + if (params[ 's' ]) { + this.entries.size = +params[ 's' ]; + } + + this.refresh(); + this.init = false; + } + }); + } + + refresh(): void { + if (!this.entries) { + this.entries = {}; + } + + this.entries.content = null; + this.entriesService.getByUser(this.username, this.entries.number || 0, this.entries.size || 30).subscribe((data: any) => { + this.entries = data; + }, (error) => { }) + + } + + update(event: PageEvent) { + this.entries.content = null; + const params: any = { p: null, s: null }; + + if (event.pageIndex != 0) { + params.p = event.pageIndex + 1; + } + + if (event.pageSize != 30) { + params.s = event.pageSize; + } + + this.router.navigate( + [], + { + relativeTo: this.route, + queryParams: params, + queryParamsHandling: 'merge' + }); + + this.entriesService.getByUser(this.username,event.pageIndex, event.pageSize).subscribe((data: any) => { + this.entries = data; + }, (error) => { }) + } + +} diff --git a/src/app/services/bookmarks.service.ts b/src/app/services/bookmarks.service.ts index 7e023d3..c03f62f 100644 --- a/src/app/services/bookmarks.service.ts +++ b/src/app/services/bookmarks.service.ts @@ -11,19 +11,19 @@ export class BookmarksService { } getEntries() { - return this.http.get(environment.apiUrl + "/b"); + return this.http.get(environment.apiUrl + "/bookmarks"); } getEntriesPages(page: number, size: number) { - return this.http.get(environment.apiUrl + "/b" + "?page=" + page + "&size=" + size); + return this.http.get(environment.apiUrl + "/bookmarks" + "?page=" + page + "&size=" + size); } addEntry(id: number) { - return this.http.put(environment.apiUrl + "/b/" + id, {}); + return this.http.put(environment.apiUrl + "/bookmarks/" + id, {}); } removeEntry(id: number) { - return this.http.delete(environment.apiUrl + "/b/" + id, {}); + return this.http.delete(environment.apiUrl + "/bookmarks/" + id, {}); } } \ No newline at end of file diff --git a/src/app/services/comment.service.ts b/src/app/services/comment.service.ts index 405a311..9edcd31 100644 --- a/src/app/services/comment.service.ts +++ b/src/app/services/comment.service.ts @@ -10,53 +10,41 @@ export class CommentService { constructor(private http: HttpClient) { } - get(target: number) { - return this.http.get(environment.apiUrl + "/c/e/" + target); + getRanked(target: number, page: number, size: number) { + return this.http.get(environment.apiUrl + "/comments/" + target + "?page=" + page + "&size=" + size); } - getParent(target: number, parent: number) { - return this.http.get(environment.apiUrl + "/c/e/" + target + "/" + parent); + getRankedByParent(target: number, parent: number, page: number, size: number) { + return this.http.get(environment.apiUrl + "/comments/" + target + "/" + parent + "?page=" + page + "&size=" + size); + } + + getNew(target: number, page: number, size: number) { + return this.http.get(environment.apiUrl + "/comments/new/" + target + "?page=" + page + "&size=" + size); + } + + getNewByParent(target: number, parent: number, page: number, size: number) { + return this.http.get(environment.apiUrl + "/comments/new/" + target + "/" + parent + "?page=" + page + "&size=" + size); + } + + getByUser(username: string, page: number, size: number) { + return this.http.get(environment.apiUrl + "/comments/byuser/" + username + "?page=" + page + "&size=" + size); } count(target: number) { - return this.http.get(environment.apiUrl + "/c/c/" + target); + return this.http.get(environment.apiUrl + "/comments/count/" + target); } countParent(target: number, parent: number) { - return this.http.get(environment.apiUrl + "/c/c/" + target + "/" + parent); - } - - getPages(target: number, page: number, size: number) { - return this.http.get(environment.apiUrl + "/c/e/" + target + "?page=" + page + "&size=" + size); - } - - getParentPages(target: number, parent: number, page: number, size: number) { - return this.http.get(environment.apiUrl + "/c/e/" + target + "/" + parent + "?page=" + page + "&size=" + size); - } - - getNew(target: number) { - return this.http.get(environment.apiUrl + "/c/e/new/" + target); - } - - getNewParent(target: number, parent: number) { - return this.http.get(environment.apiUrl + "/c/e/new/" + target + "/" + parent); - } - - getNewPages(target: number, page: number, size: number) { - return this.http.get(environment.apiUrl + "/c/e/new/" + target + "?page=" + page + "&size=" + size); - } - - getNewParentPages(target: number, parent: number, page: number, size: number) { - return this.http.get(environment.apiUrl + "/c/e/new/" + target + "/" + parent + "?page=" + page + "&size=" + size); + return this.http.get(environment.apiUrl + "/comments/count/" + target + "/" + parent); } getComment(id: number) { - return this.http.get(environment.apiUrl + "/c/" + id); + return this.http.get(environment.apiUrl + "/comments/comment/" + id); } create(comment: any) { comment.type = 'COMMENT'; - return this.http.post(environment.apiUrl + "/c", comment); + return this.http.post(environment.apiUrl + "/comments", comment); } } \ No newline at end of file diff --git a/src/app/services/entries.service.ts b/src/app/services/entries.service.ts index 70ddfc2..ec82b8e 100644 --- a/src/app/services/entries.service.ts +++ b/src/app/services/entries.service.ts @@ -10,29 +10,25 @@ export class EntriesService { constructor(private http: HttpClient) { } - get() { - return this.http.get(environment.apiUrl + "/e"); + getRanked(page: number, size: number) { + return this.http.get(environment.apiUrl + "/entries?page=" + page + "&size=" + size); } - getPages(page: number, size: number) { - return this.http.get(environment.apiUrl + "/e?page=" + page + "&size=" + size); + getNew(page: number, size: number) { + return this.http.get(environment.apiUrl + "/entries/new?page=" + page + "&size=" + size); } - getNew() { - return this.http.get(environment.apiUrl + "/e/new"); - } - - getNewPages(page: number, size: number) { - return this.http.get(environment.apiUrl + "/e/new?page=" + page + "&size=" + size); + getByUser(username: string, page: number, size: number) { + return this.http.get(environment.apiUrl + "/entries/byuser/" + username + "?page=" + page + "&size=" + size); } getEntry(id: number) { - return this.http.get(environment.apiUrl + "/e/" + id); + return this.http.get(environment.apiUrl + "/entries/entry/" + id); } create(entry: any) { entry.type = 'ENTRY'; - return this.http.post(environment.apiUrl + "/e", entry); + return this.http.post(environment.apiUrl + "/entries", entry); } } \ No newline at end of file diff --git a/src/app/services/moderarion.service.ts b/src/app/services/moderarion.service.ts index 4e944ec..69e3741 100644 --- a/src/app/services/moderarion.service.ts +++ b/src/app/services/moderarion.service.ts @@ -11,11 +11,11 @@ export class ModerationService { } deleteComment(id: number) { - return this.http.delete(environment.apiUrl + "/m/c/" + id); + return this.http.delete(environment.apiUrl + "/moderation/comment/" + id); } deleteEntry(id: number) { - return this.http.delete(environment.apiUrl + "/m/e/" + id); + return this.http.delete(environment.apiUrl + "/moderation/entry/" + id); } } \ No newline at end of file diff --git a/src/app/services/user.service.ts b/src/app/services/user.service.ts index 2286b38..9a520d1 100644 --- a/src/app/services/user.service.ts +++ b/src/app/services/user.service.ts @@ -13,14 +13,14 @@ export class UserService { } get() { - return this.http.get(environment.apiUrl + "/u"); + return this.http.get(environment.apiUrl + "/users/user"); } getUser(username: string) { - return this.http.get(environment.apiUrl + "/u/" + username); + return this.http.get(environment.apiUrl + "/users/user/" + username); } update(user: any) { - return this.http.post(environment.apiUrl + "/u", user); + return this.http.post(environment.apiUrl + "/users/user", user); } } \ No newline at end of file diff --git a/src/app/services/vote.service.ts b/src/app/services/vote.service.ts index d0b971a..bbcc761 100644 --- a/src/app/services/vote.service.ts +++ b/src/app/services/vote.service.ts @@ -12,35 +12,35 @@ export class VoteService { getEntryPoints(target: number) { - return this.http.get(environment.apiUrl + "/v/e/" + target); + return this.http.get(environment.apiUrl + "/votes/entry/" + target); } voteEntryUp(id: number) { - return this.http.put(environment.apiUrl + "/v/e/" + id + "/up", {}); + return this.http.put(environment.apiUrl + "/votes/entry/" + id + "/up", {}); } voteEntryDown(id: number) { - return this.http.put(environment.apiUrl + "/v/e/" + id + "/down", {}); + return this.http.put(environment.apiUrl + "/votes/entry/" + id + "/down", {}); } unvoteEntry(id: number) { - return this.http.delete(environment.apiUrl + "/v/e/" + id, {}); + return this.http.delete(environment.apiUrl + "/votes/entry/" + id, {}); } getCommentPoints(target: number) { - return this.http.get(environment.apiUrl + "/v/c/" + target); + return this.http.get(environment.apiUrl + "/votes/comment/" + target); } voteCommentUp(id: number) { - return this.http.put(environment.apiUrl + "/v/c/" + id + "/up", {}); + return this.http.put(environment.apiUrl + "/votes/comment/" + id + "/up", {}); } voteCommentDown(id: number) { - return this.http.put(environment.apiUrl + "/v/c/" + id + "/down", {}); + return this.http.put(environment.apiUrl + "/votes/comment/" + id + "/down", {}); } unvoteComment(id: number) { - return this.http.delete(environment.apiUrl + "/v/c/" + id, {}); + return this.http.delete(environment.apiUrl + "/votes/comment/" + id, {}); } diff --git a/src/app/ui/comment/comment.ui.html b/src/app/ui/comment/comment.ui.html index 71ddf04..7afc58a 100644 --- a/src/app/ui/comment/comment.ui.html +++ b/src/app/ui/comment/comment.ui.html @@ -24,9 +24,7 @@
- {{comment.text}} -
+ [style.opacity]="comment.metadata && comment.metadata.points && comment.metadata.points < 0 ? 1 + (comment.metadata.points / 10) : '1.0'">{{comment.text}}
diff --git a/src/app/ui/comment/comment.ui.scss b/src/app/ui/comment/comment.ui.scss index 56c11dd..c997d12 100644 --- a/src/app/ui/comment/comment.ui.scss +++ b/src/app/ui/comment/comment.ui.scss @@ -19,4 +19,15 @@ span.voted { .comment { margin: 15px 0; -} \ No newline at end of file +} + +.mat-icon { + top: 3px; + position: relative; + margin-right: 5px; +} + +small .mat-icon { + top: 2px; + margin-right: 0px; +} diff --git a/src/app/ui/comments/comments.ui.html b/src/app/ui/comments/comments.ui.html index 387c995..1eabe63 100644 --- a/src/app/ui/comments/comments.ui.html +++ b/src/app/ui/comments/comments.ui.html @@ -1,4 +1,6 @@ -
+ + +
diff --git a/src/app/ui/comments/comments.ui.ts b/src/app/ui/comments/comments.ui.ts index 59b76a6..25d68a8 100644 --- a/src/app/ui/comments/comments.ui.ts +++ b/src/app/ui/comments/comments.ui.ts @@ -24,11 +24,11 @@ export class UiComments implements OnInit { refresh(): void { if (this.parent) { - this.commentService.getParent(this.target, this.parent).subscribe((data) => { + this.commentService.getNewByParent(this.target, this.parent, 0, 30).subscribe((data) => { this.comments = data; }) } else { - this.commentService.get(this.target).subscribe((data) => { + this.commentService.getNew(this.target, 0, 30).subscribe((data) => { this.comments = data; }) } @@ -51,7 +51,7 @@ export class UiComments implements OnInit { showMore() { const oldContent: any[] = this.comments.content; if (this.parent) { - this.commentService.getParentPages(this.target, this.parent, this.comments.number + 1, this.comments.size).subscribe((data) => { + this.commentService.getNewByParent(this.target, this.parent, this.comments.number + 1, this.comments.size).subscribe((data) => { this.comments = data; for (let comment of this.comments.content) { oldContent.push(comment); @@ -59,7 +59,7 @@ export class UiComments implements OnInit { this.comments.content = oldContent; }) } else { - this.commentService.getPages(this.target, this.comments.number + 1, this.comments.size).subscribe((data) => { + this.commentService.getNew(this.target, this.comments.number + 1, this.comments.size).subscribe((data) => { this.comments = data; for (let comment of this.comments.content) { oldContent.push(comment); diff --git a/src/app/ui/entries/entries.ui.html b/src/app/ui/entries/entries.ui.html index 56f6398..231b450 100644 --- a/src/app/ui/entries/entries.ui.html +++ b/src/app/ui/entries/entries.ui.html @@ -4,7 +4,7 @@ - + diff --git a/src/app/ui/entries/entries.ui.scss b/src/app/ui/entries/entries.ui.scss index b5b0617..b8e1f70 100644 --- a/src/app/ui/entries/entries.ui.scss +++ b/src/app/ui/entries/entries.ui.scss @@ -1,4 +1,9 @@ .entry { display: inline-block; max-width: 100%; +} + +.entry-item { + height: auto; + min-height: 48px; } \ No newline at end of file diff --git a/src/app/ui/entry/entry.ui.html b/src/app/ui/entry/entry.ui.html index a2de45d..59a3bdd 100644 --- a/src/app/ui/entry/entry.ui.html +++ b/src/app/ui/entry/entry.ui.html @@ -23,12 +23,14 @@ thumb_down   - {{'points' | i18n:(entry.metadata && entry.metadata.points)}} + {{(entry.metadata && entry.metadata.points == 1 ? 'point' : + 'points') | i18n:(entry.metadata && entry.metadata.points)}} {{entry.created | datef}} {{'entry.author' | i18n}}{{entry.author}} | - {{'entry.comments' | i18n:(entry.metadata && entry.metadata.comments)}} + {{(entry.metadata && entry.metadata.comments == 1 ? 'entry.comment' : + 'entry.comments') | i18n:(entry.metadata && entry.metadata.comments)}} | diff --git a/src/app/ui/entry/entry.ui.scss b/src/app/ui/entry/entry.ui.scss index b4804d5..dbb969e 100644 --- a/src/app/ui/entry/entry.ui.scss +++ b/src/app/ui/entry/entry.ui.scss @@ -1,5 +1,9 @@ @import '../../../variables.scss'; +a.title { + white-space: break-spaces; + word-wrap: break-word; +} small a { color: inherit !important; @@ -13,4 +17,15 @@ small a:hover { span.voted { opacity: 0.5; +} + +.mat-icon { + top: 3px; + position: relative; + margin-right: 3px; +} + +small .mat-icon { + top: 2px; + margin-right: 0px; } \ No newline at end of file