When mail template is updated, stay on edit page to easily preview it

This commit is contained in:
Mathieu Magnin 2019-03-21 15:05:30 +01:00
parent b3f3106888
commit 28f9208ce8
2 changed files with 3 additions and 2 deletions

View file

@ -12,7 +12,8 @@ class Admin::MailTemplatesController < AdminController
def update
mail_template = find_mail_template_by_slug(params[:id])
mail_template.update(update_params)
redirect_to admin_procedure_mail_templates_path
flash.notice = "Email mis à jour"
redirect_to edit_admin_procedure_mail_template_path(mail_template.procedure_id, params[:id])
end
private

View file

@ -31,7 +31,7 @@ describe Admin::MailTemplatesController, type: :controller do
}
end
it { expect(response).to redirect_to admin_procedure_mail_templates_path(procedure) }
it { expect(response).to redirect_to edit_admin_procedure_mail_template_path(procedure, initiated_mail.class.const_get(:SLUG)) }
context 'the mail template' do
subject { procedure.reload; procedure.initiated_mail_template }