Skip to content

Commit

Permalink
Added finishing upates for the pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-cos committed Apr 29, 2024
1 parent df5cb9f commit 86ad6c0
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
3 changes: 3 additions & 0 deletions app/preprints/-components/preprint-doi/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import PreprintProviderModel from 'ember-osf-web/models/preprint-provider';
interface InputArgs {
preprint: PreprintModel;
provider: PreprintProviderModel;
isReview: boolean;
}

export default class PreprintAbstract extends Component<InputArgs> {
provider = this.args.provider;

review = this.args.isReview || false;

documentType = this.provider.documentType.singular;
}
4 changes: 3 additions & 1 deletion app/preprints/-components/preprint-doi/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<p> {{t 'preprints.detail.preprint_pending_doi_minted'}} </p>
{{/if}}
{{else}}
{{#if (not @preprint.public)}}
{{#if this.review}}
{{t 'general.not-applicable' }}
{{else if (not @preprint.public)}}
{{t 'preprints.detail.preprint_pending_doi' documentType=this.documentType}}
{{else if (and this.provider.reviewsWorkflow (not this.preprint.isPublished))}}
{{t 'preprints.detail.preprint_pending_doi_moderation'}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class PreprintStateMachine extends Component<StateMachineArgs>{
provider = this.args.provider;
@tracked preprint: PreprintModel;
displayAuthorAssertions = true;
@tracked statusFlowIndex = 1;
@tracked statusFlowIndex = 5;

constructor(owner: unknown, args: StateMachineArgs) {
super(owner, args);
Expand Down
17 changes: 16 additions & 1 deletion app/preprints/-components/submit/review/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { taskFor } from 'ember-concurrency-ts';
import PreprintStateMachine from 'ember-osf-web/preprints/-components/submit/preprint-state-machine/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import moment from 'moment-timezone';
import Intl from 'ember-intl/services/intl';

/**
* The Review Args
Expand All @@ -24,6 +26,7 @@ export default class Review extends Component<ReviewArgs>{
@tracked license?: any;
@tracked contributors?: any;
@tracked subjects?: any;
@service intl!: Intl;

constructor(owner: unknown, args: ReviewArgs) {
super(owner, args);
Expand All @@ -34,14 +37,26 @@ export default class Review extends Component<ReviewArgs>{
@task
@waitFor
private async loadPreprint() {
this.preprint = await this.store.findRecord('preprint', 'osf-not-contributor');
// this.preprint = await this.store.findRecord('preprint', 'osf-approved-admin');
this.provider = this.preprint.provider;
this.provider = this.preprint.provider.content;
this.license = this.preprint.license;
this.subjects = await this.preprint.queryHasMany('subjects');
}

public get providerLogo(): string | undefined {
return this.provider.get('assets')?.square_color_no_transparent;
}

public get displayPublicationDate(): string {
return this.preprint.originalPublicationDate
? moment(this.preprint.originalPublicationDate).format('YYYY-MM-DD')
: this.intl.t('general.not-applicable');
}

public get displayPublicationCitation(): string {
return this.preprint.originalPublicationCitation
? this.preprint.originalPublicationCitation
: this.intl.t('general.not-applicable');
}
}
17 changes: 8 additions & 9 deletions app/preprints/-components/submit/review/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
alt={{t 'preprints.submit.step-one.title'}}
/>
<div local-class='text'>
{{this.preprint.provider.name}}
{{this.provider.name}}
</div>
</div>
</div>
Expand Down Expand Up @@ -72,27 +72,26 @@
</div>
</div>
<div local-class='content-container'>
<h4>
{{t 'preprints.submit.step-five.publication-doi'}}
</h4>
<div local-class='display'>
{{this.preprint.doi}}
</div>
<Preprints::-Components::PreprintDoi
@preprint={{this.preprint}}
@provider={{this.provider}}
@isReview={{true}}
/>
</div>
<div local-class='content-container'>
<h4>
{{t 'preprints.submit.step-five.publication-date'}}
</h4>
<div local-class='display'>
{{moment-format this.preprint.originalPublicationDate 'YYYY-MM-DD'}}
{{this.displayPublicationDate}}
</div>
</div>
<div local-class='content-container'>
<h4>
{{t 'preprints.submit.step-five.publication-citation'}}
</h4>
<div local-class='display'>
{{this.preprint.originalPublicationCitation}}
{{this.displayPublicationCitation}}
</div>
</div>
<hr>
Expand Down
5 changes: 3 additions & 2 deletions mirage/scenarios/preprints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function buildOSF(

approvedAdminPreprint.update({ identifiers: [osfApprovedAdminIdentifier] });

const notContributorPreprint = server.create('preprint', {
const notContributorPreprint = server.create('preprint', Object({
provider: osf,
id: 'osf-not-contributor',
title: 'Preprint RWF: Pre-moderation, Non-Admin and Rejected',
Expand All @@ -75,7 +75,8 @@ function buildOSF(
whyNoData: `Why No Data\n${faker.lorem.sentence(200)}\n${faker.lorem.sentence(300)}`,
whyNoPrereg: `Why No Prereg\n${faker.lorem.sentence(200)}\n${faker.lorem.sentence(300)}`,
tags: [],
});
isPreprintDoi: false,
}));

const rejectedPreprint = server.create('preprint', {
provider: osf,
Expand Down
1 change: 0 additions & 1 deletion translations/en-us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,6 @@ preprints:
select-a-service: 'Select a service'
preprint-title: 'Title'
contributors: 'Contributors'
publication-doi: 'Publication DOI'
publication-date: 'Publication Year'
publication-citation: 'Publication Citation'
data-analytics: 'Goto {statusType} tab'
Expand Down

0 comments on commit 86ad6c0

Please sign in to comment.