Skip to content

Commit c526069

Browse files
futa-ikedaadlius
authored andcommitted
Update Preprint label to Paper for yale law school
1 parent 8839c88 commit c526069

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

lib/osf-components/addon/components/search-page/component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ export default class SearchPage extends Component<SearchArgs> {
158158
return this.sortOptions.find(option => option.value === this.sort);// || this.sortOptions[0];
159159
}
160160

161+
get preprintLabel() {
162+
if (this.args.institution?.id === 'yls') {
163+
return this.intl.t('documentType.paper.pluralCapitalized');
164+
}
165+
return this.intl.t('search.resource-type.preprints');
166+
}
167+
161168
// Resource type
162169
defaultResourceTypeOptions: ResourceTypeOption[] = [
163170
{
@@ -173,7 +180,7 @@ export default class SearchPage extends Component<SearchArgs> {
173180
value: ResourceTypeFilterValue.Registrations,
174181
},
175182
{
176-
display: this.intl.t('search.resource-type.preprints'),
183+
display: this.preprintLabel,
177184
value: ResourceTypeFilterValue.Preprints,
178185
},
179186
{

lib/osf-components/addon/components/search-page/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ as |layout|>
227227
<LoadingIndicator @size='large' @dark={{true}} />
228228
{{else}}
229229
{{#each this.searchResults as |item|}}
230-
<SearchResultCard @result={{item}} @provider={{@provider}} />
230+
<SearchResultCard @result={{item}} @provider={{@provider}} @institution={{@institution}} />
231231
{{else}}
232232
<div local-class='no-results'>
233233
<p data-test-search-page-no-results>{{t 'search.no-results'}}</p>

lib/osf-components/addon/components/search-result-card/component.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Intl from 'ember-intl/services/intl';
77

88
import SearchResultModel from 'ember-osf-web/models/search-result';
99
import PreprintProviderModel from 'ember-osf-web/models/preprint-provider';
10+
import InstitutionModel from 'ember-osf-web/models/institution';
1011

1112

1213
const CardLabelTranslationKeys = {
@@ -23,6 +24,7 @@ const CardLabelTranslationKeys = {
2324
interface Args {
2425
result: SearchResultModel;
2526
provider?: PreprintProviderModel;
27+
institution?: InstitutionModel;
2628
}
2729

2830
export default class SearchResultCard extends Component<Args> {
@@ -37,10 +39,17 @@ export default class SearchResultCard extends Component<Args> {
3739
}
3840

3941
get cardTypeLabel() {
40-
const provider = this.args.provider;
42+
const { provider, institution } = this.args;
4143
const resourceType = this.args.result.resourceType;
42-
return (provider?.preprintWord && resourceType === 'preprint') ? provider.documentType.singularCapitalized :
43-
this.intl.t(CardLabelTranslationKeys[resourceType]);
44+
if (resourceType === 'preprint') {
45+
if (institution?.id === 'yls') {
46+
return this.intl.t('documentType.paper.singularCapitalized');
47+
}
48+
if (provider?.preprintWord) {
49+
return provider.documentType.singularCapitalized;
50+
}
51+
}
52+
return this.intl.t(CardLabelTranslationKeys[resourceType]);
4453
}
4554

4655
get secondaryMetadataComponent() {

mirage/factories/institution.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export default Factory.extend<Institution & InstitutionTraits>({
2828
},
2929
iri: faker.internet.url,
3030
rorIri: faker.internet.url,
31+
iris: [faker.internet.url],
32+
3133
withMetrics: trait<Institution>({
3234
afterCreate(institution, server) {
3335
const userMetrics = server.createList('institution-user', 15);

0 commit comments

Comments
 (0)