Skip to content

Commit

Permalink
Copy president vote app to new ep vote app (#646)
Browse files Browse the repository at this point in the history
* copy president vote app to new ep app

* old ep vote app do routes

* add env check for ep apps

* fix tests

* fix tests

* disable ep vote app tests
  • Loading branch information
celuchmarek authored Apr 27, 2024
1 parent edd6e08 commit 1230e7a
Show file tree
Hide file tree
Showing 46 changed files with 1,683 additions and 462 deletions.
51 changes: 34 additions & 17 deletions app/controllers/apps/ep_vote_app/application_forms_controller.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,62 @@
class Apps::EpVoteApp::ApplicationFormsController < ApplicationController
before_action :set_metadata, :check_inactive_eu_application
helper FormatDaysHelper
before_action :set_metadata, :check_inactive_ep_application, :disable_current_topic
before_action :disable_feedback, only: [:show, :delivery, :create]

def show
@metadata.og.title = 'Voľby do Európskeho parlamentu'
render_step('start')
end

@application_form = Apps::EpVoteApp::ApplicationForm.new(
step: 'start'
)
render 'start'
def delivery
return render_self if request.post?
render_step('delivery')
end

def permanent_resident
return render_self if request.post?
render_step('permanent_resident')
end

def create
render_self
end

private def render_self
@application_form = Apps::EpVoteApp::ApplicationForm.new(form_params)
@application_form.run(self)
end

def end
private def render_step(step)
@application_form = Apps::EpVoteApp::ApplicationForm.new(step: step)
render step
end

private

def form_params
private def form_params
params.require(:apps_ep_vote_app_application_form).permit(
:step,
:place,
:place_first_round,
:place_second_round,
:sk_citizen,
:delivery,
:full_name, :pin, :nationality,
:full_name, :pin, :nationality, :maiden_name,
:authorized_person_full_name, :authorized_person_pin,
:street, :pobox, :municipality,
:same_delivery_address,
:delivery_street, :delivery_pobox, :delivery_municipality, :delivery_country,
:municipality_email
:municipality_email,
:municipality_email_verified,
:permanent_resident,
:back
)
end

def set_metadata
@metadata.og.image = 'og-ep-vote-app.png'
@metadata.og.description = 'Zistite kde a ako môžete voliť. Vybavte si hlasovací preukaz.'
private def set_metadata
@metadata.og.title = 'Žiadosť o hlasovací preukaz'
@metadata.og.image = 'https://volby.digital/images/share-2024.png'
@metadata.og.description = 'Aj keď budete počas volieb mimo trvalého pobytu, voliť sa dá. Stačí požiadať.'
end

def check_inactive_eu_application
private def check_inactive_ep_application
return if Apps::EpVoteApp::ApplicationForm.active?
return redirect_to apps_ep_vote_app_application_forms_path if action_name != "show"
render 'inactive'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class Apps::EpVoteAppOld::ApplicationFormsController < ApplicationController
before_action :set_metadata, :check_inactive_eu_application

def show
@metadata.og.title = 'Voľby do Európskeho parlamentu'

@application_form = Apps::EpVoteApp::ApplicationForm.new(
step: 'start'
)
render 'start'
end

def create
@application_form = Apps::EpVoteApp::ApplicationForm.new(form_params)
@application_form.run(self)
end

def end
end

private

def form_params
params.require(:apps_ep_vote_app_application_form).permit(
:step,
:place,
:sk_citizen,
:delivery,
:full_name, :pin, :nationality,
:street, :pobox, :municipality,
:same_delivery_address,
:delivery_street, :delivery_pobox, :delivery_municipality, :delivery_country,
:municipality_email
)
end

def set_metadata
@metadata.og.image = 'og-ep-vote-app.png'
@metadata.og.description = 'Zistite kde a ako môžete voliť. Vybavte si hlasovací preukaz.'
end

def check_inactive_eu_application
return if Apps::EpVoteApp::ApplicationForm.active?
return redirect_to apps_ep_vote_app_application_forms_path if action_name != "show"
render 'inactive'
end
end
Loading

0 comments on commit 1230e7a

Please sign in to comment.