Skip to content

Commit

Permalink
Merge c3d12b7 into a91c37b
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-cos committed Apr 29, 2024
2 parents a91c37b + c3d12b7 commit b98282b
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 98 deletions.
1 change: 1 addition & 0 deletions app/models/preprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class PreprintModel extends OsfModel {
@attr('date') datePublished!: Date;
@attr('date') dateWithdrawn!: Date;
@attr('date') originalPublicationDate!: Date | null;
@attr('string') originalPublicationCitation!: string;
@attr('date') dateModified!: Date;
@attr('fixstring') doi!: string | null;
@attr('boolean') public!: boolean;
Expand Down
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
14 changes: 3 additions & 11 deletions app/preprints/-components/submit/metadata/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,20 @@ interface MetadataArgs {
}

interface MetadataForm {
publicationDoi: string;
publicationYear: number;
publicationCitation: string;
doi: string;
originalPublicationDate: number;
license: LicenseModel;
subjects: SubjectModel[];
}

const MetadataFormValidation: ValidationObject<MetadataForm> = {
publicationDoi: validateFormat({
doi: validateFormat({
allowBlank: true,
allowNone: true,
ignoreBlank: true,
regex: DOIRegex,
type: 'invalid_doi',
}),
publicationYear: validateFormat({
allowBlank: true,
allowNone: true,
ignoreBlank: true,
regex: /^((?!(0))[0-9]{4})$/,
type: 'year_format',
}),
license: validatePresence({
presence: true,
ignoreBlank: true,
Expand Down
28 changes: 16 additions & 12 deletions app/preprints/-components/submit/metadata/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,33 @@
data-test-publication-doi-input
@label={{t 'preprints.submit.step-two.publication-doi-input'}}
@ariaLabel={{t 'preprints.submit.step-two.publication-doi-input'}}
@valuePath={{'publicationDoi'}}
@valuePath={{'doi'}}
{{on 'change' this.validate}}
{{on 'focusout' this.validate}}
local-class='input-container'
@placeholder={{t 'preprints.submit.step-two.publication-doi-input'}}
/>
{{!-- @minDate={{this.embargoRangeStartDate}}
@maxDate={{this.embargoRangeEndDate}} --}}

<form.text
data-test-publication-year-input
@label={{t 'preprints.submit.step-two.publication-year-input'}}
@ariaLabel={{t 'preprints.submit.step-two.publication-year-input'}}
@valuePath={{'publicationYear'}}
{{on 'change' this.validate}}
{{on 'focusout' this.validate}}
local-class='input-container'
@placeholder={{t 'preprints.submit.step-two.publication-year-input'}}
/>
<div local-class='input-container'>
<ValidatedInput::Date
@label={{t 'preprints.submit.step-two.publication-date-input'}}
@ariaLabel={{t 'preprints.submit.step-two.publication-date-input'}}
data-test-publication-date-input
@value={{@manager.preprint.originalPublicationDate}}
@placeholder={{t 'preprints.submit.step-two.publication-date-input'}}
@date={{@manager.preprint.originalPublicationDate}}
{{on 'change' this.validate}}
{{on 'focusout' this.validate}}
/>
</div>

<form.text
data-test-publication-citation-input
@label={{t 'preprints.submit.step-two.publication-citation-input'}}
@ariaLabel={{t 'preprints.submit.step-two.publication-citation-input'}}
@valuePath={{'publicationCitation'}}
@valuePath={{'originalPublicationCitation'}}
{{on 'change' this.validate}}
{{on 'focusout' this.validate}}
local-class='input-container'
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
44 changes: 42 additions & 2 deletions app/preprints/-components/submit/review/component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import Store from '@ember-data/store';
import { waitFor } from '@ember/test-waiters';
import Component from '@glimmer/component';
import { task } from 'ember-concurrency';
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 @@ -12,11 +20,43 @@ interface ReviewArgs {
* The Review Component
*/
export default class Review extends Component<ReviewArgs>{
preprint = this.args.manager.preprint;
provider = this.preprint.provider;
@service store!: Store;
@tracked preprint = this.args.manager.preprint;
@tracked provider?: any;
@tracked license?: any;
@tracked contributors?: any;
@tracked subjects?: any;
@service intl!: Intl;

constructor(owner: unknown, args: ReviewArgs) {
super(owner, args);

taskFor(this.loadPreprint).perform();
}

@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.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');
}
}
5 changes: 3 additions & 2 deletions app/preprints/-components/submit/review/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
width: 100%;
margin-top: 20px;

.title {
font-weight: bold;
h4 {
margin-top: 10px;
margin-bottom: 10px;
font-weight: bold;
}

.display {
Expand Down
159 changes: 104 additions & 55 deletions app/preprints/-components/submit/review/template.hbs
Original file line number Diff line number Diff line change
@@ -1,67 +1,116 @@
<div local-class='preprint-input-container {{if (is-mobile) 'mobile'}}'>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-one
>
{{t 'preprints.submit.step-one.title'}}
</h3>
{{#if this.loadPreprint.isRunning}}
<LoadingIndicator data-test-loading-indicator @dark={{true}} />
{{else}}
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-one
>
{{t 'preprints.submit.step-one.title'}}
</h3>

<div local-class='content-container'>
<div local-class='title'>
{{t 'preprints.submit.step-five.select-a-service'}}
<div local-class='content-container'>
<div local-class='title'>
{{t 'preprints.submit.step-five.select-a-service'}}
</div>
<div local-class='display'>
<img
data-test-provider-image
local-class='image'
src={{this.providerLogo}}
alt={{t 'preprints.submit.step-one.title'}}
/>
<div local-class='text'>
{{this.provider.name}}
</div>
</div>
</div>
<div local-class='display'>
<img
data-test-provider-image
local-class='image'
src={{this.providerLogo}}
alt={{t 'preprints.submit.step-one.title'}}
/>
<div local-class='text'>
{{this.preprint.provider.name}}
<div local-class='content-container'>
<h4>
{{t 'preprints.submit.step-five.preprint-title'}}
</h4>
<div local-class='display'>
{{this.preprint.title}}
</div>
</div>
<div local-class='content-container'>
<Preprints::-Components::PreprintAbstract @preprint={{this.preprint}} />
</div>
<hr>
</div>
<div local-class='content-container'>
<div local-class='title'>
{{t 'preprints.submit.step-five.preprint-title'}}
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-two
>
{{t 'preprints.submit.step-two.title'}}
</h3>
<div local-class='content-container'>
<div local-class='title'>
{{t 'preprints.submit.step-five.contributors'}}
</div>
<div local-class='display'>
<ContributorList
@model={{this.preprint}}
@shouldTruncate={{false}}
@shouldLinkUsers={{true}}
/>
</div>
</div>
<div local-class='display'>
{{this.preprint.title}}
<div local-class='content-container'>
<div local-class='display'>
<Preprints::-Components::PreprintLicense @preprint={{this.preprint}} />
</div>
</div>
</div>
<div local-class='content-container'>
<div local-class='title'>
{{t 'preprints.submit.step-five.description'}}
<div local-class='content-container'>
<div local-class='display'>
<Preprints::-Components::PreprintDiscipline @subjects={{this.subjects}} />
</div>
</div>
<div local-class='display'>
{{this.preprint.description}}
<div local-class='content-container'>
<div local-class='display'>
<Preprints::-Components::PreprintTag @preprint={{this.preprint}} />
</div>
</div>
<div local-class='content-container'>
<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'>
{{this.displayPublicationDate}}
</div>
</div>
<div local-class='content-container'>
<h4>
{{t 'preprints.submit.step-five.publication-citation'}}
</h4>
<div local-class='display'>
{{this.displayPublicationCitation}}
</div>
</div>
<hr>
</div>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-three
>
{{t 'preprints.submit.step-three.title'}}
</h3>
<hr />
</div>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-four
>
{{t 'preprints.submit.step-four.title'}}
</h3>
<hr>
</div>
<hr>
</div>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-two
>
{{t 'preprints.submit.step-two.title'}}
</h3>
<hr>
</div>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-three
>
{{t 'preprints.submit.step-three.title'}}
</h3>
<hr />
</div>
<div local-class='step-container'>
<h3 local-class='title'
data-test-title-step-four
>
{{t 'preprints.submit.step-four.title'}}
</h3>
<hr>
</div>
{{/if}}
</div>
14 changes: 7 additions & 7 deletions app/preprints/-components/submit/title-and-file/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
@uniqueID={{titleFieldId}}
/>
{{/let}}
{{#let (unique-id 'description') as |descriptionFieldId|}}
<label for={{descriptionFieldId}}
data-test-description-label
{{#let (unique-id 'abstract') as |abstractFieldId|}}
<label for={{abstractFieldId}}
data-test-abstract-label
>
{{t 'preprints.submit.step-one.description-input'}}
{{t 'preprints.submit.step-one.abstract-input'}}
<span local-class='required'>*</span>
</label>
<form.textarea
data-test-description-input
data-test-abstract-input
@valuePath={{'description'}}
@isRequired={{true}}
{{on 'change' this.validate}}
local-class='input-container textarea-container'
@placeholder={{t 'preprints.submit.step-one.description-input'}}
@uniqueID={{descriptionFieldId}}
@placeholder={{t 'preprints.submit.step-one.abstract-input'}}
@uniqueID={{abstractFieldId}}
/>
{{/let}}
</FormControls>
Expand Down
Loading

0 comments on commit b98282b

Please sign in to comment.