Skip to content

Commit 2d5fc21

Browse files
committed
Edit done
1 parent 2ffe13e commit 2d5fc21

File tree

5 files changed

+30
-44
lines changed

5 files changed

+30
-44
lines changed

frontend/src/app/app.module.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import { VideogameCatalogComponent } from './components/videogame/videogame-cata
2121
import { VideogameEditFormComponent } from './components/videogame/videogame-edit-form.component';
2222
import { VideogamePurchaseComponent } from './components/videogame/videogame-purchase.component';
2323
import { VideogameDetailComponent } from './components/videogame/videogame-detail.component';
24-
25-
import { EditNewComponent } from './components/news/editNew.component';
26-
import { EditNewFormComponent } from './components/news/editNewForm.component';
2724
import { CommonModule } from '@angular/common';
2825

2926

@@ -39,7 +36,7 @@ import { VideogameRecommendedComponent } from './components/videogame-recommende
3936

4037

4138
@NgModule({
42-
declarations: [EditNewFormComponent,VideogameDetailComponent,EditNewComponent,AboutComponent,CarouselComponent,AppComponent,VideogamePurchaseComponent,VideogameEditFormComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
39+
declarations: [VideogameRecommendedComponent,EditNewFormComponent,VideogameDetailComponent,EditNewComponent,AboutComponent,CarouselComponent,AppComponent,VideogamePurchaseComponent,VideogameEditFormComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
4340
imports: [BrowserModule,NgbModule, FormsModule, HttpClientModule, routing, FormsModule,RouterModule,CommonModule],
4441
bootstrap: [AppComponent]
4542
})

frontend/src/app/components/Admin/editNewForm.component.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
<section style="margin-bottom: 4%;">
33

4-
<form action="/editNew/{{news.id}}" method="post" enctype="multipart/form-data">
54

65
<div class="container" style="background-color:#f5f5f5; margin-top: 2%; padding-bottom: 1%; ">
76

@@ -77,18 +76,11 @@ <h2 style="text-align: center; padding-top: 2%;">Edit New Form</h2>
7776

7877
<p style="text-align: center;" >
7978

80-
<button #file class="btn btn-primary" (click)="save()">Save</button>
79+
<button class="btn btn-primary" (click)="save()">Save</button>
8180
<button class="btn btn-outline-light" style="color: black; border-color: black;" (click)="cancel()">Cancel</button>
8281

83-
84-
<!--<input #file class="btn btn-primary" type="submit" value="Save"/>-->
85-
<!--Boton que ejecutara la función ajax-->
86-
<!--<button class="btn btn-outline-light" style="color: black; border-color: black;"
87-
onclick="location.href='/'; return false;">Cancel</button>-->
88-
89-
<!--Boton para cancelar la acción-->
9082
</p>
9183
</div>
92-
</form>
84+
9385
</section>
9486

frontend/src/app/components/videogame/videogame-edit-form.component.html

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<main class="flex-shrink-0">
22
<section>
3-
<form *ngIf="ready" action="/editVg/{{videogame.id}}" method="post" enctype="multipart/form-data">
3+
<form *ngIf="ready" >
44

55
<div class="container" style="background-color:#f5f5f5; margin-top: 5%; padding-bottom: 1%; ">
66

@@ -12,13 +12,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
1212
<div class="col-md-4 ">
1313
<div>
1414
<label>Title: </label>
15-
<p><textarea name="title" placeholder="title" style="width: 100%;">{{videogame.title}}</textarea></p>
15+
<p><textarea name="title" placeholder="title" style="width: 100%;" [(ngModel)]="videogame.title"></textarea></p>
1616
</div>
1717
</div>
1818
<div class="col-md-4 ">
1919
<div>
2020
<label>Price: </label>
21-
<p><input name="price" placeholder="price" type="number" value="{{videogame.price}}"
21+
<p><input name="price" placeholder="price" type="number" [(ngModel)]="videogame.price"
2222
style="width: 100%;"></p>
2323
</div>
2424
</div>
@@ -29,14 +29,14 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
2929
<div>
3030
<label>Company: </label>
3131
<p><textarea name="company" placeholder="company"
32-
style="width: 100%;">[(ngModel)]="videogame.company"</textarea></p>
32+
style="width: 100%;" [(ngModel)]="videogame.company"></textarea></p>
3333
</div>
3434
</div>
3535
<div class="col-md-4 ">
3636
<div>
3737
<label>Continent: </label>
3838
<p><textarea name="continent" placeholder="continent"
39-
style="width: 100%;">[(ngModel)]="videogame.continent"</textarea></p>
39+
style="width: 100%;"[(ngModel)]="videogame.continent"></textarea></p>
4040
</div>
4141
</div>
4242
</div>
@@ -63,16 +63,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
6363
</div>
6464
</div>
6565
</div>
66-
<div class="col-md-4 ">
67-
68-
</div>
6966

7067
<div class="row mt-3 d-flex justify-content-center">
7168
<div class="col-md-8">
7269
<div>
7370
<label style="text-align: left !important;">Game Content: </label>
7471
<p><textarea name="description" placeholder="description" rows="10"
75-
style="width: 100%;">[(ngModel)]='videogame.description''</textarea></p>
72+
style="width: 100%;"[(ngModel)]="videogame.description"></textarea></p>
7673
</div>
7774
</div>
7875
</div>
@@ -82,7 +79,7 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
8279
<div>
8380
<label style="text-align: left !important;">Game short description: </label>
8481
<p><textarea name="shortDescription" placeholder="shortDescription" rows="10"
85-
style="width: 100%;">[(ngModel)]='videogame.shortDescription'</textarea></p>
82+
style="width: 100%;"[(ngModel)]='videogame.shortDescription'></textarea></p>
8683
</div>
8784
</div>
8885
</div>
@@ -92,7 +89,7 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
9289
<div>
9390
<label style="text-align: left !important;">In game history: </label>
9491
<p><textarea name="history" placeholder="history" rows="10"
95-
style="width: 100%;">[(ngModel)]='videogame.history'</textarea></p>
92+
style="width: 100%;"[(ngModel)]='videogame.history'></textarea></p>
9693
</div>
9794
</div>
9895
</div>
@@ -103,13 +100,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
103100
<div class="col-md-4 ">
104101
<div>
105102
<label>Cpu recommended: </label>
106-
<p><textarea name="cpuR" placeholder="cpuR" style="width: 100%;">[(ngModel)]='videogame.cpuR'</textarea></p>
103+
<p><textarea name="cpuR" placeholder="cpuR" style="width: 100%;"[(ngModel)]='videogame.cpuR'></textarea></p>
107104
</div>
108105
</div>
109106
<div class="col-md-4 ">
110107
<div>
111108
<label>Cpu min: </label>
112-
<p><textarea name="cpuM" placeholder="cpuM" style="width: 100%;">[(ngModel)]='videogame.cpuM'</textarea></p>
109+
<p><textarea name="cpuM" placeholder="cpuM" style="width: 100%;"[(ngModel)]='videogame.cpuM'></textarea></p>
113110
</div>
114111
</div>
115112
</div>
@@ -118,13 +115,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
118115
<div class="col-md-4 ">
119116
<div>
120117
<label>Ram recommended: </label>
121-
<p><textarea name="ramR" placeholder="ramR" style="width: 100%;">[(ngModel)]='videogame.ramR'</textarea></p>
118+
<p><textarea name="ramR" placeholder="ramR" style="width: 100%;"[(ngModel)]='videogame.ramR'></textarea></p>
122119
</div>
123120
</div>
124121
<div class="col-md-4 ">
125122
<div>
126123
<label>Ram min: </label>
127-
<p><textarea name="ramM" placeholder="ramM" style="width: 100%;">[(ngModel)]='videogame.ramM'</textarea></p>
124+
<p><textarea name="ramM" placeholder="ramM" style="width: 100%;"[(ngModel)]='videogame.ramM'></textarea></p>
128125
</div>
129126
</div>
130127
</div>
@@ -133,13 +130,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
133130
<div class="col-md-4 ">
134131
<div>
135132
<label>Operativ system recommended: </label>
136-
<p><textarea name="ssooR" placeholder="ssooR" style="width: 100%;">[(ngModel)]='videogame.ssooR'</textarea></p>
133+
<p><textarea name="ssooR" placeholder="ssooR" style="width: 100%;"[(ngModel)]='videogame.ssooR'></textarea></p>
137134
</div>
138135
</div>
139136
<div class="col-md-4 ">
140137
<div>
141138
<label>Operativ sistem min: </label>
142-
<p><textarea name="ssooM" placeholder="ssooM" style="width: 100%;">[(ngModel)]='videogame.ssooM'</textarea></p>
139+
<p><textarea name="ssooM" placeholder="ssooM" style="width: 100%;"[(ngModel)]='videogame.ssooM'></textarea></p>
143140
</div>
144141
</div>
145142
</div>
@@ -148,13 +145,13 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
148145
<div class="col-md-4 ">
149146
<div>
150147
<label>Gpu recommended: </label>
151-
<p><textarea name="gpuR" placeholder="gpuR" style="width: 100%;">[(ngModel)]='videogame.gpuR'</textarea></p>
148+
<p><textarea name="gpuR" placeholder="gpuR" style="width: 100%;"[(ngModel)]='videogame.gpuR'></textarea></p>
152149
</div>
153150
</div>
154151
<div class="col-md-4 ">
155152
<div>
156153
<label>Gpu min: </label>
157-
<p><textarea name="gpuM" placeholder="gpuM" style="width: 100%;">[(ngModel)]='videogame.gpuM'</textarea></p>
154+
<p><textarea name="gpuM" placeholder="gpuM" style="width: 100%;"[(ngModel)]='videogame.gpuM'></textarea></p>
158155
</div>
159156
</div>
160157
</div>
@@ -164,28 +161,28 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
164161
<div>
165162
<label>Storage recommended: </label>
166163
<p><textarea name="storageR" placeholder="storageR"
167-
style="width: 100%;">[(ngModel)]='videogame.storageR'</textarea></p>
164+
style="width: 100%;"[(ngModel)]='videogame.storageR'></textarea></p>
168165
</div>
169166
</div>
170167
<div class="col-md-4 ">
171168
<div>
172169
<label>Storage min: </label>
173170
<p><textarea name="storageM" placeholder="storageM"
174-
style="width: 100%;">[(ngModel)]='videogame.storageM'</textarea></p>
171+
style="width: 100%;"[(ngModel)]='videogame.storageM'></textarea></p>
175172
</div>
176173
</div>
177174
</div>
178175

179-
<!-- <div class="row mt-3 d-flex justify-content-center">
176+
<div class="row mt-3 d-flex justify-content-center">
180177
<div class="col-md-8">
181178
<p>Related News: </p>
182179
<select name="notices" multiple style="width: 100%;">
183-
{{#news}}
180+
<!-- {{#news}}
184181
<option value="{{ id }}">{{ title }}</option>
185-
{{/news}}
182+
{{/news}} -->
186183
</select>
187184
</div>
188-
</div> -->
185+
</div>
189186

190187

191188
<div class="row mt-3 d-flex justify-content-center">
@@ -205,9 +202,9 @@ <h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
205202
</div>
206203

207204
<!-- <input type="hidden" name="_csrf" value="{{token}}" /> -->
208-
<p>
209-
<button (click)="cancel()">Cancel</button>
210-
<button (click)="save()">Save</button>
205+
<p style="align-items: center !important; text-align: center; align-self: center;">
206+
<button class="btn btn-primary" (click)="save()">Save</button>
207+
<button class="btn btn-outline-light" style="color: black; border-color: black;" (click)="cancel()">Cancel</button>
211208
</p>
212209
</div>
213210
</form>

frontend/src/app/components/videogame/videogame-edit-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class VideogameEditFormComponent{
2222
constructor(private router: Router, activatedroute:ActivatedRoute, public videogameService: VideogameService){
2323
const id = activatedroute.snapshot.params['id'];
2424
videogameService.getVideogame(id).subscribe(
25-
data => {console.log(data);this.videogame= data as Videogame},
25+
data => {this.videogame= data as Videogame},
2626
error => console.error(error)
2727
)
2828

frontend/src/app/models/videogame.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface Videogame {
1717
id?: number;
1818
imageVg: boolean;
1919
imageCompany: boolean;
20-
title: string;
20+
title: string;
2121
price:number;
2222
rating:number;
2323
genre:string;

0 commit comments

Comments
 (0)