-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert registry, preprint and institution discover pages. (#1935)
* Revert "[ENG-4573] Registry discover (#1900)" This reverts commit 2ab39e0. * comment out institution discover and preprint routes * skip tests
- Loading branch information
Showing
49 changed files
with
2,251 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
lib/osf-components/addon/helpers/get-localized-property.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import Controller from '@ember/controller'; | ||
import RouterService from '@ember/routing/router-service'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import Features from 'ember-feature-flags/services/features'; | ||
|
||
import { OSFService } from 'osf-components/components/osf-navbar/component'; | ||
|
||
export default class Application extends Controller { | ||
@service features!: Features; | ||
@service router!: RouterService; | ||
|
||
activeService = OSFService.REGISTRIES; | ||
|
||
@action | ||
search(query: string) { | ||
this.transitionToRoute('discover', { | ||
queryParams: { query }, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,18 @@ | ||
import Store from '@ember-data/store'; | ||
// import EmberArray, { A } from '@ember/array'; | ||
import Controller from '@ember/controller'; | ||
import { action } from '@ember/object'; | ||
import { inject as service } from '@ember/service'; | ||
import Intl from 'ember-intl/services/intl'; | ||
import Media from 'ember-responsive'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { OnSearchParams } from 'osf-components/components/search-page/component'; | ||
import pathJoin from 'ember-osf-web/utils/path-join'; | ||
import config from 'ember-get-config'; | ||
import DiscoverController from 'registries/discover/controller'; | ||
|
||
export default class BrandedDiscover extends Controller.extend() { | ||
@service media!: Media; | ||
@service intl!: Intl; | ||
@service store!: Store; | ||
import { ShareTermsFilter } from 'registries/services/share-search'; | ||
|
||
@tracked cardSearchText? = ''; | ||
@tracked sort? = '-relevance'; | ||
@tracked page? = ''; | ||
|
||
queryParams = ['cardSearchText', 'page', 'sort']; | ||
|
||
get defaultQueryOptions() { | ||
return { | ||
publisher: pathJoin(config.OSF.url, 'registrations', this.model.id), | ||
}; | ||
export default class Discover extends DiscoverController { | ||
// this route uses the registries.discover page template where the custom branding is handled | ||
get providerModel() { | ||
return this.model; | ||
} | ||
|
||
@action | ||
onSearch(onSearchParams: OnSearchParams) { | ||
this.cardSearchText = onSearchParams.cardSearchText; | ||
this.page = onSearchParams.page; | ||
this.sort = onSearchParams.sort; | ||
get additionalFilters() { | ||
const { shareSource, name } = this.model; | ||
|
||
return [ | ||
new ShareTermsFilter('sources', shareSource, name), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.BrandedRegistriesSearchResult { | ||
composes: RegistriesSearchResult from '../../discover/styles'; | ||
|
||
svg { | ||
color: var(--primary-color); | ||
} | ||
} | ||
|
||
.Pagination { | ||
composes: Pagination from '../../discover/styles'; | ||
} |
55 changes: 55 additions & 0 deletions
55
lib/registries/addon/components/registries-discover-results-header/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
|
||
.results-container { | ||
composes: ResultsHeader from '../../discover/styles'; | ||
|
||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
width: 100%; | ||
|
||
.header { | ||
width: 50%; | ||
} | ||
|
||
.dropdown-container { | ||
width: 50%; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
align-items: flex-start; | ||
|
||
} | ||
} | ||
|
||
/** | ||
I have no idea why but these classes are needed just like they are spelled | ||
even though they do not exist in the hbs file. | ||
*/ | ||
.SortDropDown__List { | ||
composes: SortDropDown__List from '../../discover/styles'; | ||
} | ||
|
||
.SortDropDown__Option { | ||
composes: SortDropDown__Option from '../../discover/styles'; | ||
} | ||
|
||
.DropdownTrigger { | ||
composes: Button from 'osf-components/components/button/styles'; | ||
composes: MediumButton from 'osf-components/components/button/styles'; | ||
composes: SecondaryButton from 'osf-components/components/button/styles'; | ||
|
||
color: $color-text-black; | ||
|
||
// Recreate the browser focus state for buttons | ||
&:focus { | ||
outline: auto 2px Highlight; | ||
outline: auto 5px -webkit-focus-ring-color; | ||
} | ||
} | ||
|
||
.DropdownContent { | ||
border: 1px solid $color-border-gray; | ||
box-shadow: 0 1px 2px $primary-box-shadow; | ||
} |
33 changes: 33 additions & 0 deletions
33
lib/registries/addon/components/registries-discover-results-header/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div local-class='results-container'> | ||
<div local-class='header'> | ||
<h2 data-test-results-count> | ||
{{t 'registries.discover.registration_count' count=@totalResults}} | ||
</h2> | ||
</div> | ||
<div local-class='dropdown-container'> | ||
<ResponsiveDropdown as |dd|> | ||
<dd.trigger | ||
data-test-sort-dropdown | ||
data-analytics-name='Sort Registries Button{{if @provider (concat ' ' @provider.name)}}' | ||
local-class='DropdownTrigger' | ||
> | ||
{{t 'registries.discover.sort_by'}}: {{t @searchOptions.order.display}} | ||
<span role='button' aria-label='{{t 'registries.discover.sort_by'}}'><FaIcon @icon='caret-down' /></span> | ||
</dd.trigger> | ||
<dd.content local-class='DropdownContent'> | ||
{{#each @sortOptions as |option index|}} | ||
<div> | ||
<Button | ||
data-test-sort-option-id='{{index}}' | ||
local-class='SortDropDown__Option' | ||
{{on 'click' (fn @setOrder option)}} | ||
{{on 'click' dd.close}} | ||
> | ||
{{t option.display}} | ||
</Button> | ||
</div> | ||
{{/each}} | ||
</dd.content> | ||
</ResponsiveDropdown> | ||
</div> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
lib/registries/addon/components/registries-discover-search/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { A } from '@ember/array'; | ||
import Component from '@ember/component'; | ||
|
||
import { layout, requiredAction } from 'ember-osf-web/decorators/component'; | ||
import { SearchOptions } from 'registries/services/search'; | ||
import template from './template'; | ||
|
||
@layout(template) | ||
export default class Discover<T> extends Component { | ||
results = A<T>([]); | ||
searchOptions!: SearchOptions; | ||
@requiredAction onSearchOptionsUpdated!: (options: SearchOptions) => void; | ||
} |
12 changes: 12 additions & 0 deletions
12
lib/registries/addon/components/registries-discover-search/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.Discover__Body { | ||
background-color: #f5f5f5; | ||
border-top: 1px solid $color-border-gray; | ||
border-bottom: 1px solid #dedede; | ||
padding-bottom: 50px; | ||
padding-top: 50px; | ||
} | ||
|
||
.row { | ||
margin-right: -15px; | ||
margin-left: -15px; | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/registries/addon/components/registries-discover-search/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div local-class='Discover__Body'> | ||
<div class='container'> | ||
<div local-class='row'> | ||
{{yield (hash | ||
results=(component 'registries-discover-search/x-results' @results) | ||
sidebar=(component 'registries-discover-search/x-sidebar' | ||
searchOptions=@searchOptions | ||
additionalFilters=@additionalFilters | ||
provider=@provider | ||
onSearchOptionsUpdated=(action @onSearchOptionsUpdated) | ||
) | ||
)}} | ||
</div> | ||
</div> | ||
</div> |
11 changes: 11 additions & 0 deletions
11
lib/registries/addon/components/registries-discover-search/x-result/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Component from '@ember/component'; | ||
import { localClassNames } from 'ember-css-modules'; | ||
|
||
import { layout } from 'ember-osf-web/decorators/component'; | ||
import template from './template'; | ||
|
||
@layout(template) | ||
@localClassNames('SearchResult') | ||
export default class SearchResult<T> extends Component { | ||
result!: T; | ||
} |
10 changes: 10 additions & 0 deletions
10
lib/registries/addon/components/registries-discover-search/x-result/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.SearchResult { | ||
background: $color-bg-white; | ||
margin-bottom: 30px; | ||
word-wrap: break-word; | ||
word-break: break-word; | ||
overflow-wrap: break-word; | ||
box-shadow: 0 1px 2px #ddd; | ||
border-width: 0; | ||
padding: 10px; | ||
} |
1 change: 1 addition & 0 deletions
1
lib/registries/addon/components/registries-discover-search/x-result/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{yield @result}} |
24 changes: 24 additions & 0 deletions
24
lib/registries/addon/components/registries-discover-search/x-results/component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Component from '@ember/component'; | ||
import { action } from '@ember/object'; | ||
import { localClassNames } from 'ember-css-modules'; | ||
|
||
import { layout, requiredAction } from 'ember-osf-web/decorators/component'; | ||
import { SearchOptions } from 'registries/services/search'; | ||
|
||
import template from './template'; | ||
|
||
@layout(template) | ||
@localClassNames('SearchResults') | ||
export default class SearchResults<T> extends Component { | ||
static positionalParams = ['results']; | ||
|
||
searchOptions!: SearchOptions; | ||
@requiredAction onSearchOptionsUpdated!: (options: SearchOptions) => void; | ||
|
||
results!: T[]; | ||
|
||
@action | ||
_onSearchOptionsUpdated(options: SearchOptions) { | ||
this.onSearchOptionsUpdated(options); | ||
} | ||
} |
Empty file.
5 changes: 5 additions & 0 deletions
5
lib/registries/addon/components/registries-discover-search/x-results/template.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{#each @results as |result|}} | ||
{{#registries-discover-search/x-result result=result as |ctxResult|}} | ||
{{yield ctxResult}} | ||
{{/registries-discover-search/x-result}} | ||
{{/each}} |
Oops, something went wrong.