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

fix: go back button #622

Merged
merged 2 commits into from
Oct 11, 2023
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
15 changes: 12 additions & 3 deletions app/models/apps/parliament_vote_app/application_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ def run(listener)
end

private def sk_citizen_step(listener)
if valid?(:sk_citizen)
if go_back?
self.step = 'start'
listener.render :start
elsif valid?(:sk_citizen)
case sk_citizen
when 'yes'
self.step = 'permanent_resident'
Expand All @@ -234,7 +237,10 @@ def run(listener)
end

private def permanent_resident_step(listener)
if valid?(:permanent_resident)
if go_back?
self.step = 'sk_citizen'
listener.render :sk_citizen
elsif valid?(:permanent_resident)
case permanent_resident
when 'yes'
self.step = 'place'
Expand Down Expand Up @@ -269,7 +275,10 @@ def run(listener)

# Home flow
private def delivery_step(listener)
if valid?(:delivery)
if go_back?
self.step = 'place'
listener.render :place
elsif valid?(:delivery)
case delivery
when 'post'
self.step = 'identity'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<%= render 'apps/parliament_vote_app/application_forms/subscribe' %>
<% else %>
<%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %>
<%= render 'apps/parliament_vote_app/application_forms/back', form: f %>
<%= render 'components/error_summary', form: @application_form %>
<%= f.hidden_field :step %>
<%= f.hidden_field :sk_citizen %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %>
<%= render 'apps/parliament_vote_app/application_forms/back', form: f %>
<%= render 'components/error_summary', form: @application_form %>
<%= f.hidden_field :step %>
<%= f.radios :permanent_resident, 'Máte trvalý pobyt na Slovensku?' do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %>
<%= render 'apps/parliament_vote_app/application_forms/back', form: f %>
<%= render 'components/error_summary', form: @application_form %>
<%= f.hidden_field :step %>
<%= f.radios :sk_citizen, 'Ste občan Slovenskej republiky?', inline: true do %>
Expand Down
1 change: 0 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
position: 1,
title: "Založenie živnosti",
slug: "zalozenie-zivnosti",
short_description: "empty",
description: "<h1>Založenie živnosti: krok po kroku</h1>
<p>Zistite, čo treba vybaviť na založenie živnosti.</p>
<p>Založenie živnosti zvyčajne trvá 5 až 10 pracovných dní.</p>",
Expand Down
4 changes: 2 additions & 2 deletions spec/features/apps/parliament_vote_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def start
click_button 'Pokračovať'

fill_in 'Meno, priezvisko, titul', with: 'Ferko Mrkva', class: 'person'
fill_in 'Rodné číslo', with: '123', class: 'person'
fill_in 'Rodné číslo', with: '600101/1973', class: 'person'
fill_in 'Ulica', with: 'Pupavova 31'
fill_in 'PSČ', with: '456'
fill_in 'Obec', with: 'Bratislava - Karlova ves'
Expand All @@ -144,7 +144,7 @@ def start
click_button 'Pokračovať'

expect(page).to have_content('Meno: Ferko Mrkva')
expect(page).to have_content('Rodné číslo: 123')
expect(page).to have_content('Rodné číslo: 600101/1973')
expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves')
expect(page).to have_content("Preukaz vyzdvihne splnomocnená osoba:\r \r Meno: Jarko Mrkva\r Číslo občianskeho preukazu: 567")

Expand Down
Loading