commit 9f6890c284158d361cd0530c3374bc4e15072e3c
parent a08561780666a657319017b99e04bdbd1b50c359
Author: MTRNord <mtrnord1@gmail.com>
Date: Thu, 22 Mar 2018 22:15:37 +0100
Remove not needed code and try to fix tweet-list
Diffstat:
4 files changed, 8 insertions(+), 35 deletions(-)
diff --git a/src/app/papers-list/papers-list.component.html b/src/app/papers-list/papers-list.component.html
@@ -1,3 +1,3 @@
-<div #container class="grid">
+<div class="grid">
<app-card *ngFor="let item of data" [title]="item.name" [link]="'/paper/'+item.uuid" [image]="item.paper_image" [text]="item.description"></app-card>
</div>
diff --git a/src/app/papers-list/papers-list.component.ts b/src/app/papers-list/papers-list.component.ts
@@ -10,7 +10,6 @@ import 'rxjs/add/operator/take';
import 'rxjs/add/operator/concat';
import 'rxjs/add/observable/throw';
import {ToastrService} from 'ngx-toastr';
-import {NavigationEnd, Router} from '@angular/router';
@Component({
selector: 'app-papers-list',
@@ -19,32 +18,18 @@ import {NavigationEnd, Router} from '@angular/router';
})
export class PapersListComponent implements OnInit {
data: (Paper)[];
- currentUrl: string;
- constructor(private apiService: ApiService, private toastr: ToastrService, router: Router) {
+ constructor(private apiService: ApiService, private toastr: ToastrService) {
Raven.captureBreadcrumb({
message: 'Listing Papers',
category: 'papers-list'
});
- router.events.subscribe((value) => {
- if (value instanceof NavigationEnd ) {
- this.currentUrl = value.url;
- }
- });
}
ngOnInit() {
this.getPapers();
}
- hide(el) {
- el.style.display = '';
- }
-
- goTo(el): void {
- el.style.display = 'block';
- }
-
getPapers() {
this.apiService.getPapers()
// TODO: Better variable naming
diff --git a/src/app/tweet-list/tweet-list.component.html b/src/app/tweet-list/tweet-list.component.html
@@ -1,3 +1,6 @@
-<div #container class="grid">
- <app-card *ngFor="let item of data" [title]="item.display_name" [link]="'/paper/'+item.uuid" [image]="item.image_urls[0]" [text]="item.text" [retweet]="item.retweet" [retweets]="item.retweets" [created_at]="item.created_at" [favs]="item.favorites"></app-card>
+<div class="grid">
+ <ng-container *ngFor="let item of data">
+ <app-card *ngIf="item.image_urls; else other" [title]="item.display_name" [image]="item.image_urls[0]" [text]="item.text" [retweet]="item.retweet" [retweets]="item.retweets" [created_at]="item.created_at" [favs]="item.favorites"></app-card>
+ <app-card #other [title]="item.display_name" [text]="item.text" [retweet]="item.retweet" [retweets]="item.retweets" [created_at]="item.created_at" [favs]="item.favorites"></app-card>
+ </ng-container>
</div>
diff --git a/src/app/tweet-list/tweet-list.component.ts b/src/app/tweet-list/tweet-list.component.ts
@@ -10,7 +10,6 @@ import 'rxjs/add/operator/take';
import 'rxjs/add/operator/concat';
import 'rxjs/add/observable/throw';
import {ToastrService} from 'ngx-toastr';
-import {NavigationEnd, Router} from '@angular/router';
@Component({
selector: 'app-tweet-list',
@@ -20,9 +19,8 @@ import {NavigationEnd, Router} from '@angular/router';
export class TweetListComponent implements OnInit {
@Input() uuid;
data: (TweetsEntity)[];
- currentUrl: string;
- constructor(private apiService: ApiService, private toastr: ToastrService, router: Router) {
+ constructor(private apiService: ApiService, private toastr: ToastrService) {
Raven.captureBreadcrumb({
message: 'Showing Paper',
category: 'paper',
@@ -30,19 +28,6 @@ export class TweetListComponent implements OnInit {
uuid: this.uuid
}
});
- router.events.subscribe((value) => {
- if (value instanceof NavigationEnd ) {
- this.currentUrl = value.url;
- }
- });
- }
-
- hide(el) {
- el.style.display = '';
- }
-
- goTo(el): void {
- el.style.display = 'block';
}
ngOnInit() {