Skip to content

Commit

Permalink
Updates for a few bugs that I have found
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-cos committed Jun 3, 2024
1 parent 8f1aca1 commit 5bf5ec8
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 22 deletions.
2 changes: 0 additions & 2 deletions app/models/preprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ import SubjectModel from './subject';

export enum PreprintDataLinksEnum {
AVAILABLE = 'available',
YES = 'yes',
NO = 'no',
NOT_APPLICABLE = 'not_applicable',
}

export enum PreprintPreregLinksEnum {
AVAILABLE = 'available',
YES = 'yes',
NO = 'no',
NOT_APPLICABLE = 'not_applicable',
}
Expand Down
10 changes: 5 additions & 5 deletions app/preprints/-components/submit/author-assertions/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const AuthorAssertionsFormValidation: ValidationObject<AuthorAssertionsForm> = {
type: 'empty',
}),
whyNoData: [(key: string, newValue: string, oldValue: string, changes: any, content: any) => {
if (changes['hasDataLinks'] !== PreprintDataLinksEnum.YES) {
if (changes['hasDataLinks'] !== PreprintDataLinksEnum.AVAILABLE) {
return validatePresence({
presence: true,
ignoreBlank: true,
Expand All @@ -57,7 +57,7 @@ const AuthorAssertionsFormValidation: ValidationObject<AuthorAssertionsForm> = {
return true;
}],
dataLinks: [(_key: string, newValue: string[], _oldValue: string[], changes: any, _content: any) => {
if (changes['hasDataLinks'] === PreprintDataLinksEnum.YES || newValue) {
if (changes['hasDataLinks'] === PreprintDataLinksEnum.AVAILABLE || newValue) {
let isValid = false;
if (newValue) {
isValid = true;
Expand All @@ -82,7 +82,7 @@ const AuthorAssertionsFormValidation: ValidationObject<AuthorAssertionsForm> = {
}),
whyNoPrereg: [(key: string, newValue: string, oldValue: string, changes: any, content: any) => {
if (
changes['hasPreregLinks'] !== PreprintPreregLinksEnum.YES
changes['hasPreregLinks'] !== PreprintPreregLinksEnum.AVAILABLE
) {
return validatePresence({
presence: true,
Expand All @@ -93,7 +93,7 @@ const AuthorAssertionsFormValidation: ValidationObject<AuthorAssertionsForm> = {
return true;
}],
preregLinks: [(_key: string, newValue: string[], _oldValue: string[], changes: any, _content: any) => {
if (changes['hasPreregLinks'] === PreprintPreregLinksEnum.YES || newValue) {
if (changes['hasPreregLinks'] === PreprintPreregLinksEnum.AVAILABLE || newValue) {
let isValid = false;
if (newValue) {
isValid = true;
Expand All @@ -112,7 +112,7 @@ const AuthorAssertionsFormValidation: ValidationObject<AuthorAssertionsForm> = {
}
}],
preregLinkInfo: [(key: string, newValue: string, oldValue: string, changes: any, content: any) => {
if (changes['hasPreregLinks'] === PreprintPreregLinksEnum.YES || newValue) {
if (changes['hasPreregLinks'] === PreprintPreregLinksEnum.AVAILABLE || newValue) {
return validatePresence({
presence: true,
ignoreBlank: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<form.text
data-test-link-input
@isRequired={{true}}
{{on 'focusout' this.onUpdate}}
@onKeyUp={{this.onUpdate}}
@placeholder={{ @placeholder }}
@valuePath={{'value'}}
local-class='input'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class PublicData extends Component<PublicDataArgs>{

publicDataOptions = [
{
inputValue: PreprintDataLinksEnum.YES,
inputValue: PreprintDataLinksEnum.AVAILABLE,
displayText: this.intl.t('general.available'),
} as RadioButtonOption,
{
Expand All @@ -49,7 +49,7 @@ export default class PublicData extends Component<PublicDataArgs>{
public get displayPublicDataLinks(): boolean {
return this.args.changeSet.get('hasDataLinks') === null ?
false :
this.args.changeSet.get('hasDataLinks') === PreprintDataLinksEnum.YES;
this.args.changeSet.get('hasDataLinks') === PreprintDataLinksEnum.AVAILABLE;
}

@action
Expand All @@ -60,11 +60,11 @@ export default class PublicData extends Component<PublicDataArgs>{

@action
public updatePublicDataOptions(): void {
if (this.args.changeSet.get('hasDataLinks') === PreprintDataLinksEnum.YES) {
this.args.changeSet.set('whyNoData', '');
if (this.args.changeSet.get('hasDataLinks') === PreprintDataLinksEnum.AVAILABLE) {
this.args.changeSet.set('whyNoData', null);
this.isPublicDataWhyNoStatementDisabled = false;
} else if (this.args.changeSet.get('hasDataLinks') === PreprintDataLinksEnum.NO) {
this.args.changeSet.set('whyNoData', '');
this.args.changeSet.set('whyNoData', null);
this.isPublicDataWhyNoStatementDisabled = false;
this.placeholder = this.intl.t('preprints.submit.step-assertions.public-data-no-placeholder');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
data-test-public-data-description-input
@disabled={{this.isPublicDataWhyNoStatementDisabled}}
@valuePath={{'whyNoData'}}
{{on 'change' @validate}}
@onKeyUp={{@validate}}
local-class='input-container textarea-container'
@placeholder={{this.placeholder}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class PublicPreregistration extends Component<PublicPreregistrati

publicPreregistrationOptions = [
{
inputValue: PreprintPreregLinksEnum.YES,
inputValue: PreprintPreregLinksEnum.AVAILABLE,
displayText: this.intl.t('general.available'),
} as RadioButtonOption,
{
Expand All @@ -74,7 +74,7 @@ export default class PublicPreregistration extends Component<PublicPreregistrati
public get displayPublicPreregistrationLinks(): boolean {
return this.args.changeSet.get('hasPreregLinks') === null ?
false :
this.args.changeSet.get('hasPreregLinks') === PreprintPreregLinksEnum.YES;
this.args.changeSet.get('hasPreregLinks') === PreprintPreregLinksEnum.AVAILABLE;
}

@action
Expand All @@ -85,11 +85,11 @@ export default class PublicPreregistration extends Component<PublicPreregistrati

@action
public updatePublicPreregistrationOptions(): void {
if (this.args.changeSet.get('hasPreregLinks') === PreprintPreregLinksEnum.YES) {
this.args.changeSet.set('whyNoPrereg', '');
if (this.args.changeSet.get('hasPreregLinks') === PreprintPreregLinksEnum.AVAILABLE) {
this.args.changeSet.set('whyNoPrereg', null);
this.isPublicPreregistrationWhyNoStatementDisabled = false;
} else if (this.args.changeSet.get('hasPreregLinks') === PreprintPreregLinksEnum.NO) {
this.args.changeSet.set('whyNoPrereg', '');
this.args.changeSet.set('whyNoPrereg', null);
this.isPublicPreregistrationWhyNoStatementDisabled = false;
this.placeholder = this.intl.t('preprints.submit.step-assertions.public-preregistration-no-placeholder');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
data-test-public-preregistration-description-input
@disabled={{this.isPublicPreregistrationWhyNoStatementDisabled}}
@valuePath={{'whyNoPrereg'}}
{{on 'change' @validate}}
local-class='input-container textarea-container'
@onKeyUp={{@validate}}
@placeholder={{this.placeholder}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
data-test-coi-description-input
@disabled={{this.isConflictOfInterestStatementDisabled}}
@valuePath={{'conflictOfInterestStatement'}}
{{on 'change' this.validate}}
@onKeyUp={{this.validate}}
local-class='input-container textarea-container'
@placeholder={{t 'preprints.submit.step-assertions.conflict-of-interest-placeholder'}}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#if this.prepUrl.isRunning}}
{{#if this.success.isRunning}}
<LoadingIndicator data-test-loading-indicator @dark={{true}} />
{{else}}
<div ...attributes>
Expand Down

0 comments on commit 5bf5ec8

Please sign in to comment.