Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-5879] Hide Categories Section for Draft Registrations #2360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/osf-components/addon/components/node-card/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
{{/if}}
{{/if}}

{{node-card/node-icon category=@node.category}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will remove it from regular nodes whiiiiich we may not be using anymore but I can't recall for sure. Maybe check @node.is_registration or similar and hide it if it's a registration.

{{#unless @node.isRegistration}}
{{node-card/node-icon category=@node.category}}
{{/unless}}
<OsfLink
local-class='osf-link {{if this.isMobile 'mobile'}}'
data-analytics-name='Title'
Expand Down
2 changes: 2 additions & 0 deletions lib/registries/addon/drafts/draft/metadata/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export default class RegistriesDraftMetadata extends Controller {
categoryOptions = Object.values(NodeCategory);
showAddContributorWidget = false;

hideCategories = true;

@not('media.isDesktop') showMobileView!: boolean;
osfUrl = config.OSF.url;

Expand Down
14 changes: 8 additions & 6 deletions lib/registries/addon/drafts/draft/metadata/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@
/>
{{/if}}
{{/let}}
<form.select data-test-metadata-category local-class='SchemaBlockDropdown' id='category'
@label={{t 'registries.registration_metadata.category'}} @valuePath='category'
@options={{this.categoryOptions}} @onchange={{perform this.draftManager.onMetadataInput}} as
|option|>
<NodeCategory @category={{option}} />
</form.select>
{{#unless this.hideCategories}}
<form.select data-test-metadata-category local-class='SchemaBlockDropdown' id='category'
@label={{t 'registries.registration_metadata.category'}} @valuePath='category'
@options={{this.categoryOptions}} @onchange={{perform this.draftManager.onMetadataInput}} as
|option|>
<NodeCategory @category={{option}} />
</form.select>
{{/unless}}
<fieldset id='affiliated_institutions'>
<legend>
{{t 'registries.registration_metadata.affiliated_institutions'}}
Expand Down
1 change: 0 additions & 1 deletion tests/engines/registries/acceptance/branded/new-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,5 @@ module('Registries | Acceptance | branded.new', hooks => {
assert.dom('[data-test-contributor-link]').exists({ count: 1 }, 'Only one contributor');
assert.dom('[data-test-contributor-permission]').containsText('Administrator', 'user is admin');
assert.dom('[data-test-contributor-citation]').containsText('Yes', 'user is bibliographic');
assert.dom('[data-test-option="uncategorized"]').exists('Category is uncategorized by default');
});
});
16 changes: 0 additions & 16 deletions tests/engines/registries/acceptance/draft/draft-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,16 +945,6 @@ module('Registries | Acceptance | draft form', hooks => {
assert.dom('[data-test-validation-errors="description"]')
.exists('error in description appears after removing valid string to blank string');

// Choose category and add a tag
await click('[data-test-metadata-category] > div');
await percySnapshot('Registries | Acceptance | draft form | metadata editing | metadata: categories opened');
assert.dom('[data-option-index="1"]').containsText('Other');
await click('[data-option-index="1"]');

await click('[data-test-metadata-tags]');
await fillIn('[data-test-metadata-tags] input', 'ragtagbag');
await triggerKeyEvent('[data-test-metadata-tags] input', 'keydown', 'Enter');

// No errors for nodelicense fields
assert.dom('[data-test-validation-errors="subjects"]')
.doesNotExist('no error for required fields that user has yet to change: subjects');
Expand All @@ -970,12 +960,6 @@ module('Registries | Acceptance | draft form', hooks => {
assert.dom('[data-test-validation-errors="subjects"]');
assert.dom('[data-test-validation-errors="license"]');

// Category and tag added appear on review page
assert.dom('[data-test-review-response="category"]')
.containsText('Other', 'category that was selected in metadata page shows up in review');
assert.dom('[data-test-tags-widget-tag="ragtagbag"]')
.exists('tag added in metadata shows up in review page');

// Return to Metadata page and address errors for subjects and license
await click('[data-test-link="metadata"]');

Expand Down
Loading