-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add onboarding modal, refs #331
- Loading branch information
Showing
7 changed files
with
282 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
.govuk-modal-dialogue__continue, | ||
.govuk-modal-dialogue__cancel { | ||
margin-bottom: 0; | ||
} | ||
|
||
.govuk-modal-dialogue__continue { | ||
margin-top: 10px; | ||
} | ||
|
||
.govuk-modal-dialogue__cancel { | ||
display: block; | ||
margin-top: 15px; | ||
text-align: center; | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__continue { | ||
margin-top: 0; | ||
} | ||
.govuk-modal-dialogue__cancel { | ||
display: inline-block; | ||
margin: 9px 0 0 15px; | ||
} | ||
} | ||
|
||
.govuk-modal-dialogue, | ||
.govuk-modal-dialogue__backdrop { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
z-index: 1000; | ||
} | ||
|
||
.govuk-modal-dialogue { | ||
display: none; | ||
z-index: 1100; | ||
} | ||
|
||
.govuk-modal-dialogue--open { | ||
display: table; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.govuk-modal-dialogue__wrapper { | ||
box-sizing: border-box; | ||
display: table-cell; | ||
display: flex; | ||
height: inherit; | ||
padding-top: 25px; | ||
padding-bottom: 25px; | ||
overflow-y: auto; | ||
vertical-align: middle; | ||
align-items: center; | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__wrapper { | ||
padding-top: 40px; | ||
} | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__wrapper { | ||
padding-bottom: 40px; | ||
} | ||
} | ||
|
||
.govuk-modal-dialogue__box { | ||
box-sizing: border-box; | ||
display: block; | ||
position: relative; | ||
z-index: 1100; | ||
width: 90%; | ||
margin-right: auto; | ||
margin-left: auto; | ||
padding: 0; | ||
border: 3px solid #0b0c0c; | ||
background: #ffffff; | ||
} | ||
|
||
.govuk-modal-dialogue__box:focus { | ||
outline: 3px solid #ffdd00; | ||
} | ||
|
||
.govuk-modal-dialogue__box::backdrop { | ||
display: none; | ||
} | ||
|
||
.govuk-modal-dialogue__header { | ||
margin-bottom: 15px; | ||
padding-bottom: 3px; | ||
color: #ffffff; | ||
background-color: #0b0c0c; | ||
text-align: right; | ||
} | ||
|
||
.govuk-modal-dialogue__header:after { | ||
content: ""; | ||
display: block; | ||
clear: both; | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__header { | ||
margin-bottom: 25px; | ||
} | ||
} | ||
|
||
.govuk-modal-dialogue__content { | ||
padding: 20px; | ||
padding-top: 0; | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__content { | ||
padding: 30px; | ||
} | ||
} | ||
|
||
.govuk-modal-dialogue__backdrop { | ||
opacity: .8; | ||
background: #0b0c0c; | ||
pointer-events: none; | ||
touch-action: none; | ||
} | ||
|
||
.govuk-modal-dialogue__close { | ||
display: block; | ||
width: auto; | ||
min-width: 44px; | ||
margin: 0; | ||
padding: 2px 5px; | ||
float: right; | ||
color: #ffffff; | ||
background-color: #0b0c0c; | ||
box-shadow: none !important; | ||
font-size: 36px; | ||
font-size: 2.25rem; | ||
font-weight: 700; | ||
line-height: 1; | ||
} | ||
|
||
.govuk-modal-dialogue__close:hover { | ||
color: #0b0c0c; | ||
background-color: #ffdd00; | ||
} | ||
|
||
.govuk-modal-dialogue__close:active { | ||
top: 0; | ||
} | ||
|
||
@media (min-width: 40.0625em) { | ||
.govuk-modal-dialogue__content { | ||
padding-top: 0; | ||
} | ||
.govuk-modal-dialogue__box { | ||
width: 83.22497%; | ||
} | ||
} | ||
|
||
@media (min-width: 48.0625em) { | ||
.govuk-modal-dialogue__box { | ||
width: 640px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Controller} from 'stimulus'; | ||
|
||
export default class extends Controller { | ||
static targets = ["modal"] | ||
|
||
close(event) { | ||
event.preventDefault(); | ||
this.modalTarget.remove(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Sessions" do | ||
before(:each) do | ||
# https://stackoverflow.com/questions/598933/how-do-i-change-the-default-www-example-com-domain-for-testing-in-rails | ||
default_url_options[:host] = "localhost:3000" | ||
Capybara.default_host = "http://localhost:3000" | ||
end | ||
|
||
scenario 'As a visitor I want to see onboarding after first login (magic link path)' do | ||
OmniAuth.config.test_mode = false | ||
|
||
visit new_session_path | ||
|
||
within 'form#login-email' do | ||
fill_in :email, with: '[email protected]' | ||
end | ||
|
||
clear_mail_deliveries | ||
|
||
click_on 'Prihlásiť sa e-mailom' | ||
perform_enqueued_jobs | ||
|
||
expect(ActionMailer::Base.deliveries.size).to eq 1 | ||
|
||
visit link_in_last_email | ||
|
||
expect(page).to have_text('Vitajte na Návody.Digital') | ||
end | ||
|
||
scenario 'As a visitor I want to see onboarding after first login (google login path)' do | ||
OmniAuth.config.test_mode = true | ||
OmniAuth.config.add_mock(:google_oauth2, { | ||
provider: 'google_oauth2', | ||
info: { | ||
email: '[email protected]' | ||
} | ||
}) | ||
|
||
visit root_path | ||
click_link 'Prihlásiť' | ||
click_on 'Prihlásiť sa cez Google' | ||
|
||
expect(page).to have_text('Vitajte na Návody.Digital') | ||
end | ||
|
||
scenario 'As a visitor I dont want to see onboarding after next login' do | ||
OmniAuth.config.test_mode = true | ||
OmniAuth.config.add_mock(:google_oauth2, { | ||
provider: 'google_oauth2', | ||
info: { | ||
email: '[email protected]' | ||
} | ||
}) | ||
|
||
visit root_path | ||
click_link 'Prihlásiť' | ||
click_on 'Prihlásiť sa cez Google' | ||
|
||
click_on 'Odhlásiť' | ||
|
||
click_link 'Prihlásiť' | ||
click_on 'Prihlásiť sa cez Google' | ||
|
||
expect(page).not_to have_text('Vitajte na Návody.Digital') | ||
end | ||
end |