Skip to content

Commit

Permalink
Add set title editing
Browse files Browse the repository at this point in the history
  • Loading branch information
hwgilbert16 committed Dec 8, 2023
1 parent 9f22d91 commit 5cd5844
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/front/src/app/study-set/study-set.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ <h5>{{this.cards.length}} term{{this.cards.length > 1 ? 's' : ''}} in this set</
</div>
</div>
<div *ngIf="set" [hidden]="!isEditing">
<div class="w-50 mt-3 h-100">
<label for="edit-title" class="form-label">Title</label>
<input type="text" class="form-control" id="edit-title" [value]="set.title" #editTitle>
</div>
<div class="w-50 mt-3 h-100">
<label for="edit-description" class="form-label">Description</label>
<textarea class="form-control" id="edit-description" [value]="set.description" #editDescription></textarea>
Expand Down
2 changes: 2 additions & 0 deletions apps/front/src/app/study-set/study-set.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class StudySetComponent implements OnInit {
@ViewChild("cardsContainer", { static: true, read: ViewContainerRef }) cardsContainer: ViewContainerRef;
@ViewChild("privateCheck", { static: false }) privateCheck: ElementRef;
@ViewChild("editDescription", { static: false }) editDescription: ElementRef;
@ViewChild("editTitle", { static: false }) editTitle: ElementRef;

protected userIsAuthor = false;
protected isEditing = false;
Expand Down Expand Up @@ -141,6 +142,7 @@ export class StudySetComponent implements OnInit {

const updated = await this.sets.updateSet({
id: this.set.id,
title: this.editTitle.nativeElement.value,
description: this.editDescription.nativeElement.value,
private: this.privateCheck.nativeElement.checked,
cards: this.cards.map((c) => {
Expand Down

0 comments on commit 5cd5844

Please sign in to comment.