thread previews remade
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
44049bf900
commit
275dfb6e5e
@ -1,2 +1,2 @@
|
|||||||
export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
|
//export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
|
||||||
//export const api_endpoint: string = 'http://localhost:7141/';
|
export const api_endpoint: string = 'http://localhost:7141/';
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
.op {
|
.op {
|
||||||
|
padding:20px;
|
||||||
|
width: 500px;
|
||||||
|
word-break: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview {
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-color: rgb(190,190,190);
|
border-color: rgb(190,190,190);
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
@ -9,4 +17,5 @@
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
|
margin-left: 7%;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<div class="op">
|
<div class="op" [ngClass]="{op: op.Is_OP}" [ngClass]="{preview: !op.Is_OP}">
|
||||||
<a [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Зайти в тред {{op.Thread_Id}} </a>
|
<a *ngIf="op.Thread_Id != 0" [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Зайти в тред {{op.Thread_Id}} </a>
|
||||||
<p> # {{op.Id}} {{op.Timestamp}}</p>
|
<p> # {{op.Id}} {{op.Timestamp}}</p>
|
||||||
<div>
|
<div>
|
||||||
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">
|
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<button (click)="refreshOPs(boardName)">Обновить</button>
|
<button (click)="refreshOPs(boardName)">Обновить</button>
|
||||||
|
<div *ngFor="let oparrey of opsToShow">
|
||||||
<op-single
|
<op-single
|
||||||
*ngFor="let op of opsToShow" [op]="op"
|
*ngFor="let op of oparrey" [op]="op"
|
||||||
></op-single>
|
></op-single>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
<button (click)="refreshOPs(boardName)">Обновить</button>
|
<button (click)="refreshOPs(boardName)">Обновить</button>
|
||||||
|
@ -14,7 +14,7 @@ export class ThreadsComponent implements OnInit {
|
|||||||
boardName:string = 'b'
|
boardName:string = 'b'
|
||||||
command: string = "";
|
command: string = "";
|
||||||
response: any;
|
response: any;
|
||||||
opsToShow: SinglePost[] = []
|
opsToShow: SinglePost[][]
|
||||||
showGuide: boolean = false;
|
showGuide: boolean = false;
|
||||||
|
|
||||||
constructor(public apiChatService: ApiChatService) {
|
constructor(public apiChatService: ApiChatService) {
|
||||||
@ -22,7 +22,8 @@ export class ThreadsComponent implements OnInit {
|
|||||||
|
|
||||||
refreshOPs(boardName: string) {
|
refreshOPs(boardName: string) {
|
||||||
this.apiChatService.getThreads(boardName).subscribe(response => {
|
this.apiChatService.getThreads(boardName).subscribe(response => {
|
||||||
this.opsToShow = response
|
this.opsToShow = response;
|
||||||
|
console.log(response);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
<div *ngIf="showForm" class="posting_form">
|
<div *ngIf="showForm" class="posting_form">
|
||||||
<h4>Создай то, о чем будут говорить многие в /{{board}}/.</h4>
|
<h4>Создай то, о чем будут говорить многие в /{{board}}/.</h4>
|
||||||
<br>
|
<br>
|
||||||
<textarea type="text" rows="8" cols="45" placeholder="Печатать сюда" #textForm></textarea>
|
<textarea type="text" rows="8" cols="45" placeholder="Печатать сюда" #textForm [(ngModel)] = "inputText"></textarea>
|
||||||
<p>
|
<p>
|
||||||
<button (click)="create(textForm.value) ; textForm.value=''" >Отправить</button>
|
<button (click)="create()" >Отправить</button>
|
||||||
</p>
|
</p>
|
||||||
<h1>Загрузить картинку:</h1>
|
<h1>Загрузить картинку:</h1>
|
||||||
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
<input type="file" #file placeholder="Загрузить картинку" (change)="sendPic($event)" style="display:none;">
|
||||||
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
<button type="button" class="btn btn-success" (click)="file.click()">Загрузить картинку</button>
|
||||||
<div *ngFor="let singlePic of inputImages" >Картинка: {{singlePic}}</div>
|
<div *ngFor="let singlePic of inputImages" >Картинка: {{singlePic}}</div>
|
||||||
|
<p>
|
||||||
|
<button (click)="eraseData()" >Отмена</button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
@ -1,7 +1,6 @@
|
|||||||
import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';
|
import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';
|
||||||
import { showAlert } from 'src/app/const/alert';
|
import { showAlert } from 'src/app/const/alert';
|
||||||
import { ApiChatService } from 'src/app/services/api-chat.service';
|
import { ApiChatService } from 'src/app/services/api-chat.service';
|
||||||
import * as vars from "../../const/api"
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-send-form',
|
selector: 'app-send-form',
|
||||||
@ -12,7 +11,7 @@ export class SendFormComponent implements OnInit {
|
|||||||
|
|
||||||
@Input() board: string;
|
@Input() board: string;
|
||||||
showForm:boolean = false;
|
showForm:boolean = false;
|
||||||
// inputText: string;
|
inputText: string;
|
||||||
inputImages: string[] = [];
|
inputImages: string[] = [];
|
||||||
|
|
||||||
@Output() sendInfoToCreate = new EventEmitter();
|
@Output() sendInfoToCreate = new EventEmitter();
|
||||||
@ -22,14 +21,15 @@ export class SendFormComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
public apiChatService: ApiChatService) { }
|
public apiChatService: ApiChatService) { }
|
||||||
|
|
||||||
create(text:string){
|
create(){
|
||||||
var toSend = {
|
var toSend = {
|
||||||
text: text,
|
text: this.inputText,
|
||||||
images: this.inputImages
|
images: this.inputImages
|
||||||
}
|
}
|
||||||
this.sendInfoToCreate.emit(toSend)
|
this.sendInfoToCreate.emit(toSend)
|
||||||
toSend.text = '';
|
toSend.text = '';
|
||||||
toSend.images = [];
|
toSend.images = [];
|
||||||
|
this.eraseData();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendPic(event: any) {
|
sendPic(event: any) {
|
||||||
@ -37,10 +37,16 @@ export class SendFormComponent implements OnInit {
|
|||||||
response => {
|
response => {
|
||||||
response = response.value.toString();
|
response = response.value.toString();
|
||||||
this.inputImages.push(response);
|
this.inputImages.push(response);
|
||||||
showAlert(`Картинка ${response} добавлена`, "#ff0a36")
|
showAlert(`Картинка ${response} добавлена`, "#ff0a36");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eraseData(){
|
||||||
|
this.inputImages = [];
|
||||||
|
this.inputText = '';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ export class ApiChatService {
|
|||||||
return this.http.post(globals.api_endpoint + 'UploadPic', PostPicture)
|
return this.http.post(globals.api_endpoint + 'UploadPic', PostPicture)
|
||||||
}
|
}
|
||||||
|
|
||||||
getThreads(boardName: string): Observable<SinglePost[]> {
|
getThreads(boardName: string): Observable<SinglePost[][]> {
|
||||||
//console.log("Получаю посты и картинки");
|
//console.log("Получаю посты и картинки");
|
||||||
return this.http.get<SinglePost[]>(globals.api_endpoint + 'Threads/', {params: {board: boardName}});
|
return this.http.get<SinglePost[][]>(globals.api_endpoint + 'Threads/', {params: {board: boardName}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user