Skip to content
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
2 changes: 1 addition & 1 deletion app/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $brand-warning: #f0ad4e !default;
$brand-danger: #d9534f;

/* overrides with darkened colors for a11y contrast */
$brand-success: darken($brand-success, 10%);
$brand-success: darken($brand-success, 20%);
$brand-info: darken($brand-info, 15%);
// no override needed for brand-warning (will use dark text instead)
$brand-danger: darken($brand-danger, 15%);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
@onHide={{action this._cancel}}
as |modal|
>
<modal.header>
<modal.header data-test-delete-modal-header>
<h3 local-class='Modal__title'>{{this.modalTitle}}</h3>
</modal.header>

<modal.body data-analytics-scope='Delete button modal'>
<modal.body data-test-delete-modal-body data-analytics-scope='Delete button modal'>
{{#if (has-block)}}
{{yield}}
{{else}}
Expand All @@ -68,7 +68,7 @@
{{/if}}
</modal.body>

<modal.footer data-analytics-scope='Delete button modal footer'>
<modal.footer data-test-delete-modal-footer data-analytics-scope='Delete button modal footer'>
<BsButton
data-analytics-name='Hard confirm cancel'
data-test-cancel-delete
Expand Down
2 changes: 1 addition & 1 deletion lib/osf-components/addon/components/node-card/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{{else if (eq @node.revisionState 'in_progress')}}
<span class='label label-info'>{{t 'node_card.registration.statuses.revision_in_progress'}}</span> |
{{else if (eq @node.revisionState 'pending_moderation')}}
{{#if (not-eq @node.reviewsState 'pending_moderation')}}
{{#if (not-eq @node.reviewsState 'pending')}}
<span class='label label-info'>{{t 'node_card.registration.statuses.revision_pending_moderation'}}</span> |
{{/if}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ export default class UpdateDropdown extends Component<Args> {
this.showModal = false;
}

@action
onRevisionSelect(callback: () => void) {
this.router.on('routeDidChange', () => {
callback();
});
}

@task
@waitFor
async getRevisionList() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{{#if this.shouldShow}}
<div data-test-revision-link={{@index}} local-class='UpdateContainer'>
{{!-- Using LinkTo instead of OsfLink due to how queryParams are buggy for setting active state --}}
<LinkTo @route='overview.index' @query={{hash revisionId=@revision.id}} local-class='UpdateLink'>
<LinkTo
local-class='UpdateLink'
{{on 'click' @onRevisionSelect}}
@route='overview.index'
@query={{hash revisionId=@revision.id}}
>
<Registries::UpdateDropdown::UpdateLabel
@totalRevisions={{@totalRevisions}}
@index={{@index}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
{{#if this.revisions}}
{{#each this.revisions as |revision index|}}
<Registries::UpdateDropdown::ListItem
@onRevisionSelect={{action this.onRevisionSelect dd.close}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to do something more simple like @onClick={{dd.close}}, but doing so caused the page to do a full load every time. I don't think this is the best way of closing the dropdown on click, but other attempts have either run into the problem where it does a full app load as opposed to a transition, or doesn't show which revision is the currently selected one (like when using <OsfLink>

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason why it does a full page load ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not exactly sure why. I tried messing around with some different approaches, but basically anything that closed the dropdown before the transition finished would trigger a full page load. I'm guessing there's something about how the transition is being called that gets messy when the dropdown is closed, but I couldn't quite figure out how to remedy that.

@revision={{revision}}
@isModeratorMode={{@isModeratorMode}}
@totalRevisions={{this.totalRevisions}}
Expand Down
27 changes: 27 additions & 0 deletions tests/integration/components/delete-button/component-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { click, render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { setupRenderingTest } from 'ember-qunit';
import { module, test } from 'qunit';

module('Integration | Component | delete-button', hooks => {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
await render(hbs`
<DeleteButton
@buttonLabel='Button here!'
@modalTitle='Head'
@modalBody='Shoulders'
@cancelButtonText='Knees'
@confirmButtonText='Toes'
/>
`);
assert.dom('[data-test-delete-button]').hasText('Button here!');
await click('[data-test-delete-button]');
assert.dom('[data-test-delete-modal-header]').containsText('Head');
assert.dom('[data-test-delete-modal-body]').hasText('Shoulders');
assert.dom('[data-test-cancel-delete]').hasText('Knees');
assert.dom('[data-test-confirm-delete]').hasText('Toes');
await click('[data-test-confirm-delete]');
});
});
6 changes: 3 additions & 3 deletions translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ node_card:
statuses:
revision_pending_moderation: 'Update pending moderation'
revision_in_progress: 'Update in progress'
revision_unapproved: 'Update pending unapproved'
revision_unapproved: 'Update pending approval'
pending_registration_approval: 'Pending registration approval'
pending_embargo_approval: 'Pending embargo'
pending: 'Pending moderation'
Expand All @@ -601,7 +601,7 @@ node_card:
options: Options
view_button: 'View'
update_button: 'Update'
view_changes_button: 'View changes'
view_changes_button: 'Continue update'
schema_response_error: 'Updates irretreivable.'

forks:
Expand Down Expand Up @@ -1608,7 +1608,7 @@ registries:
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 '
modalBodySecond: ' icon.'
modalBodyNoUpdates: 'The {registryName} does not allow updates for this registration template.<br>Contact their registy if you have any questions.'
learnMore: 'Click <a href="https://help.osf.io/hc/en-us/articles/360035806634-Edit-Registration-Metadata" target="_blank">here</a> to learn more'
learnMore: 'Click <a href="https://help.osf.io/hc/en-us/articles/360035806634-Edit-Registration-Metadata" target="_blank">here</a> to learn more.'
next: Next
cancel_update: 'Cancel update'
meetings:
Expand Down