From f85bfb3bf8f996a22a33b418846bfba0684ae31e Mon Sep 17 00:00:00 2001 From: Geoffrey Kwan Date: Mon, 6 May 2024 18:28:07 -0400 Subject: [PATCH 1/4] feat(Tag): Add tag functionality to personal library --- .../library-project.component.html | 7 ++++ src/app/modules/library/library.module.ts | 8 +++++ .../personal-library.component.html | 12 ++++++- .../personal-library.component.ts | 18 ++++++++++ src/messages.xlf | 35 ++++++++++++------- 5 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/app/modules/library/library-project/library-project.component.html b/src/app/modules/library/library-project/library-project.component.html index 69946a8411b..1af32de9464 100644 --- a/src/app/modules/library/library-project/library-project.component.html +++ b/src/app/modules/library/library-project/library-project.component.html @@ -42,5 +42,12 @@

Shared by {{ project.owner.displayName }}

+ + + + {{ tag.text }} + + + diff --git a/src/app/modules/library/library.module.ts b/src/app/modules/library/library.module.ts index 71d7f18d9ee..e5acc33440c 100644 --- a/src/app/modules/library/library.module.ts +++ b/src/app/modules/library/library.module.ts @@ -50,6 +50,10 @@ import { LibraryPaginatorIntl } from './libraryPaginatorIntl'; import { DiscourseCategoryActivityComponent } from './discourse-category-activity/discourse-category-activity.component'; import { ArchiveProjectsButtonComponent } from '../../teacher/archive-projects-button/archive-projects-button.component'; import { SelectAllItemsCheckboxComponent } from './select-all-items-checkbox/select-all-items-checkbox.component'; +import { ApplyTagsButtonComponent } from '../../teacher/apply-tags-button/apply-tags-button.component'; +import { SelectTagsComponent } from '../../teacher/select-tags/select-tags.component'; +import { MatChipsModule } from '@angular/material/chips'; +import { SelectedTagsListComponent } from '../../teacher/selected-tags-list/selected-tags-list.component'; const materialModules = [ MatAutocompleteModule, @@ -57,6 +61,7 @@ const materialModules = [ MatButtonModule, MatCardModule, MatCheckboxModule, + MatChipsModule, MatDialogModule, MatDividerModule, MatExpansionModule, @@ -74,6 +79,7 @@ const materialModules = [ @NgModule({ imports: [ + ApplyTagsButtonComponent, ArchiveProjectsButtonComponent, CommonModule, FlexLayoutModule, @@ -82,6 +88,8 @@ const materialModules = [ RouterModule, materialModules, SelectAllItemsCheckboxComponent, + SelectTagsComponent, + SelectedTagsListComponent, SharedModule, TimelineModule ], diff --git a/src/app/modules/library/personal-library/personal-library.component.html b/src/app/modules/library/personal-library/personal-library.component.html index 584849263c8..59a73db648a 100644 --- a/src/app/modules/library/personal-library/personal-library.component.html +++ b/src/app/modules/library/personal-library/personal-library.component.html @@ -2,14 +2,20 @@
What are My Units? + - View + View Active Archived
+
@@ -28,6 +34,10 @@ [showArchive]="!showArchivedView" (archiveProjectsEvent)="archiveProjects($event)" > +
= signal([]); + protected selectedTags: Tag[] = []; protected sharedProjects: LibraryProject[] = []; protected showArchivedView: boolean = false; @@ -115,6 +118,11 @@ export class PersonalLibraryComponent extends LibraryComponent { this.filteredProjects = this.filteredProjects.filter( (project) => project.hasTagWithText('archived') == this.showArchivedView ); + if (this.selectedTags.length > 0) { + this.filteredProjects = this.filteredProjects.filter((project: Project) => + this.selectedTags.some((tag: Tag) => project.hasTag(tag)) + ); + } this.numProjectsInView = this.getProjectsInView().length; this.unselectAllProjects(); } @@ -163,6 +171,16 @@ export class PersonalLibraryComponent extends LibraryComponent { protected archiveProjects(archive: boolean): void { this.archiveProjectService.archiveProjects(this.selectedProjects(), archive); } + + protected selectTags(tags: Tag[]): void { + this.selectedTags = tags; + this.filterUpdated(); + } + + protected removeTag(tag: Tag): void { + this.selectedTags = this.selectedTags.filter((selectedTag: Tag) => selectedTag.id !== tag.id); + this.filterUpdated(); + } } @Component({ diff --git a/src/messages.xlf b/src/messages.xlf index 4724b02debe..8651ab3dceb 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -5749,6 +5749,17 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.42,44 + + Unit tags + + src/app/modules/library/library-project/library-project.component.html + 45 + + + src/app/teacher/teacher-run-list-item/teacher-run-list-item.component.html + 50 + + Unit Details @@ -5857,11 +5868,18 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.3 + + View + + src/app/modules/library/personal-library/personal-library.component.html + 7 + + Active src/app/modules/library/personal-library/personal-library.component.html - 8 + 9 src/app/teacher/teacher-run-list/teacher-run-list.component.html @@ -5872,7 +5890,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Archived src/app/modules/library/personal-library/personal-library.component.html - 9 + 10 src/app/teacher/teacher-run-list/teacher-run-list.component.html @@ -5883,21 +5901,21 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. selected src/app/modules/library/personal-library/personal-library.component.html - 23,25 + 29,31 No owned or shared units found. src/app/modules/library/personal-library/personal-library.component.html - 56,58 + 66,68 Select all units src/app/modules/library/personal-library/personal-library.component.ts - 28 + 30 @@ -9145,13 +9163,6 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.47,49 - - Unit tags - - src/app/teacher/teacher-run-list-item/teacher-run-list-item.component.html - 50 - - (Legacy Unit) From dd916736b971e5436c6be756ddbd579b2f99cfc1 Mon Sep 17 00:00:00 2001 From: Geoffrey Kwan Date: Tue, 7 May 2024 11:12:15 -0400 Subject: [PATCH 2/4] feat(Tag): Add optional clear filters button --- .../personal-library/personal-library.component.html | 1 + .../selected-tags-list.component.html | 8 ++++++++ .../selected-tags-list.component.ts | 7 +++++++ src/messages.xlf | 11 +++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/app/modules/library/personal-library/personal-library.component.html b/src/app/modules/library/personal-library/personal-library.component.html index 59a73db648a..bdbef3c3809 100644 --- a/src/app/modules/library/personal-library/personal-library.component.html +++ b/src/app/modules/library/personal-library/personal-library.component.html @@ -14,6 +14,7 @@ diff --git a/src/app/teacher/selected-tags-list/selected-tags-list.component.html b/src/app/teacher/selected-tags-list/selected-tags-list.component.html index bbe5313162a..b8a34a9b2ab 100644 --- a/src/app/teacher/selected-tags-list/selected-tags-list.component.html +++ b/src/app/teacher/selected-tags-list/selected-tags-list.component.html @@ -11,4 +11,12 @@ + + Clear filters +
diff --git a/src/app/teacher/selected-tags-list/selected-tags-list.component.ts b/src/app/teacher/selected-tags-list/selected-tags-list.component.ts index 38a3862c673..e7fec32693d 100644 --- a/src/app/teacher/selected-tags-list/selected-tags-list.component.ts +++ b/src/app/teacher/selected-tags-list/selected-tags-list.component.ts @@ -14,5 +14,12 @@ import { MatChipsModule } from '@angular/material/chips'; }) export class SelectedTagsListComponent { @Output() removeTagEvent: EventEmitter = new EventEmitter(); + @Input() showClearButton = false; @Input() tags: Tag[] = []; + + protected removeTags(): void { + this.tags.forEach((tag: Tag) => { + this.removeTagEvent.emit(tag); + }); + } } diff --git a/src/messages.xlf b/src/messages.xlf index 8651ab3dceb..ac2fcab52ad 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -5901,14 +5901,14 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. selected src/app/modules/library/personal-library/personal-library.component.html - 29,31 + 30,32 No owned or shared units found. src/app/modules/library/personal-library/personal-library.component.html - 66,68 + 67,69 @@ -8909,6 +8909,13 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.9 + + Clear filters + + src/app/teacher/selected-tags-list/selected-tags-list.component.html + 19,21 + + Share with Students From c1534e3dd975d9850b4bdda0f4bd7b9143e72ada Mon Sep 17 00:00:00 2001 From: Jonathan Lim-Breitbart Date: Tue, 14 May 2024 12:25:54 -0400 Subject: [PATCH 3/4] Fix tags filter alignment and update styles --- .../home-page-project-library.component.html | 2 +- .../home-page-project-library.component.scss | 5 +++ .../library-filters.component.html | 7 +--- .../teacher-project-library.component.html | 2 +- .../teacher-project-library.component.scss | 6 +++ .../search-bar/search-bar.component.html | 7 +++- .../select-menu/select-menu.component.html | 2 +- .../select-tags/select-tags.component.html | 4 +- .../selected-tags-list.component.html | 1 + .../teacher-run-list.component.html | 40 +++++++++---------- .../teacher-run-list.component.scss | 14 ++----- src/messages.xlf | 27 +++++++------ 12 files changed, 63 insertions(+), 54 deletions(-) diff --git a/src/app/modules/library/home-page-project-library/home-page-project-library.component.html b/src/app/modules/library/home-page-project-library/home-page-project-library.component.html index 15b755ddca3..7bab8bcce58 100644 --- a/src/app/modules/library/home-page-project-library/home-page-project-library.component.html +++ b/src/app/modules/library/home-page-project-library/home-page-project-library.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/src/app/modules/library/home-page-project-library/home-page-project-library.component.scss b/src/app/modules/library/home-page-project-library/home-page-project-library.component.scss index 26a1b0d0eb1..0b1cb5f346d 100644 --- a/src/app/modules/library/home-page-project-library/home-page-project-library.component.scss +++ b/src/app/modules/library/home-page-project-library/home-page-project-library.component.scss @@ -18,3 +18,8 @@ max-width: none; } +.content-block { + padding: 16px; + border-radius: 0; +} + diff --git a/src/app/modules/library/library-filters/library-filters.component.html b/src/app/modules/library/library-filters/library-filters.component.html index 9cd2f27d35c..85d3c9a7eef 100644 --- a/src/app/modules/library/library-filters/library-filters.component.html +++ b/src/app/modules/library/library-filters/library-filters.component.html @@ -32,12 +32,7 @@ (NGSS). Reset
-
+
-
+
diff --git a/src/app/modules/library/teacher-project-library/teacher-project-library.component.scss b/src/app/modules/library/teacher-project-library/teacher-project-library.component.scss index de508629650..dd4e9094a98 100644 --- a/src/app/modules/library/teacher-project-library/teacher-project-library.component.scss +++ b/src/app/modules/library/teacher-project-library/teacher-project-library.component.scss @@ -12,6 +12,12 @@ } } +.filters { + padding: 16px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + .library-teacher__header { h3 { font-weight: 500; diff --git a/src/app/modules/shared/search-bar/search-bar.component.html b/src/app/modules/shared/search-bar/search-bar.component.html index 8c7c6473b9a..12762f5a3d8 100644 --- a/src/app/modules/shared/search-bar/search-bar.component.html +++ b/src/app/modules/shared/search-bar/search-bar.component.html @@ -1,4 +1,9 @@ - + {{ placeholderText }} search diff --git a/src/app/modules/shared/select-menu/select-menu.component.html b/src/app/modules/shared/select-menu/select-menu.component.html index 54bbc403054..a291087fb3f 100644 --- a/src/app/modules/shared/select-menu/select-menu.component.html +++ b/src/app/modules/shared/select-menu/select-menu.component.html @@ -1,4 +1,4 @@ - + {{ placeholderText }} - Tags + + Filter by tag -
- - +
+ + +
- + View Active @@ -26,6 +24,8 @@
+
+
src/app/authoring-tool/edit-component-tags/edit-component-tags.component.html 2 - - src/app/teacher/select-tags/select-tags.component.html - 2 - Add Tag @@ -3008,7 +3004,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/app/teacher/teacher-run-list/teacher-run-list.component.html - 14 + 11 src/assets/wise5/authoringTool/addNode/choose-simulation/choose-simulation.component.html @@ -5470,21 +5466,21 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Discipline src/app/modules/library/library-filters/library-filters.component.html - 50 + 45 DCI Arrangement src/app/modules/library/library-filters/library-filters.component.html - 68 + 63 Performance Expectation src/app/modules/library/library-filters/library-filters.component.html - 86 + 81 @@ -5883,7 +5879,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/app/teacher/teacher-run-list/teacher-run-list.component.html - 24 + 22 @@ -5894,7 +5890,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/app/teacher/teacher-run-list/teacher-run-list.component.html - 25 + 23 @@ -5990,7 +5986,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/app/modules/shared/search-bar/search-bar.component.html - 11 + 16 src/app/teacher/share-run-dialog/share-run-dialog.component.html @@ -8888,6 +8884,13 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.28 + + Filter by tag + + src/app/teacher/select-tags/select-tags.component.html + 2 + + Tag(s) @@ -8913,7 +8916,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. Clear filters src/app/teacher/selected-tags-list/selected-tags-list.component.html - 19,21 + 20,22 From 90e9f7bea4cac386897010a9beb3bd50d2c27845 Mon Sep 17 00:00:00 2001 From: Geoffrey Kwan Date: Thu, 16 May 2024 17:17:13 -0700 Subject: [PATCH 4/4] fix(Tag): Fix apply tags checkbox values not updating in library --- .../personal-library/personal-library.component.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/modules/library/personal-library/personal-library.component.ts b/src/app/modules/library/personal-library/personal-library.component.ts index 133d7b8f24f..116a3afe2fa 100644 --- a/src/app/modules/library/personal-library/personal-library.component.ts +++ b/src/app/modules/library/personal-library/personal-library.component.ts @@ -138,17 +138,14 @@ export class PersonalLibraryComponent extends LibraryComponent { } protected updateSelectedProjects(event: ProjectSelectionEvent): void { + const selectedProjects = this.selectedProjects(); if (event.selected) { - this.selectedProjects.update((selectedProjects) => { - selectedProjects.push(event.project); - return selectedProjects; - }); + selectedProjects.push(event.project); } else { - this.selectedProjects.update((selectedProjects) => { - selectedProjects.splice(selectedProjects.indexOf(event.project), 1); - return selectedProjects; - }); + selectedProjects.splice(selectedProjects.indexOf(event.project), 1); } + // create a new array to trigger change detection + this.selectedProjects.set([...selectedProjects]); } protected unselectAllProjects(): void {