From 177c1c6ab692a5ca883651d1887533dff190e3af Mon Sep 17 00:00:00 2001 From: JacksonXu33 Date: Thu, 22 Feb 2024 23:49:38 -0800 Subject: [PATCH] add flash message to resend welcome email --- app/controllers/teachers_controller.rb | 5 +++++ app/views/teachers/show.html.erb | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/app/controllers/teachers_controller.rb b/app/controllers/teachers_controller.rb index cbcf35ba..a011837d 100644 --- a/app/controllers/teachers_controller.rb +++ b/app/controllers/teachers_controller.rb @@ -160,7 +160,12 @@ def destroy def resend_welcome_email if @teacher.validated? || @is_admin TeacherMailer.welcome_email(@teacher).deliver_now + flash[:success] = "Welcome Email resent successfully!" + else + flash[:alert] = "Error resending Welcome Email. \ + Please make sure that you are signed in and validated." end + redirect_to edit_teacher_path(@teacher) end def import diff --git a/app/views/teachers/show.html.erb b/app/views/teachers/show.html.erb index 2159dbab..14a8eeb5 100644 --- a/app/views/teachers/show.html.erb +++ b/app/views/teachers/show.html.erb @@ -2,6 +2,12 @@ <%= render 'teacher_info', teacher: @teacher %> +<% if flash[:notice].present? %> +
+ <%= flash[:notice] %> +
+<% end %> +