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>
|
||||
<h4>{{ work.id_work }} - {{ work.title }}</h4>
|
||||
<span> WORK CONTENT : {{ work.content }}</span>
|
||||
<a [routerLink]="['/work/', work.id_work]">Edit Code</a>
|
||||
<div class="work-list-detail">
|
||||
<h4 class="work-list-detail--title">{{ work.title }}</h4>
|
||||
<span class="work-list-detail--content">{{
|
||||
work.content | slice: 0 : 50
|
||||
}}</span>
|
||||
<button class="work-list-detail--btn" [routerLink]="['/work/', work.id_work]">
|
||||
Edit Code
|
||||
</button>
|
||||
</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">
|
||||
<h2>Works</h2>
|
||||
<h3>CURRENT WORK ID - {{ work.id_work }}</h3>
|
||||
|
||||
<!-- <app-editor></app-editor>-->
|
||||
<app-editor [currentWork]="work"></app-editor>
|
||||
</div>
|
||||
|
@ -1,60 +1,59 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {RouterLink, ActivatedRoute} from '@angular/router';
|
||||
import {ThemeService} from '../../services/theme.service';
|
||||
import {NgClass, NgIf} from '@angular/common';
|
||||
import {TranslateModule} from '@ngx-translate/core';
|
||||
import {Work} from '../../models/work.model';
|
||||
import {WorkService} from '../../services/work.service';
|
||||
import {NgForOf} from '@angular/common';
|
||||
import {FormsModule, NgForm} from '@angular/forms';
|
||||
import {EditorComponent} from '../editor/editor.component';
|
||||
import {WorkListDetailComponent} from '../work-list-detail/work-list-detail.component';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { RouterLink, ActivatedRoute } from '@angular/router';
|
||||
import { ThemeService } from '../../services/theme.service';
|
||||
import { NgClass, NgIf } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { Work } from '../../models/work.model';
|
||||
import { WorkService } from '../../services/work.service';
|
||||
import { NgForOf } from '@angular/common';
|
||||
import { FormsModule, NgForm } from '@angular/forms';
|
||||
import { EditorComponent } from '../editor/editor.component';
|
||||
import { WorkListDetailComponent } from '../work-list-detail/work-list-detail.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-work',
|
||||
templateUrl: './work.component.html',
|
||||
styleUrl: './work.component.scss',
|
||||
standalone: true,
|
||||
imports: [
|
||||
NgClass,
|
||||
TranslateModule,
|
||||
RouterLink,
|
||||
NgForOf,
|
||||
FormsModule,
|
||||
EditorComponent,
|
||||
WorkListDetailComponent,
|
||||
NgIf,
|
||||
],
|
||||
selector: 'app-work',
|
||||
templateUrl: './work.component.html',
|
||||
styleUrl: './work.component.scss',
|
||||
standalone: true,
|
||||
imports: [
|
||||
NgClass,
|
||||
TranslateModule,
|
||||
RouterLink,
|
||||
NgForOf,
|
||||
FormsModule,
|
||||
EditorComponent,
|
||||
WorkListDetailComponent,
|
||||
NgIf,
|
||||
],
|
||||
})
|
||||
export class WorkComponent implements OnInit {
|
||||
// à retirer quand les boutons seront dans editor.component
|
||||
isLoaded: boolean = false; // Pour vérifier si le chargement est terminé
|
||||
// à retirer quand les boutons seront dans editor.component
|
||||
isLoaded: boolean = false; // Pour vérifier si le chargement est terminé
|
||||
|
||||
themeClass!: string;
|
||||
work!: Work;
|
||||
themeClass!: string;
|
||||
work!: Work;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private themeService: ThemeService,
|
||||
protected workService: WorkService
|
||||
) {
|
||||
}
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private themeService: ThemeService,
|
||||
protected workService: WorkService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.themeService.isDarkTheme.subscribe((value) => {
|
||||
value
|
||||
? (this.themeClass = 'dark-theme')
|
||||
: (this.themeClass = 'light-theme');
|
||||
});
|
||||
ngOnInit() {
|
||||
this.themeService.isDarkTheme.subscribe((value) => {
|
||||
value
|
||||
? (this.themeClass = 'dark-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.work = response as Work;
|
||||
});
|
||||
}
|
||||
this.workService.getWorkById(work_id).subscribe((response: Work) => {
|
||||
this.work = response as Work;
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit(form: NgForm) {
|
||||
this.workService.postWork(form);
|
||||
}
|
||||
onSubmit(form: NgForm) {
|
||||
this.workService.postWork(form);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
.all-works {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
}
|
Loading…
Reference in new issue