Skip to content

Commit

Permalink
fix: go back button (#622)
Browse files Browse the repository at this point in the history
* added Go Back button to pages where missing
* fix: test in spec/features/apps/parliament_vote_app_spec.rb
  • Loading branch information
zuzana authored Oct 11, 2023
1 parent 514c266 commit c5e4e66
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
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

0 comments on commit c5e4e66

Please sign in to comment.