fix: controller redirect notices to be in german, relevant and comming from...

fix: controller redirect notices to be in german, relevant and comming from translations instead from the controller
parent e986102f
Pipeline #47782 passed with stage
in 43 minutes and 58 seconds
......@@ -14,12 +14,20 @@ class SemesterProcessesController < ApplicationController
def create
@semester_process = SemesterProcess.new(semester_process_params.slice(:kind, :semester))
update_or_create
if update_or_create
redirect_to semester_process_volunteers_path, notice: I18n.t('semester_processes.create.notice')
else
render :new
end
end
def update
@save = params[:save_records]
update_or_create
if update_or_create
redirect_to semester_process_volunteers_path, notice: I18n.t("semester_processes.update.notice.#{semester_process_params[:kind]}")
else
render :new
end
end
def overdue
......@@ -35,9 +43,7 @@ class SemesterProcessesController < ApplicationController
template = EmailTemplate.half_year_process_overdue.active.first.slice(:subject, :body)
@semester_process.assign_attributes(reminder_mail_body_template: template[:body], reminder_mail_subject_template: template[:subject])
else
redirect_to new_email_template_path,
notice: 'Sie müssen eine aktive E-Mailvorlage haben,
bevor Sie eine Halbjahres Erinnerung erstellen können.'
redirect_to new_email_template_path, notice: I18n.t('semester_processes.update.notice.missing_template')
end
end
......@@ -55,9 +61,7 @@ class SemesterProcessesController < ApplicationController
template = EmailTemplate.half_year_process_email.active.first.slice(:subject, :body)
@semester_process.assign_attributes(mail_body_template: template[:body], mail_subject_template: template[:subject])
else
redirect_to new_email_template_path,
notice: 'Sie müssen eine aktive E-Mailvorlage haben,
bevor Sie eine Halbjahres Erinnerung erstellen können.'
redirect_to new_email_template_path, notice: I18n.t('semester_processes.update.notice.missing_template')
end
end
......@@ -90,11 +94,7 @@ class SemesterProcessesController < ApplicationController
@semester_process.build_volunteers_feedbacks_and_mails(@volunteers.map(&:id))
end
if @semester_process.save
redirect_to semester_process_volunteers_path, notice: 'Semester process was successfully created and emails delivered.'
else
render :new
end
@semester_process.save
end
def set_semester_process
......
......@@ -802,6 +802,14 @@ de:
hours:
new:
report_hours: "Stunden erfassen"
semester_processes:
create:
notice: Der Semesterprozess wurde erfolgreich erstellt und die emails wurden versendet.
update:
notice:
mail: Der Semesterprozess wurde erfolgreich aktualisiert.
reminder: Die errinnerungs emails wurden erfolgreich erstellt und versendet.
missing_template: Sie müssen eine aktive E-Mailvorlage haben, bevor Sie eine Halbjahres Erinnerung erstellen können.
semester_process_volunteers:
show:
title: 'Semester Prozess %{semester} von %{name}'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment