Skip to content

Commit b929c6b

Browse files
authored
Show "Add New" button for OSFRegistries
## Purpose - Allow users to create a draft registration to OSF Registries by using the Add New button ## Summary of Changes - Show Add New button when looking at OSF Registries ## QA Notes - Add New button will be visible on `osf.io/registries/discover` route. This button will take users to `osf.io/registries/osf/new` and users should be able to submit to OSF registries from there
1 parent 9347dbe commit b929c6b

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

lib/registries/addon/components/registries-navbar/component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import registriesConfig from 'registries/config/environment';
1717

1818
import template from './template';
1919

20-
const { externalLinks } = registriesConfig;
20+
const { externalLinks, defaultProviderId } = registriesConfig;
2121
const {
2222
featureFlagNames: {
2323
egapAdmins,
@@ -35,15 +35,21 @@ export default class RegistriesNavbar extends AuthBase {
3535

3636
@and('media.isMobile', 'searchDropdownOpen') showSearchDropdown!: boolean;
3737

38+
@computed('provider')
39+
get providerId() {
40+
return this.provider ? this.provider.id : defaultProviderId;
41+
}
42+
3843
@computed('media.isMobile', 'provider.brand')
3944
get shouldShowProviderName() {
4045
return !this.media.isMobile && this.provider && this.provider.brand;
4146
}
4247

4348
@computed('provider.{allowSubmissions,id}')
4449
get showAddRegistrationButton() {
50+
// Check if this is OSF Registries
4551
if (!this.provider) {
46-
return false;
52+
return true;
4753
}
4854
if (this.provider.id === 'egap') {
4955
return this.features.isEnabled(camelize(egapAdmins));

lib/registries/addon/components/registries-navbar/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
data-analytics-name='Create new registration'
7676
local-class='SecondaryNavLinkButton'
7777
@route='registries.branded.new'
78-
@models={{array this.provider.id}}
78+
@models={{array this.providerId}}
7979
>
8080
{{t 'navbar.add_registration'}}
8181
</nav.links.secondary>

lib/registries/config/environment.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare const config: {
1515
help: string;
1616
donate: string;
1717
};
18+
defaultProviderId: string;
1819
};
1920

2021
export default config;

lib/registries/config/environment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module.exports = function(environment) {
4646
help: 'https://openscience.zendesk.com/hc/en-us/categories/360001550953',
4747
donate: 'https://cos.io/donate',
4848
},
49+
defaultProviderId: 'osf',
4950
};
5051

5152
if (environment === 'test') {

0 commit comments

Comments
 (0)