Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuchal authored Apr 27, 2024
2 parents df51545 + 9aba17b commit f7c56dc
Show file tree
Hide file tree
Showing 49 changed files with 1,688 additions and 467 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ GEM
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.9)
nio4r (2.7.0)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
Expand Down Expand Up @@ -288,7 +288,7 @@ GEM
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (5.0.3)
puma (6.3.1)
puma (6.4.2)
nio4r (~> 2.0)
que (2.2.0)
que-web (0.10.0)
Expand Down
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 f7c56dc

Please sign in to comment.