Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add abort button to retry save modal and several other fixes for it #291

Merged
merged 1 commit into from
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/locales/ca/translations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'action.abort': 'Abort',
'action.back': 'Enrere',
'action.next': 'Següent',
'action.save': 'Desa',
Expand Down
1 change: 1 addition & 0 deletions app/locales/de/translations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'action.abort': 'Abbrechen',
'action.back': 'Zurück',
'action.next': 'Weiter',
'action.save': 'Speichern',
Expand Down
1 change: 1 addition & 0 deletions app/locales/en/translations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'action.abort': 'Abort',
'action.back': 'Back',
'action.next': 'Next',
'action.save': 'Save',
Expand Down
1 change: 1 addition & 0 deletions app/locales/es/translations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'action.abort': 'Abort',
'action.back': 'Atras',
'action.next': 'Siguiente',
'action.save': 'Guardar',
Expand Down
1 change: 1 addition & 0 deletions app/locales/it/translations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
'action.abort': 'Abort',
'action.back': 'Indietro',
'action.next': 'Avanti',
'action.save': 'Salvare',
Expand Down
48 changes: 28 additions & 20 deletions app/templates/poll/participation.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,32 @@
{{/bs-form}}
</div>

{{#bs-modal
open=savingFailed
title=(t "modal.save-retry.title")
body=false
footer=false
closeButton=false
autoClose=false
id="modal-saving-failed"
as |modal|
}}
{{#modal.body}}
<BsModal
@id="modal-saving-failed-modal"
@onHidden={{action (mut savingFailed) false}}
@onSubmit={{action "save"}}
@open={{savingFailed}}
as |modal|
>
<modal.header
@closeButton={{false}}
@title={{t "modal.save-retry.title"}}
/>
<modal.body>
<p>{{t "modal.save-retry.text"}}</p>
{{/modal.body}}
{{#modal.footer}}
{{bs-button
defaultText=(t "modal.save-retry.button-retry")
type="primary"
onClick=(action "save")
}}
{{/modal.footer}}
{{/bs-modal}}
</modal.body>
<modal.footer>
<BsButton
@onClick={{action modal.close}}
>
{{t "action.abort"}}
</BsButton>
<BsButton
@type="primary"
@onClick={{action modal.submit}}
data-test-button="retry"
>
{{t "modal.save-retry.button-retry"}}
</BsButton>
</modal.footer>
</BsModal>
14 changes: 7 additions & 7 deletions tests/acceptance/participate-in-a-poll-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,18 @@ module('Acceptance | participate in a poll', function(hooks) {

await visit(`/poll/${poll.id}/participation?encryptionKey=${encryptionKey}`);
assert.equal(currentRouteName(), 'poll.participation');
assert.dom('modal-saving-failed-modal')
.doesNotExist('failed saving notification is not shown before attempt to save');
assert.dom('#modal-saving-failed-modal .modal-content')
.isNotVisible('failed saving notification is not shown before attempt to save');

await pollParticipate('John Doe', ['yes', 'no']);
assert.dom('#modal-saving-failed-modal')
.exists('user gets notified that saving failed');
assert.dom('#modal-saving-failed-modal .modal-content')
.isVisible('user gets notified that saving failed');

this.server.post('/users');

await click('#modal-saving-failed-modal button');
assert.dom('#modal-saving-failed-modal')
.doesNotExist('Notification is hidden after another save attempt was successful');
await click('#modal-saving-failed-modal [data-test-button="retry"]');
assert.dom('#modal-saving-failed-modal .modal-content')
.isNotVisible('Notification is hidden after another save attempt was successful');
assert.equal(currentRouteName(), 'poll.evaluation');
assert.equal(PollEvaluationPage.participants.length, 1, 'user is added to participants table');

Expand Down