From bfb3f1279f3dc1e954a8de9a0322ed54a98cb66e Mon Sep 17 00:00:00 2001 From: futa-ikeda <51409893+futa-ikeda@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:12:07 -0400 Subject: [PATCH 1/6] [ENG-4760] User secondary metadata (#2031) * Add preprint relation to users * Update result card for user info * Group dt and dl a little closer * CR feedback; Refactor secondary metatadata components * CR feedback; Add test selector * Better refactor * Remove leftover arg --- app/models/index-card.ts | 51 ++++++++++++++++++- app/models/search-result.ts | 6 ++- app/models/user.ts | 4 ++ .../addon/components/search-page/template.hbs | 2 +- .../search-result-card/component.ts | 29 +++++++++-- .../preprint-secondary-metadata/template.hbs | 1 - .../project-secondary-metadata/template.hbs | 2 +- .../components/search-result-card/styles.scss | 7 ++- .../search-result-card/template.hbs | 42 ++++++++------- .../user-secondary-metadata/component.ts | 43 ++++++++++++++++ .../user-secondary-metadata/template.hbs | 24 +++++++++ .../user-secondary-metadata/component.js | 1 + .../user-secondary-metadata/template.js | 1 + mirage/serializers/user.ts | 8 +++ translations/en-us.yml | 7 +++ 15 files changed, 194 insertions(+), 34 deletions(-) create mode 100644 lib/osf-components/addon/components/search-result-card/user-secondary-metadata/component.ts create mode 100644 lib/osf-components/addon/components/search-result-card/user-secondary-metadata/template.hbs create mode 100644 lib/osf-components/app/components/search-result-card/user-secondary-metadata/component.js create mode 100644 lib/osf-components/app/components/search-result-card/user-secondary-metadata/template.js diff --git a/app/models/index-card.ts b/app/models/index-card.ts index 15b179cd90d..3f64d81888a 100644 --- a/app/models/index-card.ts +++ b/app/models/index-card.ts @@ -1,9 +1,15 @@ +import { getOwner } from '@ember/application'; import { inject as service } from '@ember/service'; +import { waitFor } from '@ember/test-waiters'; import Model, { AsyncHasMany, attr, hasMany } from '@ember-data/model'; +import { dropTask } from 'ember-concurrency'; import IntlService from 'ember-intl/services/intl'; import GetLocalizedPropertyHelper from 'ember-osf-web/helpers/get-localized-property'; -import { getOwner } from '@ember/application'; +import config from 'ember-osf-web/config/environment'; +import OsfModel from 'ember-osf-web/models/osf-model'; +import { tracked } from 'tracked-built-ins'; +const osfUrl = config.OSF.url; export interface LanguageText { '@language': string; @@ -23,10 +29,28 @@ export default class IndexCardModel extends Model { getLocalizedString = new GetLocalizedPropertyHelper(getOwner(this)); + @tracked osfModel?: OsfModel; + get resourceId() { return this.resourceIdentifier[0]; } + get osfModelType() { + const types = this.resourceMetadata.resourceType.map( (item: any) => item['@id']); + if (types.includes('Project') || types.includes('ProjectComponent')) { + return 'node'; + } else if (types.includes('Registration') || types.includes('RegistrationComponent')) { + return 'registration'; + } else if (types.includes('Preprint')) { + return 'preprint'; + } else if (types.includes('Person') || types.includes('Agent')) { + return 'user'; + } else if(types.includes('File')) { + return 'file'; + } + return null; + } + get label() { const possibleLabelKeys = ['displayLabel', 'name', 'title']; for (const key of possibleLabelKeys) { @@ -44,6 +68,31 @@ export default class IndexCardModel extends Model { } return ''; } + + @dropTask + @waitFor + async getOsfModel(options?: object) { + const identifier = this.resourceIdentifier; + if (identifier && this.osfModelType) { + const guid = this.guidFromIdentifierList(identifier); + if (guid) { + const osfModel = await this.store.findRecord(this.osfModelType, guid, options); + this.osfModel = osfModel; + } + } + } + + guidFromIdentifierList() { + for (const iri of this.resourceIdentifier) { + if (iri && iri.startsWith(osfUrl)) { + const pathSegments = iri.slice(osfUrl.length).split('/').filter(Boolean); + if (pathSegments.length === 1) { + return pathSegments[0]; // one path segment; looks like osf-id + } + } + } + return null; + } } declare module 'ember-data/types/registries/model' { diff --git a/app/models/search-result.ts b/app/models/search-result.ts index d3a5fa9412e..c21c51f1a57 100644 --- a/app/models/search-result.ts +++ b/app/models/search-result.ts @@ -73,11 +73,15 @@ export default class SearchResultModel extends Model { return this.resourceMetadata['@id']; } + // returns list of affilated institutions for users // returns list of contributors for osf objects // returns list of affiliated institutions for osf users get affiliatedEntities() { if (this.resourceType === 'user') { - // return something + if (this.resourceMetadata.affiliation) { + return this.resourceMetadata.affiliation.map((item: any) => + ({ name: item.name[0]['@value'], absoluteUrl: item['@id'] })); + } } else if (this.resourceMetadata.creator) { return this.resourceMetadata.creator?.map((item: any) => ({ name: item.name[0]['@value'], absoluteUrl: item['@id'] })); diff --git a/app/models/user.ts b/app/models/user.ts index 1c7e2f945f1..b02912bacfe 100644 --- a/app/models/user.ts +++ b/app/models/user.ts @@ -4,6 +4,7 @@ import { buildValidations, validator } from 'ember-cp-validations'; import config from 'ember-osf-web/config/environment'; import { Link } from 'jsonapi-typescript'; +import PreprintModel from 'ember-osf-web/models/preprint'; import SparseNodeModel from 'ember-osf-web/models/sparse-node'; import ContributorModel from './contributor'; import DraftRegistrationModel from './draft-registration'; @@ -114,6 +115,9 @@ export default class UserModel extends OsfModel.extend(Validations) { @hasMany('draft-registration') draftRegistrations!: AsyncHasMany; + @hasMany('preprint') + preprints!: AsyncHasMany; + @hasMany('institution', { inverse: 'users' }) institutions!: AsyncHasMany; diff --git a/lib/osf-components/addon/components/search-page/template.hbs b/lib/osf-components/addon/components/search-page/template.hbs index 047377bbdba..1c69cadb328 100644 --- a/lib/osf-components/addon/components/search-page/template.hbs +++ b/lib/osf-components/addon/components/search-page/template.hbs @@ -230,7 +230,7 @@ as |layout|> {{else}}
-

{{t 'search.no-results'}}

+

{{t 'search.no-results'}}

{{/each}} {{/if}} diff --git a/lib/osf-components/addon/components/search-result-card/component.ts b/lib/osf-components/addon/components/search-result-card/component.ts index d487ff36a03..a0af4a4941d 100644 --- a/lib/osf-components/addon/components/search-result-card/component.ts +++ b/lib/osf-components/addon/components/search-result-card/component.ts @@ -1,17 +1,23 @@ import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; +import Store from '@ember-data/store'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; -import SearchResultModel from 'ember-osf-web/models/search-result'; -import { inject as service } from '@ember/service'; import Intl from 'ember-intl/services/intl'; +import SearchResultModel from 'ember-osf-web/models/search-result'; +import UserModel from 'ember-osf-web/models/user'; + interface Args { result: SearchResultModel; } export default class SearchResultCard extends Component { @service intl!: Intl; + @service store!: Store; + @tracked isOpenSecondaryMetadata = false; + @tracked osfUser?: UserModel; @action toggleSecondaryMetadata() { @@ -22,10 +28,23 @@ export default class SearchResultCard extends Component { return this.intl.t(`osf-components.search-result-card.${this.args.result.resourceType}`); } - // not sure if this is the best way, as there was a resourceType of "unknown" out in the wild get secondaryMetadataComponent() { const { resourceType } = this.args.result; - - return `search-result-card/${resourceType.replace('_component', '')}-secondary-metadata`; + switch (resourceType) { + case 'project': + case 'project_component': + return 'search-result-card/project-secondary-metadata'; + case 'registration': + case 'registration_component': + return 'search-result-card/registration-secondary-metadata'; + case 'preprint': + return 'search-result-card/preprint-secondary-metadata'; + case 'file': + return 'search-result-card/file-secondary-metadata'; + case 'user': + return 'search-result-card/user-secondary-metadata'; + default: + return null; + } } } diff --git a/lib/osf-components/addon/components/search-result-card/preprint-secondary-metadata/template.hbs b/lib/osf-components/addon/components/search-result-card/preprint-secondary-metadata/template.hbs index 5ed73f65c5d..d67af09a99f 100644 --- a/lib/osf-components/addon/components/search-result-card/preprint-secondary-metadata/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/preprint-secondary-metadata/template.hbs @@ -90,4 +90,3 @@ {{/if}} - diff --git a/lib/osf-components/addon/components/search-result-card/project-secondary-metadata/template.hbs b/lib/osf-components/addon/components/search-result-card/project-secondary-metadata/template.hbs index 87a2d0a1b6c..f0b29589063 100644 --- a/lib/osf-components/addon/components/search-result-card/project-secondary-metadata/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/project-secondary-metadata/template.hbs @@ -57,4 +57,4 @@ {{/if}} - \ No newline at end of file + diff --git a/lib/osf-components/addon/components/search-result-card/styles.scss b/lib/osf-components/addon/components/search-result-card/styles.scss index 2a53b47ab83..8787c6c5670 100644 --- a/lib/osf-components/addon/components/search-result-card/styles.scss +++ b/lib/osf-components/addon/components/search-result-card/styles.scss @@ -80,8 +80,11 @@ padding-top: 10px; } - dt, - dd { + dt { margin: 15px 0 0 5px; } + + dd { + margin-left: 5px; + } } diff --git a/lib/osf-components/addon/components/search-result-card/template.hbs b/lib/osf-components/addon/components/search-result-card/template.hbs index ea6ba3e1f93..65911c42eba 100644 --- a/lib/osf-components/addon/components/search-result-card/template.hbs +++ b/lib/osf-components/addon/components/search-result-card/template.hbs @@ -5,27 +5,25 @@
{{this.cardTypeLabel}}
- {{#if (not-eq @result.resourceType 'user')}} - - {{/if}} +

{{@result.displayTitle}} @@ -104,4 +102,4 @@ {{/let}} - \ No newline at end of file + diff --git a/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/component.ts b/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/component.ts new file mode 100644 index 00000000000..b03c0a09f3a --- /dev/null +++ b/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/component.ts @@ -0,0 +1,43 @@ +import { inject as service } from '@ember/service'; +import Store from '@ember-data/store'; +import Component from '@glimmer/component'; +import Intl from 'ember-intl/services/intl'; +import { taskFor } from 'ember-concurrency-ts'; + +import SearchResultModel from 'ember-osf-web/models/search-result'; +import UserModel from 'ember-osf-web/models/user'; +import { alias } from '@ember/object/computed'; +import { task } from 'ember-concurrency'; +import { waitFor } from '@ember/test-waiters'; + +interface Args { + result: SearchResultModel; +} + +export default class UserSecondaryMetadata extends Component { + @service intl!: Intl; + @service store!: Store; + + @alias('args.result.indexCard.osfModel') user?: UserModel; + + constructor(owner: unknown, args: Args) { + super(owner, args); + if (!this.user) { + taskFor(this.getOsfUserModel).perform(); + } + } + + @task + @waitFor + async getOsfUserModel() { + const options = { + adapterOptions: { + query: { + related_counts: 'nodes,registrations,preprints', + }, + }, + reload: true, + }; + await taskFor(this.args.result.indexCard.get('getOsfModel')).perform(options); + } +} diff --git a/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/template.hbs b/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/template.hbs new file mode 100644 index 00000000000..3b29069da0a --- /dev/null +++ b/lib/osf-components/addon/components/search-result-card/user-secondary-metadata/template.hbs @@ -0,0 +1,24 @@ +{{#if this.getOsfUserModel.isRunning}} + +{{else if this.getOsfUserModel.isError}} + {{t 'osf-components.search-result-card.fetch_user_error'}} +{{else if (not this.user)}} + {{t 'osf-components.search-result-card.no_user'}} +{{else}} +
+ {{#if this.user.employment.length}} +
{{t 'osf-components.search-result-card.employment'}}
+
{{this.user.employment.[0].institution}}
+ {{/if}} + {{#if this.user.education.length}} +
{{t 'osf-components.search-result-card.education'}}
+
{{this.user.education.[0].institution}}
+ {{/if}} +
{{t 'osf-components.search-result-card.public_projects'}}
+
{{this.user.relatedCounts.nodes}}
+
{{t 'osf-components.search-result-card.public_registrations'}}
+
{{this.user.relatedCounts.registrations}}
+
{{t 'osf-components.search-result-card.public_preprints'}}
+
{{this.user.relatedCounts.preprints}}
+
+{{/if}} diff --git a/lib/osf-components/app/components/search-result-card/user-secondary-metadata/component.js b/lib/osf-components/app/components/search-result-card/user-secondary-metadata/component.js new file mode 100644 index 00000000000..ba01e369bdf --- /dev/null +++ b/lib/osf-components/app/components/search-result-card/user-secondary-metadata/component.js @@ -0,0 +1 @@ +export { default } from 'osf-components/components/search-result-card/user-secondary-metadata/component'; diff --git a/lib/osf-components/app/components/search-result-card/user-secondary-metadata/template.js b/lib/osf-components/app/components/search-result-card/user-secondary-metadata/template.js new file mode 100644 index 00000000000..342377bcb97 --- /dev/null +++ b/lib/osf-components/app/components/search-result-card/user-secondary-metadata/template.js @@ -0,0 +1 @@ +export { default } from 'osf-components/components/search-result-card/user-secondary-metadata/template'; diff --git a/mirage/serializers/user.ts b/mirage/serializers/user.ts index 4036c9df063..fef5af248b8 100644 --- a/mirage/serializers/user.ts +++ b/mirage/serializers/user.ts @@ -58,6 +58,14 @@ export default class UserSerializer extends ApplicationSerializer { }, }, }, + preprints: { + links: { + related: { + href: `${apiUrl}/v2/users/${model.id}/preprints/`, + meta: this.buildRelatedLinkMeta(model, 'preprints'), + }, + }, + }, }; if (model.defaultRegion) { serializedRelationships.defaultRegion = { diff --git a/translations/en-us.yml b/translations/en-us.yml index 99c02c3ec78..d6a4b1533e5 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -1896,6 +1896,13 @@ osf-components: withdrawn: Withdrawn unknown: Unknown remaining_count: '{count} more' + fetch_user_error: 'Unable to fetch user information from OSF' + no_user: 'No user' + employment: Employment + education: Education + public_projects: Public projects + public_registrations: Public registrations + public_preprints: Public preprints resources-list: add_instructions: 'Link a DOI from a repository to your registration by clicking the green “+” button.' add_instructions_adhere: 'Contributors affirmed to adhere to the criteria for each badge.' From 22d60ef2ec8436cf768774e41e02c7108f6d1bcb Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Fri, 13 Oct 2023 14:02:13 -0400 Subject: [PATCH 2/6] feature: include creator.name in free-text search --- lib/osf-components/addon/components/search-page/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/search-page/component.ts b/lib/osf-components/addon/components/search-page/component.ts index 80491840810..baa4c46be03 100644 --- a/lib/osf-components/addon/components/search-page/component.ts +++ b/lib/osf-components/addon/components/search-page/component.ts @@ -240,7 +240,7 @@ export default class SearchPage extends Component { } this.filterQueryObject = filterQueryObject; const searchResult = await this.store.queryRecord('index-card-search', { - cardSearchText, + 'cardSearchText[*,creator.name]': cardSearchText, 'page[cursor]': page, sort, cardSearchFilter: filterQueryObject, From 32135eae5e9c155ef6ec7959f5232ba6ee02a750 Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Fri, 13 Oct 2023 14:02:45 -0400 Subject: [PATCH 3/6] fix: skip showing "top" values for creator facet --- .../search-page/filter-facet/component.ts | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/osf-components/addon/components/search-page/filter-facet/component.ts b/lib/osf-components/addon/components/search-page/filter-facet/component.ts index 3367e679bc3..18a0070c4fe 100644 --- a/lib/osf-components/addon/components/search-page/filter-facet/component.ts +++ b/lib/osf-components/addon/components/search-page/filter-facet/component.ts @@ -48,12 +48,21 @@ export default class FilterFacet extends Component { @tracked hasMoreValueOptions = false; @tracked nextPageCursor = ''; + get shouldShowTopValues() { + const { args: { property: { propertyPathKey } } } = this; + return propertyPathKey !== 'creator'; + } + @action toggleFacet() { - if (this.filterableValues.length === 0 && !taskFor(this.fetchFacetValues).lastComplete) { - taskFor(this.fetchFacetValues).perform(); + if (this.shouldShowTopValues) { + if (this.filterableValues.length === 0 && !taskFor(this.fetchFacetValues).lastComplete) { + taskFor(this.fetchFacetValues).perform(); + } + this.collapsed = !this.collapsed; + } else { + this.openSeeMoreModal(); } - this.collapsed = !this.collapsed; } @action @@ -105,8 +114,14 @@ export default class FilterFacet extends Component { @waitFor async fetchFacetValues() { const { cardSearchText, cardSearchFilter, property } = this.args; - const { page, sort, filterString } = this; - + const { page, sort, filterString, shouldShowTopValues } = this; + if (!shouldShowTopValues && !filterString.trim()) { + this.filterableValues = []; + this.modalValueOptions = []; + this.hasMoreValueOptions = false; + this.nextPageCursor = ''; + return; // skip fetching + } const valueSearch = await this.store.queryRecord('index-value-search', { cardSearchText, cardSearchFilter, From 375569109902623e8a7ef19475ace9721cc66a4c Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Fri, 13 Oct 2023 15:36:55 -0400 Subject: [PATCH 4/6] fix: z-index shenaningans the contents of an ember-basic-dropdown have `z-index: 1000`, while an osf-dialog had `z-index: 1100` -- when a dropdown is inside a dialog, this is a problem (the dropdown is hidden behind the dialog) however, osf-dialog should be in front of the branded navbar, which has `z-index: 999` -- this fix bumps branded-navbar down to `998` and osf-dialog down to `999`, both safely behind the dropdown at `1000`. --- lib/app-components/addon/components/branded-navbar/styles.scss | 2 +- lib/osf-components/addon/components/osf-dialog/styles.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app-components/addon/components/branded-navbar/styles.scss b/lib/app-components/addon/components/branded-navbar/styles.scss index f67cc0a7433..e14d214d3db 100644 --- a/lib/app-components/addon/components/branded-navbar/styles.scss +++ b/lib/app-components/addon/components/branded-navbar/styles.scss @@ -2,7 +2,7 @@ .branded-nav-wrapper { .branded-nav { - z-index: 999; + z-index: 998; } :global(.navbar) { diff --git a/lib/osf-components/addon/components/osf-dialog/styles.scss b/lib/osf-components/addon/components/osf-dialog/styles.scss index bd6ad0cbb23..aad404cf2bf 100644 --- a/lib/osf-components/addon/components/osf-dialog/styles.scss +++ b/lib/osf-components/addon/components/osf-dialog/styles.scss @@ -11,7 +11,7 @@ align-items: center; justify-content: center; - z-index: 1100; + z-index: 999; background-color: rgba(0, 0, 0, 0.5); } From 84f1598d3ac4c84254639541f94b08f8f1412409 Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Wed, 18 Oct 2023 10:54:39 -0400 Subject: [PATCH 5/6] feature: include isContainedBy.creator.name in free-text search --- lib/osf-components/addon/components/search-page/component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/osf-components/addon/components/search-page/component.ts b/lib/osf-components/addon/components/search-page/component.ts index baa4c46be03..521573d109d 100644 --- a/lib/osf-components/addon/components/search-page/component.ts +++ b/lib/osf-components/addon/components/search-page/component.ts @@ -240,7 +240,7 @@ export default class SearchPage extends Component { } this.filterQueryObject = filterQueryObject; const searchResult = await this.store.queryRecord('index-card-search', { - 'cardSearchText[*,creator.name]': cardSearchText, + 'cardSearchText[*,creator.name,isContainedBy.creator.name]': cardSearchText, 'page[cursor]': page, sort, cardSearchFilter: filterQueryObject, From f4fb63854ecc60dfb8eb5cda08ea80e4843d0ce1 Mon Sep 17 00:00:00 2001 From: Abram Booth Date: Thu, 19 Oct 2023 11:07:54 -0400 Subject: [PATCH 6/6] feature: display affiliations in the creator facet --- .../search-page/filter-facet/template.hbs | 3 ++- .../filter-facet/value-option/component.ts | 17 +++++++++++++++++ .../filter-facet/value-option/styles.scss | 8 ++++++++ .../filter-facet/value-option/template.hbs | 6 ++++++ .../filter-facet/value-option/component.js | 1 + .../filter-facet/value-option/template.js | 2 ++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 lib/osf-components/addon/components/search-page/filter-facet/value-option/component.ts create mode 100644 lib/osf-components/addon/components/search-page/filter-facet/value-option/styles.scss create mode 100644 lib/osf-components/addon/components/search-page/filter-facet/value-option/template.hbs create mode 100644 lib/osf-components/app/components/search-page/filter-facet/value-option/component.js create mode 100644 lib/osf-components/app/components/search-page/filter-facet/value-option/template.js diff --git a/lib/osf-components/addon/components/search-page/filter-facet/template.hbs b/lib/osf-components/addon/components/search-page/filter-facet/template.hbs index 45c6ffa6c49..b146fa39a99 100644 --- a/lib/osf-components/addon/components/search-page/filter-facet/template.hbs +++ b/lib/osf-components/addon/components/search-page/filter-facet/template.hbs @@ -86,9 +86,10 @@ @search={{perform this.debouncedValueSearch}} @onChange={{action this.updateSelectedProperty}} @afterOptionsComponent={{component 'search-page/filter-facet/after-options' fetchValues=(perform this.loadMoreValues) hasMoreValues=this.hasMoreValueOptions}} + @selectedItemComponent={{component 'search-page/filter-facet/value-option' isSelected=true}} as |property| > - {{property.indexCard.label}} ({{property.cardSearchResultCount}}) + diff --git a/lib/osf-components/addon/components/search-page/filter-facet/value-option/component.ts b/lib/osf-components/addon/components/search-page/filter-facet/value-option/component.ts new file mode 100644 index 00000000000..fab5e16e335 --- /dev/null +++ b/lib/osf-components/addon/components/search-page/filter-facet/value-option/component.ts @@ -0,0 +1,17 @@ +import Component from '@glimmer/component'; + +import SearchResultModel from 'ember-osf-web/models/search-result'; + +interface ValueOptionArgs { + option: SearchResultModel; + isSelected?: Boolean; +} + +export default class ValueOption extends Component { + get additionalDetail() { + const { affiliation: affiliatedEntities = [] } = this.args.option.resourceMetadata; + return affiliatedEntities.flatMap( + (entity: any) => entity.name?.map((name: any) => name['@value']), + ).filter(Boolean).join(', '); + } +} diff --git a/lib/osf-components/addon/components/search-page/filter-facet/value-option/styles.scss b/lib/osf-components/addon/components/search-page/filter-facet/value-option/styles.scss new file mode 100644 index 00000000000..7a384863983 --- /dev/null +++ b/lib/osf-components/addon/components/search-page/filter-facet/value-option/styles.scss @@ -0,0 +1,8 @@ +.SelectedValueOption { + margin-left: 0.5em; +} + +.AdditionalDetail { + margin-left: 0.5em; + font-size: 0.8em; +} diff --git a/lib/osf-components/addon/components/search-page/filter-facet/value-option/template.hbs b/lib/osf-components/addon/components/search-page/filter-facet/value-option/template.hbs new file mode 100644 index 00000000000..6138e471bd3 --- /dev/null +++ b/lib/osf-components/addon/components/search-page/filter-facet/value-option/template.hbs @@ -0,0 +1,6 @@ +
+
{{@option.indexCard.label}} ({{@option.cardSearchResultCount}})
+ {{#if this.additionalDetail}} +
{{this.additionalDetail}}
+ {{/if}} +
diff --git a/lib/osf-components/app/components/search-page/filter-facet/value-option/component.js b/lib/osf-components/app/components/search-page/filter-facet/value-option/component.js new file mode 100644 index 00000000000..9ec98fbbb3b --- /dev/null +++ b/lib/osf-components/app/components/search-page/filter-facet/value-option/component.js @@ -0,0 +1 @@ +export { default } from 'osf-components/components/search-page/filter-facet/value-option/component'; diff --git a/lib/osf-components/app/components/search-page/filter-facet/value-option/template.js b/lib/osf-components/app/components/search-page/filter-facet/value-option/template.js new file mode 100644 index 00000000000..fba5f7ce813 --- /dev/null +++ b/lib/osf-components/app/components/search-page/filter-facet/value-option/template.js @@ -0,0 +1,2 @@ +export { default } from 'osf-components/components/search-page/filter-facet/value-option/template'; +