Skip to content

Commit 05ce12b

Browse files
committed
Merge branch 'hotfix/25.06.3'
2 parents abdc6c4 + ab037b1 commit 05ce12b

File tree

13 files changed

+64
-0
lines changed

13 files changed

+64
-0
lines changed

app/models/collection-submission.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const choiceFields = tuple(
1919
'programArea',
2020
'status',
2121
'volume',
22+
'gradeLevels',
2223
'studyDesign',
2324
'schoolType',
2425
'dataType',
@@ -78,6 +79,7 @@ export default class CollectionSubmissionModel extends OsfModel.extend(Validatio
7879
@attr('string') programArea?: string;
7980
@attr('string') status?: string;
8081
@attr('string') volume?: string;
82+
@attr('string') gradeLevels?: string;
8183
@attr('string') studyDesign?: string; // custom field for Character Lab
8284
@attr('string') schoolType?: string; // custom field for Character Lab
8385
@attr('string') dataType?: string;

app/models/collection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type ChoicesFields =
1313
'programAreaChoices' |
1414
'statusChoices' |
1515
'volumeChoices' |
16+
'gradeLevelsChoices' |
1617
'studyDesignChoices' |
1718
'schoolTypeChoices' |
1819
'dataTypeChoices' |
@@ -32,6 +33,7 @@ export default class CollectionModel extends OsfModel {
3233
@attr('array') programAreaChoices!: string[];
3334
@attr('array') statusChoices!: string[];
3435
@attr('array') volumeChoices!: string[];
36+
@attr('array') gradeLevelsChoices!: string[];
3537
@attr('array') studyDesignChoices!: string[]; // custom field for Character Lab
3638
@attr('array') schoolTypeChoices!: string[]; // custom field for Character Lab
3739
@attr('array') dataTypeChoices!: string[];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { layout } from 'ember-osf-web/decorators/component';
2+
3+
import Base from '../base/component';
4+
import styles from './styles';
5+
import template from './template';
6+
7+
@layout(template, styles)
8+
export default class ActiveFilterStatus extends Base {
9+
}

lib/collections/addon/components/discover-page/active-filters/grade-levels/styles.scss

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{#each @context.activeFilter as |item|}}
2+
<DiscoverPage::ActiveFilters::Filter
3+
@item={{item}}
4+
@text={{item}}
5+
@ariaLabel={{t 'collections.discover_page.active_filters.remove_grade_levels'}}
6+
@removeFilterItem={{action this.removeFilterItem item}}
7+
/>
8+
{{/each}}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Collection from 'ember-osf-web/models/collection';
2+
import SearchFacetChecklist from '../checklist/component';
3+
4+
class GradeLevels extends SearchFacetChecklist {
5+
get modelAttribute(): keyof Collection {
6+
return 'gradeLevelsChoices';
7+
}
8+
get filterProperty() {
9+
return 'gradeLevels';
10+
}
11+
}
12+
13+
export default GradeLevels;

lib/collections/addon/discover/controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export default class Discover extends Controller {
7171
['program-area', 'program-area'],
7272
['status', 'status'],
7373
['volume', 'volume'],
74+
['grade-levels', 'grade-levels'],
7475
['study-design', 'study-design'],
7576
['school-type', 'school-type'],
7677
['data-type', 'data-type'],
@@ -105,6 +106,7 @@ export default class Discover extends Controller {
105106
programArea = '';
106107
status = '';
107108
volume = '';
109+
gradeLevels = '';
108110
studyDesign = '';
109111
schoolType = '';
110112
dataType = '';

mirage/factories/collection-submission.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ export default Factory.extend<MirageCollectionSubmission>({
7272
const volume = faker.random.arrayElement(collectionSubmission.collection.volumeChoices);
7373
collectionSubmission.update({ volume });
7474
}
75+
if (!collectionSubmission.gradeLevels) {
76+
const gradeLevels = faker.random.arrayElement(collectionSubmission.collection.gradeLevelsChoices);
77+
collectionSubmission.update({ gradeLevels });
78+
}
7579
if (!collectionSubmission.studyDesign) {
7680
const studyDesign = faker.random.arrayElement(collectionSubmission.collection.studyDesignChoices);
7781
collectionSubmission.update({ studyDesign });

mirage/factories/collection.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default Factory.extend<MirageCollection>({
2222
issueChoices: [faker.lorem.word(), faker.lorem.word()],
2323
statusChoices: [faker.lorem.word(), faker.lorem.word()],
2424
programAreaChoices: [faker.lorem.word(), faker.lorem.word()],
25+
gradeLevelsChoices: [faker.lorem.word(), faker.lorem.word()],
2526
studyDesignChoices: [faker.lorem.word(), faker.lorem.word()],
2627
schoolTypeChoices: [faker.lorem.word(), faker.lorem.word()],
2728
dataTypeChoices: [faker.lorem.word(), faker.lorem.word()],

mirage/views/collection-search.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function searchCollections(this: HandlerContext, schema: Schema, request:
1818
status,
1919
volume,
2020
schoolType,
21+
gradeLevels,
2122
studyDesign,
2223
dataType,
2324
disease,
@@ -78,6 +79,13 @@ export function searchCollections(this: HandlerContext, schema: Schema, request:
7879
),
7980
);
8081
}
82+
if (gradeLevels) {
83+
collectionSubmissions = collectionSubmissions.filter(
84+
(item: ModelInstance<CollectionSubmission>) => gradeLevels.any(
85+
(value: string) => item.attrs.gradeLevels === value,
86+
),
87+
);
88+
}
8189
if (studyDesign) {
8290
collectionSubmissions = collectionSubmissions.filter(
8391
(item: ModelInstance<CollectionSubmission>) => studyDesign.any(

0 commit comments

Comments
 (0)