Skip to content

Commit

Permalink
Merge branch 'release/21.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabmiz committed May 11, 2021
2 parents 05150e5 + d3bc5bf commit 4077aee
Show file tree
Hide file tree
Showing 36 changed files with 880 additions and 187 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [21.4.0] - 2021-04-11
### Added
- user's `myRegistrations` page

## [21.3.0] - 2021-04-23
### Added
- support for provider-specific (editable/read-only) registration metadata fields
Expand Down Expand Up @@ -1719,7 +1723,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/21.3.0...develop
[Unreleased]: https://github.com/CenterForOpenScience/ember-osf-web/compare/21.4.0...develop
[21.4.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.4.0
[21.3.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.3.0
[21.2.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.2.0
[21.1.1]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/21.1.1
Expand Down
6 changes: 4 additions & 2 deletions app/guid-node/registrations/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</NodeList>
</div>
</tab.pane>
{{#if this.node.userHasAdminPermission}}
{{#if this.node.userHasReadPermission}}
<tab.pane
data-analytics-scope='Drafts tab'
@id='drafts'
Expand All @@ -69,7 +69,9 @@

<list.empty>
<p>{{t 'node.registrations.no_drafts'}}</p>
<p>{{t 'node.registrations.start_new'}}</p>
{{#if this.node.userHasAdminPermission}}
<p>{{t 'node.registrations.start_new'}}</p>
{{/if}}
<p>
{{t 'node.registrations.learn_more'
learnMoreLink='https://openscience.zendesk.com/hc/en-us/articles/360019930893'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class DeleteButton extends Component {
hardConfirm: boolean = defaultTo(this.hardConfirm, false);
disabled: boolean = defaultTo(this.disabled, false);
shouldStopPropagation = false;
icon: string = 'times';
buttonLabel: string = defaultTo(
this.buttonLabel,
this.intl.t('osf-components.delete-button.buttonLabel'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{on 'click' this._show}}
@disabled={{this.disabled}}
>
{{fa-icon 'times' size='lg'}}
<FaIcon @icon={{this.icon}} />
</Button>
{{else if this.smallSecondary}}
<Button
Expand All @@ -20,6 +20,9 @@
@layout='small'
{{on 'click' this._show}}
>
{{#if @icon}}
<FaIcon @icon={{this.icon}} />
{{/if}}
{{this.buttonLabel}}
</Button>
{{else}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DraftRegistrationCard {
margin-bottom: 10px;

:global(.ember-content-placeholders-text__line) {
height: 1em;
}
Expand All @@ -19,20 +21,43 @@
}

.DraftRegistrationCard__body {
font-size: 18px;
font-weight: 400;
line-height: 1;
color: $color-text-gray-light;

small {
font-size: 75%;
dl {
margin-bottom: 10px;
}

dt,
dd {
display: inline-block;
}

:global(.ember-content-placeholders-text) {
width: 33%;
}
}

// stylelint-disable selector-no-qualifying-type
a.DraftRegistrationCard__review {
margin-right: 10px;

&:hover {
text-decoration: none;
}
}

// stylelint-enable selector-no-qualifying-type
.DraftRegistrationCard__edit {
vertical-align: bottom;
}

.DraftRegistrationCard__delete {
button {
padding: 6px 12px;
}
}

:global(.delete_draft_registration) {
:global(.modal-header) {
h4 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
@route='registries.drafts.draft'
@models={{array this.draftRegistration.id}}
>
{{this.draftRegistration.title}}
{{#if this.draftRegistration.title}}
{{this.draftRegistration.title}}
{{else}}
{{t 'osf-components.draft-registration-card.untitled_placeholder'}}
{{/if}}
</OsfLink>
{{else}}
<ContentPlaceholders as |placeholder|>
Expand All @@ -23,81 +27,86 @@
</h4>
<section local-class='DraftRegistrationCard__body' data-test-draft-registration-card-body>
{{#if this.draftRegistration}}
<small>
<p data-test-initiated-by>
{{t 'osf-components.draft-registration-card.initiated_by'}}
{{this.draftRegistration.initiator.fullName}}
</p>
<p data-test-form-type>
{{t 'osf-components.draft-registration-card.form_type'}}
{{this.draftRegistration.registrationSchema.name}}
</p>
<p data-test-time-initiated>
{{t 'osf-components.draft-registration-card.started'}}
{{moment this.draftRegistration.datetimeInitiated}}
</p>
<p data-test-time-updated>
{{t 'osf-components.draft-registration-card.last_updated'}}
{{moment this.draftRegistration.datetimeUpdated}}
</p>
</small>
<dl>
<div data-test-initiated-by>
<dt>
{{t 'osf-components.draft-registration-card.initiated_by'}}
</dt>
<dd>
{{this.draftRegistration.initiator.fullName}}
</dd>
</div>
<div data-test-form-type>
<dt>
{{t 'osf-components.draft-registration-card.form_type'}}
</dt>
<dd>
{{this.draftRegistration.registrationSchema.name}}
</dd>
</div>
<div data-test-provider-name>
<dt data-test-provider-name>
{{t 'osf-components.draft-registration-card.registry'}}
</dt>
<dd>
{{this.draftRegistration.provider.name}}
</dd>
</div>
<div data-test-time-initiated>
<dt data-test-time-initiated>
{{t 'osf-components.draft-registration-card.started'}}
</dt>
<dd>
{{moment this.draftRegistration.datetimeInitiated}}
</dd>
</div>
<div data-test-time-updated>
<dt data-test-time-updated>
{{t 'osf-components.draft-registration-card.last_updated'}}
</dt>
<dd>
{{moment this.draftRegistration.datetimeUpdated}}
</dd>
</div>
</dl>
<div class='row'>
<div class='col-md-10'>
<OsfLink
data-analytics-name='Edit'
class='btn btn-default'
@route='registries.drafts.draft'
@models={{array @draftRegistration.id}}
>
{{fa-icon 'pencil-alt'}} {{t 'general.edit'}}
</OsfLink>
<OsfButton
data-analytics-name='Delete'
@type='default'
@onClick={{action this.delete}}
disabled={{not this.draftRegistration}}
>
{{fa-icon 'times'}} {{t 'general.delete'}}
</OsfButton>
<BsModal
@open={{this.deleteModalOpen}}
@onHidden={{action this.cancelDelete}}
class='delete_draft_registration'
as |modal|
>
<modal.header>
<h4>{{t 'general.please_confirm'}}</h4>
</modal.header>
<modal.body>
{{t 'osf-components.draft-registration-card.delete_draft_confirm'}}
</modal.body>
<modal.footer data-analytics-scope='Draft registrations delete modal'>
<OsfButton
data-analytics-name='Cancel delete'
@onClick={{action modal.close}}
@type='default'
>
{{t 'general.cancel'}}
</OsfButton>
<OsfButton
data-analytics-name='Confirm delete'
@onClick={{action this.confirmDelete}}
@type='danger'
>
{{t 'general.delete'}}
</OsfButton>
</modal.footer>
</BsModal>
</div>
<div class='col-md-1'>
<OsfLink
data-test-draft-card-review
data-analytics-name='Review'
class='btn btn-default'
local-class='DraftRegistrationCard__review'
@route='registries.drafts.draft.review'
@models={{array this.draftRegistration.id}}
>
{{t 'osf-components.draft-registration-card.review'}}
<Button>
{{t 'osf-components.draft-registration-card.review'}}
</Button>
</OsfLink>
{{#unless this.draftRegistration.currentUserIsReadOnly}}
<OsfLink
data-test-draft-card-edit
data-analytics-name='Edit'
@route='registries.drafts.draft'
@models={{array this.draftRegistration.id}}
>
<Button local-class='DraftRegistrationCard__edit'>
{{t 'general.edit'}}
</Button>
</OsfLink>
{{/unless}}
</div>
<div class='col-md-1'>
{{#if this.draftRegistration.currentUserIsAdmin}}
<DeleteButton
data-test-draft-card-delete
@smallSecondary={{true}}
@icon='trash-alt'
@delete={{action this.confirmDelete}}
@modalTitle={{t 'general.please_confirm'}}
@modalBody={{t 'osf-components.draft-registration-card.delete_draft_confirm'}}
local-class='DraftRegistrationCard__delete'
/>
{{/if}}
</div>
</div>
{{else}}
Expand Down
24 changes: 0 additions & 24 deletions lib/osf-components/addon/components/node-card/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import config from 'ember-get-config';
import { layout } from 'ember-osf-web/decorators/component';
import Node, { NodeType } from 'ember-osf-web/models/node';
import Registration from 'ember-osf-web/models/registration';
import { Question } from 'ember-osf-web/models/registration-schema';
import Analytics from 'ember-osf-web/services/analytics';
import defaultTo from 'ember-osf-web/utils/default-to';
import pathJoin from 'ember-osf-web/utils/path-join';
Expand All @@ -31,29 +30,6 @@ export default class NodeCard extends Component {
// Private properties
searchUrl = pathJoin(baseURL, 'search');

@computed('node', 'node.{isRegistration,registrationSchema,registeredMeta.@each}')
get registrationTitle(): string | undefined {
if (this.node && this.node.isRegistration) {
const registration = this.node as Registration;
const titleQuestion = registration.registrationSchema.get('schema')
&& registration.registrationSchema.get('schema').pages.reduce(
(acc: Question, page) => (acc || page.questions.filter(
question => question.title === 'Title',
).firstObject),
undefined,
);

if (titleQuestion && typeof registration.registeredMeta === 'object'
&& titleQuestion.qid in registration.registeredMeta) {
const answer = registration.registeredMeta[titleQuestion.qid];
if ('value' in answer) {
return answer.value as string;
}
}
}
return undefined;
}

@computed('readOnly', 'node', 'node.{nodeType,userHasWritePermission}')
get showDropdown() {
return !this.readOnly && this.node && this.node.nodeType === NodeType.Fork && this.node.userHasWritePermission;
Expand Down
35 changes: 22 additions & 13 deletions lib/osf-components/addon/components/node-card/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.NodeCard {
margin: 10px 0;
}

.NodeCard__heading {
:global(.ember-content-placeholders-heading__title) {
height: 1em;
Expand Down Expand Up @@ -29,6 +33,21 @@
}
}

.NodeCard__body dt,
.NodeCard__body dd {
display: inline-block;
max-width: 80%;
margin-right: 5px;
}

.NodeCard__body dl {
margin-bottom: 10px;
}

.NodeCard__body > dl > div {
display: flex;
}

.NodeCard__dropdown {
padding-left: 5px;

Expand Down Expand Up @@ -59,22 +78,12 @@
}
}

.NodeCard__authors {
font-weight: 500;
.NodeCard__tags {
margin-top: 2px;
}

.NodeCard__description {
font-weight: 300;
text-overflow: ellipsis;
display: block;
white-space: nowrap;
overflow: hidden;
}

.NodeCard__tags {
margin-top: 2px;

strong {
font-weight: 600;
}
white-space: nowrap;
}
Loading

0 comments on commit 4077aee

Please sign in to comment.