@@ -16,13 +16,16 @@ import { Feature } from '../Feature';
1616import { Grade , GradeLevel } from '../GradeLevel' ;
1717import { MatDialog } from '@angular/material/dialog' ;
1818import { DialogWithCloseComponent } from '../../../../assets/wise5/directives/dialog-with-close/dialog-with-close.component' ;
19+ import { Location } from '../Location' ;
20+ import { LocationSelectMenuComponent } from '../../shared/location-select-menu/location-select-menu.component' ;
1921
2022@Component ( {
2123 imports : [
2224 CommonModule ,
2325 MatBadgeModule ,
2426 MatButtonModule ,
2527 MatIconModule ,
28+ LocationSelectMenuComponent ,
2629 SearchBarComponent ,
2730 SelectMenuComponent ,
2831 StandardsSelectMenuComponent
@@ -44,6 +47,7 @@ export class LibraryFiltersComponent {
4447 private sharedProjects : LibraryProject [ ] = [ ] ;
4548 protected showFilters : boolean = false ;
4649 protected standardOptions : Standard [ ] = [ ] ;
50+ protected locationOptions : Location [ ] = [ ] ;
4751 protected unitTypeOptions : { id : string ; name : string } [ ] = [
4852 { id : 'WISE Platform' , name : $localize `WISE Platform` } ,
4953 { id : 'Other Platform' , name : $localize `Other Platform` }
@@ -97,6 +101,7 @@ export class LibraryFiltersComponent {
97101 ) ;
98102 this . populateGradeLevels ( project ) ;
99103 this . populateStandards ( project ) ;
104+ this . populateLocations ( project ) ;
100105 }
101106
102107 private populateGradeLevels ( project : LibraryProject ) : void {
@@ -123,12 +128,23 @@ export class LibraryFiltersComponent {
123128 } ) ;
124129 }
125130
131+ private populateLocations ( project : LibraryProject ) : void {
132+ project . metadata . locations ?. forEach ( ( location : Location ) =>
133+ this . locationOptions . push ( Object . assign ( new Location ( ) , location ) )
134+ ) ;
135+ }
136+
126137 private removeDuplicatesAndSortAlphabetically ( ) : void {
127138 this . standardOptions = this . utilService . removeObjectArrayDuplicatesByProperty (
128139 this . standardOptions ,
129140 'id'
130141 ) ;
131142 this . utilService . sortObjectArrayByProperty ( this . standardOptions , 'id' ) ;
143+ this . locationOptions = this . utilService . removeObjectArrayDuplicatesByProperty (
144+ this . locationOptions ,
145+ 'id'
146+ ) ;
147+ this . utilService . sortObjectArrayByProperty ( this . locationOptions , 'id' ) ;
132148 this . disciplineOptions = this . utilService . removeObjectArrayDuplicatesByProperty (
133149 this . disciplineOptions ,
134150 'id'
@@ -168,6 +184,9 @@ export class LibraryFiltersComponent {
168184 case 'unitType' :
169185 this . filterValues . unitTypeValue = value ;
170186 break ;
187+ case 'location' :
188+ this . filterValues . locationValue = value ;
189+ break ;
171190 }
172191 this . emitFilterValues ( ) ;
173192 }
@@ -182,9 +201,9 @@ export class LibraryFiltersComponent {
182201 }
183202
184203 protected showTypeInfo ( ) : void {
185- const message = $localize `"Type" indicates the platform on which a unit runs. "WISE Platform" units are created
186- using the WISE authoring tool. Students use WISE accounts to complete lessons and teachers can review and grade
187- work on the WISE platform. "Other" units are created using different platforms. Resources for these units
204+ const message = $localize `"Type" indicates the platform on which a unit runs. "WISE Platform" units are created
205+ using the WISE authoring tool. Students use WISE accounts to complete lessons and teachers can review and grade
206+ work on the WISE platform. "Other" units are created using different platforms. Resources for these units
188207 are linked in the unit details.` ;
189208 this . dialog . open ( DialogWithCloseComponent , {
190209 data : {
0 commit comments