Skip to content

Commit a62d10f

Browse files
authored
[ENG-3243][ENG-3417] Revisions bugfixes (#1359)
* Better color contrast for create button * Wording changes * Another wording change * Close dropdown when choosing revision in dropdown * Add data-test selectors to delete-modal * Add quick test for delete-button * Remove redundant label for registrations needing moderation
1 parent fe1b2e0 commit a62d10f

File tree

8 files changed

+49
-9
lines changed

8 files changed

+49
-9
lines changed

app/styles/_variables.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $brand-warning: #f0ad4e !default;
3131
$brand-danger: #d9534f;
3232

3333
/* overrides with darkened colors for a11y contrast */
34-
$brand-success: darken($brand-success, 10%);
34+
$brand-success: darken($brand-success, 20%);
3535
$brand-info: darken($brand-info, 15%);
3636
// no override needed for brand-warning (will use dark text instead)
3737
$brand-danger: darken($brand-danger, 15%);

lib/osf-components/addon/components/delete-button/template.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
@onHide={{action this._cancel}}
4444
as |modal|
4545
>
46-
<modal.header>
46+
<modal.header data-test-delete-modal-header>
4747
<h3 local-class='Modal__title'>{{this.modalTitle}}</h3>
4848
</modal.header>
4949

50-
<modal.body data-analytics-scope='Delete button modal'>
50+
<modal.body data-test-delete-modal-body data-analytics-scope='Delete button modal'>
5151
{{#if (has-block)}}
5252
{{yield}}
5353
{{else}}
@@ -68,7 +68,7 @@
6868
{{/if}}
6969
</modal.body>
7070

71-
<modal.footer data-analytics-scope='Delete button modal footer'>
71+
<modal.footer data-test-delete-modal-footer data-analytics-scope='Delete button modal footer'>
7272
<BsButton
7373
data-analytics-name='Hard confirm cancel'
7474
data-test-cancel-delete

lib/osf-components/addon/components/node-card/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{{else if (eq @node.revisionState 'in_progress')}}
4343
<span class='label label-info'>{{t 'node_card.registration.statuses.revision_in_progress'}}</span> |
4444
{{else if (eq @node.revisionState 'pending_moderation')}}
45-
{{#if (not-eq @node.reviewsState 'pending_moderation')}}
45+
{{#if (not-eq @node.reviewsState 'pending')}}
4646
<span class='label label-info'>{{t 'node_card.registration.statuses.revision_pending_moderation'}}</span> |
4747
{{/if}}
4848
{{/if}}

lib/osf-components/addon/components/registries/update-dropdown/component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ export default class UpdateDropdown extends Component<Args> {
9393
this.showModal = false;
9494
}
9595

96+
@action
97+
onRevisionSelect(callback: () => void) {
98+
this.router.on('routeDidChange', () => {
99+
callback();
100+
});
101+
}
102+
96103
@task
97104
@waitFor
98105
async getRevisionList() {

lib/osf-components/addon/components/registries/update-dropdown/list-item/template.hbs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
{{#if this.shouldShow}}
22
<div data-test-revision-link={{@index}} local-class='UpdateContainer'>
33
{{!-- Using LinkTo instead of OsfLink due to how queryParams are buggy for setting active state --}}
4-
<LinkTo @route='overview.index' @query={{hash revisionId=@revision.id}} local-class='UpdateLink'>
4+
<LinkTo
5+
local-class='UpdateLink'
6+
{{on 'click' @onRevisionSelect}}
7+
@route='overview.index'
8+
@query={{hash revisionId=@revision.id}}
9+
>
510
<Registries::UpdateDropdown::UpdateLabel
611
@totalRevisions={{@totalRevisions}}
712
@index={{@index}}

lib/osf-components/addon/components/registries/update-dropdown/template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
{{#if this.revisions}}
2828
{{#each this.revisions as |revision index|}}
2929
<Registries::UpdateDropdown::ListItem
30+
@onRevisionSelect={{action this.onRevisionSelect dd.close}}
3031
@revision={{revision}}
3132
@isModeratorMode={{@isModeratorMode}}
3233
@totalRevisions={{this.totalRevisions}}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { click, render } from '@ember/test-helpers';
2+
import { hbs } from 'ember-cli-htmlbars';
3+
import { setupRenderingTest } from 'ember-qunit';
4+
import { module, test } from 'qunit';
5+
6+
module('Integration | Component | delete-button', hooks => {
7+
setupRenderingTest(hooks);
8+
9+
test('it renders', async function(assert) {
10+
await render(hbs`
11+
<DeleteButton
12+
@buttonLabel='Button here!'
13+
@modalTitle='Head'
14+
@modalBody='Shoulders'
15+
@cancelButtonText='Knees'
16+
@confirmButtonText='Toes'
17+
/>
18+
`);
19+
assert.dom('[data-test-delete-button]').hasText('Button here!');
20+
await click('[data-test-delete-button]');
21+
assert.dom('[data-test-delete-modal-header]').containsText('Head');
22+
assert.dom('[data-test-delete-modal-body]').hasText('Shoulders');
23+
assert.dom('[data-test-cancel-delete]').hasText('Knees');
24+
assert.dom('[data-test-confirm-delete]').hasText('Toes');
25+
await click('[data-test-confirm-delete]');
26+
});
27+
});

translations/en-us.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ node_card:
581581
statuses:
582582
revision_pending_moderation: 'Update pending moderation'
583583
revision_in_progress: 'Update in progress'
584-
revision_unapproved: 'Update pending unapproved'
584+
revision_unapproved: 'Update pending approval'
585585
pending_registration_approval: 'Pending registration approval'
586586
pending_embargo_approval: 'Pending embargo'
587587
pending: 'Pending moderation'
@@ -601,7 +601,7 @@ node_card:
601601
options: Options
602602
view_button: 'View'
603603
update_button: 'Update'
604-
view_changes_button: 'View changes'
604+
view_changes_button: 'Continue update'
605605
schema_response_error: 'Updates irretreivable.'
606606

607607
forks:
@@ -1608,7 +1608,7 @@ registries:
16081608
modalBodyFirst: 'Updates to registration responses can be updated by clicking “Next”.<br>Edits to metadata including Description, Category, License, Publication DOI, and Tags are done on the registration by clicking the '
16091609
modalBodySecond: ' icon.'
16101610
modalBodyNoUpdates: 'The {registryName} does not allow updates for this registration template.<br>Contact their registy if you have any questions.'
1611-
learnMore: 'Click <a href="https://help.osf.io/hc/en-us/articles/360035806634-Edit-Registration-Metadata" target="_blank">here</a> to learn more'
1611+
learnMore: 'Click <a href="https://help.osf.io/hc/en-us/articles/360035806634-Edit-Registration-Metadata" target="_blank">here</a> to learn more.'
16121612
next: Next
16131613
cancel_update: 'Cancel update'
16141614
meetings:

0 commit comments

Comments
 (0)