From 935863435375bf21dcab98d95a9d02c9031d68f5 Mon Sep 17 00:00:00 2001 From: davidg73 <david.gunnarsson@univie.ac.at> Date: Wed, 7 May 2025 15:11:03 +0200 Subject: [PATCH] Add instruction cards for admin email config --- .../admin_email_setup_instructions_card.rb | 7 +++++++ app/avo/cards/send_test_email_card.rb | 7 +++++++ app/avo/dashboards/home_dashboard.rb | 2 ++ ...admin_email_setup_instructions_card.html.erb | 17 +++++++++++++++++ app/views/avo/cards/_test_email_card.html.erb | 15 +++++++++++++++ config/routes.rb | 8 ++++++++ 6 files changed, 56 insertions(+) create mode 100644 app/avo/cards/admin_email_setup_instructions_card.rb create mode 100644 app/avo/cards/send_test_email_card.rb create mode 100644 app/views/avo/cards/_admin_email_setup_instructions_card.html.erb create mode 100644 app/views/avo/cards/_test_email_card.html.erb diff --git a/app/avo/cards/admin_email_setup_instructions_card.rb b/app/avo/cards/admin_email_setup_instructions_card.rb new file mode 100644 index 0000000..d71994d --- /dev/null +++ b/app/avo/cards/admin_email_setup_instructions_card.rb @@ -0,0 +1,7 @@ +class Avo::Cards::AdminEmailSetupInstructionsCard < Avo::Cards::PartialCard + self.id = "admin_email_setup_instructions" + self.label = "Instructions to Receive Admin Emails" + self.cols = 3 + self.rows = 1 + self.partial = "avo/cards/admin_email_setup_instructions_card" +end diff --git a/app/avo/cards/send_test_email_card.rb b/app/avo/cards/send_test_email_card.rb new file mode 100644 index 0000000..7fecba5 --- /dev/null +++ b/app/avo/cards/send_test_email_card.rb @@ -0,0 +1,7 @@ +class Avo::Cards::SendTestEmailCard < Avo::Cards::PartialCard + self.id = "test_email" + self.label = "Test Email Distribution" + self.cols = 1 + self.rows = 1 + self.partial = "avo/cards/test_email_card" +end diff --git a/app/avo/dashboards/home_dashboard.rb b/app/avo/dashboards/home_dashboard.rb index e94bfa2..2b0eb1f 100644 --- a/app/avo/dashboards/home_dashboard.rb +++ b/app/avo/dashboards/home_dashboard.rb @@ -15,5 +15,7 @@ class Avo::Dashboards::HomeDashboard < Avo::Dashboards::BaseDashboard def cards card Avo::Cards::UserRoleCard card Avo::Cards::RegistrationPathCard + card Avo::Cards::AdminEmailSetupInstructionsCard if Current.user.admin? + card Avo::Cards::SendTestEmailCard if Current.user.admin? end end diff --git a/app/views/avo/cards/_admin_email_setup_instructions_card.html.erb b/app/views/avo/cards/_admin_email_setup_instructions_card.html.erb new file mode 100644 index 0000000..4836650 --- /dev/null +++ b/app/views/avo/cards/_admin_email_setup_instructions_card.html.erb @@ -0,0 +1,17 @@ +<div class="flex-1 flex p-4"> + <div class="w-full"> + <p class="text-sm mb-4"> + Admin notifications about role changes, new users, etc., <i>are not sent directly</i> to the admin emails seen in <%= link_to "Users Management", avo.resources_users_path, target: "_blank", class: "text-primary-500 underline hover:text-primary-600" %>. + <br/> + Instead, a <%= link_to "Service Email Address from Vienna University", main_app.service_email_url, target: "_blank", class: "text-primary-500 underline hover:text-primary-600" %> is used as a central hub for admin emails. All admin emails are sent to the service email address (facemf54), which redirects all tickets and notifications as defined in that account. + </p> + <p class="text-sm mb-4"> + The reason behind this is that users can also have direct contact with the admins via backoffice@facem.at, which requires a managed email service anyway. So instead of having two places to manage recipients of admin tickets, we unify the configuration in one place. + </p> + <p class="text-sm mb-4"> + In order to also receive admin emails you will need to ask somebody with access to the service email account to add your email address to + <%= link_to "its email forwarding configuration", main_app.email_forwarding_instructions_url, target: "_blank", class: "text-primary-500 underline hover:text-primary-600" %>. + After that is configured you can send test emails via the "Send Test Email" button. + </p> + </div> +</div> \ No newline at end of file diff --git a/app/views/avo/cards/_test_email_card.html.erb b/app/views/avo/cards/_test_email_card.html.erb new file mode 100644 index 0000000..980dbd4 --- /dev/null +++ b/app/views/avo/cards/_test_email_card.html.erb @@ -0,0 +1,15 @@ +<div class="flex-1 flex p-4"> + <div class="w-full"> + <p class="text-sm mb-4">Click the button below to send a test email to all administrators.</p> + <p class="text-sm mb-4"> + This is useful when adding a new admin and checking whether the + <%= link_to "email forwarding", main_app.email_forwarding_instructions_url, target: "_blank", class: "text-primary-500 underline hover:text-primary-600" %> + has been set up correctly. + </p> + + <%= link_to "Send Test Email", + avo.test_email_send_path, + class: "inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-primary-500 hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500", + data: { turbo: false } %> + </div> +</div> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 985409e..1b202ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,14 @@ Rails.application.routes.draw do direct :facem_home do "https://facem.at" end + + direct :email_forwarding_instructions do + "https://zid.univie.ac.at/en/forwarding/" + end + + direct :service_email do + "https://zid.univie.ac.at/en/e-mail/#c21958" + end end if defined? ::Avo -- GitLab