Skip to content

Commit

Permalink
fix: fix flash messages (#1190)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredgalanis authored Jun 16, 2023
1 parent 2f4bf49 commit 075c0f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
26 changes: 12 additions & 14 deletions app/components/workflow-review/index.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
{{! template-lint-disable no-action no-inline-styles no-unknown-arguments-for-builtin-components require-button-type require-input-label }}
<div class="form-group row" {{did-insert this.initializeTooltip}}>
{{#if this.isTest}}
{{#each this.flashMessages.queue as |flash|}}
<div class="flash-message-container">
<FlashMessage @flash={{flash}} as |component flash close|>
<div class="d-flex justify-content-between">
{{flash.message}}
<span role="button" {{on "click" close}}>
x
</span>
</div>
</FlashMessage>
</div>
{{/each}}
{{/if}}
{{#each this.flashMessages.queue as |flash|}}
<div class="flash-message-container">
<FlashMessage @flash={{flash}} as |component flash close|>
<div class="d-flex justify-content-between">
{{flash.message}}
<span role="button" {{on "click" close}}>
x
</span>
</div>
</FlashMessage>
</div>
{{/each}}
<div class="col-md-12">
<div class="list-group">
<div href="#" class="list-group-item flex-column align-items-start">
Expand Down
19 changes: 13 additions & 6 deletions app/controllers/submissions/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,22 @@ export default class SubmissionsNew extends Controller {

await get(this, 'submissionHandler.submit')
.perform(sub, pub, files, comment)
.then(() => {
set(this, 'uploading', false);
set(this, 'comment', '');
set(this, 'workflow.filesTemp', A());
this.transitionToRoute('thanks', { queryParams: { submission: get(sub, 'id') } });
})
.catch((error) => {
this.set('uploading', false);
this.flashMessages.error(`Submission failed: ${error.message}`);
});

set(this, 'uploading', false);
set(this, 'comment', '');
set(this, 'workflow.filesTemp', A());
this.transitionToRoute('thanks', { queryParams: { submission: get(sub, 'id') } });
this.flashMessages.danger(`Submission failed: ${error.message}`);

const elements = document.querySelectorAll('.block-user-input');
elements.forEach((el) => {
el.style.display = 'none';
});
});
}
}

Expand Down

0 comments on commit 075c0f7

Please sign in to comment.