Add the save button on works
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
3bd2c44bad
commit
d71c510bb6
@ -1,5 +1,9 @@
|
|||||||
<div>
|
<div class="work-list-detail">
|
||||||
<h4>{{ work.id_work }} - {{ work.title }}</h4>
|
<h4 class="work-list-detail--title">{{ work.title }}</h4>
|
||||||
<span> WORK CONTENT : {{ work.content }}</span>
|
<span class="work-list-detail--content">{{
|
||||||
<a [routerLink]="['/work/', work.id_work]">Edit Code</a>
|
work.content | slice: 0 : 50
|
||||||
|
}}</span>
|
||||||
|
<button class="work-list-detail--btn" [routerLink]="['/work/', work.id_work]">
|
||||||
|
Edit Code
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
.work-list-detail {
|
||||||
|
background: lightgray;
|
||||||
|
width: fit-content;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 1rem;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
&--title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--content {
|
||||||
|
}
|
||||||
|
|
||||||
|
&--btn {
|
||||||
|
width: fit-content;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
<div *ngIf="work">
|
<div *ngIf="work">
|
||||||
<h2>Works</h2>
|
<h2>Works</h2>
|
||||||
<h3>CURRENT WORK ID - {{ work.id_work }}</h3>
|
<h3>CURRENT WORK ID - {{ work.id_work }}</h3>
|
||||||
|
<app-editor [currentWork]="work"></app-editor>
|
||||||
<!-- <app-editor></app-editor>-->
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,60 +1,59 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {RouterLink, ActivatedRoute} from '@angular/router';
|
import { RouterLink, ActivatedRoute } from '@angular/router';
|
||||||
import {ThemeService} from '../../services/theme.service';
|
import { ThemeService } from '../../services/theme.service';
|
||||||
import {NgClass, NgIf} from '@angular/common';
|
import { NgClass, NgIf } from '@angular/common';
|
||||||
import {TranslateModule} from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {Work} from '../../models/work.model';
|
import { Work } from '../../models/work.model';
|
||||||
import {WorkService} from '../../services/work.service';
|
import { WorkService } from '../../services/work.service';
|
||||||
import {NgForOf} from '@angular/common';
|
import { NgForOf } from '@angular/common';
|
||||||
import {FormsModule, NgForm} from '@angular/forms';
|
import { FormsModule, NgForm } from '@angular/forms';
|
||||||
import {EditorComponent} from '../editor/editor.component';
|
import { EditorComponent } from '../editor/editor.component';
|
||||||
import {WorkListDetailComponent} from '../work-list-detail/work-list-detail.component';
|
import { WorkListDetailComponent } from '../work-list-detail/work-list-detail.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-work',
|
selector: 'app-work',
|
||||||
templateUrl: './work.component.html',
|
templateUrl: './work.component.html',
|
||||||
styleUrl: './work.component.scss',
|
styleUrl: './work.component.scss',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [
|
||||||
NgClass,
|
NgClass,
|
||||||
TranslateModule,
|
TranslateModule,
|
||||||
RouterLink,
|
RouterLink,
|
||||||
NgForOf,
|
NgForOf,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
EditorComponent,
|
EditorComponent,
|
||||||
WorkListDetailComponent,
|
WorkListDetailComponent,
|
||||||
NgIf,
|
NgIf,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class WorkComponent implements OnInit {
|
export class WorkComponent implements OnInit {
|
||||||
// à retirer quand les boutons seront dans editor.component
|
// à retirer quand les boutons seront dans editor.component
|
||||||
isLoaded: boolean = false; // Pour vérifier si le chargement est terminé
|
isLoaded: boolean = false; // Pour vérifier si le chargement est terminé
|
||||||
|
|
||||||
themeClass!: string;
|
themeClass!: string;
|
||||||
work!: Work;
|
work!: Work;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
protected workService: WorkService
|
protected workService: WorkService
|
||||||
) {
|
) {}
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.themeService.isDarkTheme.subscribe((value) => {
|
this.themeService.isDarkTheme.subscribe((value) => {
|
||||||
value
|
value
|
||||||
? (this.themeClass = 'dark-theme')
|
? (this.themeClass = 'dark-theme')
|
||||||
: (this.themeClass = 'light-theme');
|
: (this.themeClass = 'light-theme');
|
||||||
});
|
});
|
||||||
|
|
||||||
const work_id = String(this.route.snapshot.paramMap.get('id'));
|
const work_id = String(this.route.snapshot.paramMap.get('id'));
|
||||||
|
|
||||||
this.workService.getWorkById(work_id).subscribe((response: Work) => {
|
this.workService.getWorkById(work_id).subscribe((response: Work) => {
|
||||||
this.work = response as Work;
|
this.work = response as Work;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(form: NgForm) {
|
onSubmit(form: NgForm) {
|
||||||
this.workService.postWork(form);
|
this.workService.postWork(form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
.all-works {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 2rem;
|
||||||
|
}
|
Loading…
Reference in new issue