-
Notifications
You must be signed in to change notification settings - Fork 23
Add reminder emails to Event Management #1433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RJV333
wants to merge
6
commits into
main
Choose a base branch
from
938_add_event_remind_email_to_event_management
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6538165
Update controller endpoints
RJV333 38e3a29
Add routes, policy, views
RJV333 73e9e01
Update event_mailer_spec
RJV333 e0030b8
Rename endpoint preview_reminder and add partial
RJV333 8b8ba33
Make reminder_preview link match other evnt_management links
RJV333 df56a11
Merge branch 'main' into 938_add_event_remind_email_to_event_management
RJV333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/views/event_mailer/event_registration_reminder.html.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <h1>Event reminder</h1> | ||
|
|
||
| <div style="margin-top: 36px; text-align: left;"> | ||
| <p> | ||
| Hello <strong><%= @person.full_name %></strong>, | ||
| </p> | ||
|
|
||
| <p> | ||
| This is a reminder that you're registered for the following <%= @organization_name %> event<%= raw(" " + (@days_until_event == 0 ? "<strong>today</strong>" : @days_until_event == 1 ? "<strong>tomorrow</strong>" : "in <strong>#{@days_until_event} days</strong>")) if @days_until_event.is_a?(Integer) %>: | ||
| </p> | ||
|
|
||
| <div style="text-align: center; background-color: #f3f4f6; border-radius: 6px; padding: 24px; margin: 16px 0;"> | ||
| <% if @event.respond_to?(:pre_title) && @event.pre_title.present? %> | ||
| <p style="font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 4px; font-family: 'Telefon Bold', sans-serif;"> | ||
| <%= @event.pre_title %> | ||
| </p> | ||
| <% end %> | ||
|
|
||
| <h2 style="font-size: 28px; font-weight: bold; color: #166534; margin: 0 0 16px; font-family: Lato, sans-serif;"> | ||
| <%= @event.title %> | ||
| </h2> | ||
|
|
||
| <p style="font-size: 22px; font-weight: bold; color: #1e3a8c; text-transform: uppercase; margin: 0 0 8px; font-family: Lato, sans-serif;"> | ||
| <% Time.use_zone(@time_zone) { %><%= @event.times(display_day: true, display_date: true) %><% } %> | ||
| </p> | ||
|
|
||
| <% if @event.labelled_cost.present? %> | ||
| <p style="font-size: 18px; font-weight: bold; color: #1e3a8c; text-transform: uppercase; margin: 0 0 8px; font-family: Lato, sans-serif;"> | ||
| <%= @event.labelled_cost %> | ||
| </p> | ||
| <% end %> | ||
|
|
||
| <% if @event.location.present? %> | ||
| <p style="font-size: 16px; color: #374151; margin: 0 0 8px;"> | ||
| <%= @event.location.name %> | ||
| </p> | ||
| <% end %> | ||
|
|
||
| <% if @event.videoconference_url.present? %> | ||
| <p style="font-size: 16px; color: #374151; margin: 0 0 8px;"> | ||
| <a href="<%= @event.videoconference_url %>" style="color: #374151; text-decoration: underline;">Join us on <%= @event.decorate.videoconference_domain %></a> | ||
| </p> | ||
| <% end %> | ||
| </div> | ||
| </div> | ||
|
|
||
| <p> | ||
| Visit the event page for updates, directions, or calendar links: | ||
| </p> | ||
|
|
||
| <p> | ||
| <% if @event_registration.persisted? && @event_registration.slug.present? %> | ||
| <a href="<%= registration_ticket_url(@event_registration.slug) %>" class="button">View registration</a> | ||
| <% end %> | ||
| <a href="<%= @event_url %>" class="button">View event</a> | ||
| </p> | ||
|
|
||
| <p style="margin-top: 24px; font-size: 12px; color: #6b7280;"> | ||
| This is an automated reminder from <%= @organization_name %>. | ||
| </p> |
32 changes: 32 additions & 0 deletions
32
app/views/event_mailer/event_registration_reminder.text.erb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| Event reminder | ||
|
|
||
| Hello <%= @person.full_name %>, | ||
|
|
||
| This is a reminder that you're registered for the following event<%= @days_until_event.is_a?(Integer) ? (@days_until_event == 0 ? " today" : @days_until_event == 1 ? " tomorrow" : " in #{@days_until_event} days") : "" %>: | ||
|
|
||
| <% if @event.respond_to?(:pre_title) && @event.pre_title.present? %> | ||
| <%= @event.pre_title %> | ||
| <% end %><%= @event.title %> | ||
| <% Time.use_zone(@time_zone) { %><%= @event.times(display_day: true, display_date: true) %><% } %> | ||
|
|
||
| <% if @event.location.present? %> | ||
| Location: <%= @event.location.name %> | ||
| <% end %> | ||
|
|
||
| <% if @event.videoconference_url.present? %> | ||
| Videoconference URL: <%= @event.videoconference_url %> | ||
| <% end %> | ||
|
|
||
| <% if @event.labelled_cost.present? %> | ||
| <%= @event.labelled_cost %> | ||
| <% end %> | ||
|
|
||
| <% if @event_registration.slug.present? %> | ||
| View your registration: | ||
| <%= registration_ticket_url(@event_registration.slug) %> | ||
|
|
||
| <% end %>View the event page: | ||
| <%= @event_url %> | ||
|
|
||
| -- | ||
| This is an automated reminder from <%= @organization_name %>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <% content_for(:page_bg_class, "admin-only bg-blue-100") %> | ||
| <div class="max-w-4xl mx-auto <%= DomainTheme.bg_class_for(:events) %> border border-gray-200 rounded-xl shadow p-6"> | ||
| <div class="mb-6"> | ||
| <%= link_to "← Manage registrants", manage_event_path(@event), class: "text-sm text-gray-500 hover:text-gray-700 mb-2 inline-block" %> | ||
| <h1 class="text-2xl font-semibold text-gray-900"> | ||
| Send reminder email | ||
| </h1> | ||
| <p class="text-gray-600 mt-1"> | ||
| <%= @event.title %> | ||
| </p> | ||
| </div> | ||
|
|
||
| <% if @event_registrations.empty? %> | ||
| <p class="text-gray-600 mb-4">There are no registrants with an email address to send a reminder to.</p> | ||
| <%= link_to "Back to manage", manage_event_path(@event), class: "btn btn-secondary-outline" %> | ||
| <% else %> | ||
| <%= form_with url: send_reminder_event_path(@event), method: :post, local: true do |f| %> | ||
| <h2 class="text-lg font-semibold text-gray-800 mb-2 pb-2 border-b border-gray-200">Recipients</h2> | ||
| <p class="text-gray-600 mb-3"> | ||
| Choose who will receive this reminder: | ||
| </p> | ||
| <div class="overflow-x-auto border border-gray-200 rounded-lg mb-6"> | ||
| <table class="w-full border-collapse"> | ||
| <thead class="bg-gray-100"> | ||
| <tr> | ||
| <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-10"> | ||
| <input type="checkbox" id="recipients_select_all" class="rounded border-gray-300" checked aria-label="Select all" onclick="document.querySelectorAll('.recipient-checkbox').forEach(function(c){ c.checked = document.getElementById('recipients_select_all').checked })"> | ||
| </th> | ||
| <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700">Name</th> | ||
| <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700">Email</th> | ||
| <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700">Payment status</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody class="divide-y divide-gray-200 bg-white"> | ||
| <% @event_registrations.each do |reg| %> | ||
| <% person = reg.registrant %> | ||
| <tr class="hover:bg-gray-50"> | ||
| <td class="px-4 py-2"> | ||
| <%= check_box_tag "registration_ids[]", reg.id, true, class: "recipient-checkbox rounded border-gray-300", id: "registration_ids_#{reg.id}" %> | ||
| </td> | ||
| <td class="px-4 py-2 text-sm text-gray-900"><%= person.full_name %></td> | ||
| <td class="px-4 py-2 text-sm text-gray-700"><%= person.preferred_email %></td> | ||
| <td class="px-4 py-2 text-sm"> | ||
| <% if @event.object.cost_cents.to_i > 0 %> | ||
| <% if reg.scholarship_recipient? && reg.successful_payments_total_cents <= 0 %> | ||
| <span class="text-gray-400">—</span> | ||
| <% elsif reg.paid_in_full? %> | ||
| <span class="inline-flex items-center gap-1 rounded-full text-xs font-medium border px-2 py-0.5 bg-green-50 text-green-700 border-green-200">Paid</span> | ||
| <% else %> | ||
| <% due_cents = @event.object.cost_cents - reg.successful_payments_total_cents %> | ||
| <span class="inline-flex items-center gap-1 rounded-full text-xs font-medium border px-2 py-0.5 bg-amber-50 text-amber-700 border-amber-200">$<%= "%.2f" % (due_cents / 100.0) %> due</span> | ||
| <% end %> | ||
| <% else %> | ||
| <span class="text-gray-400">—</span> | ||
| <% end %> | ||
| </td> | ||
| </tr> | ||
| <% end %> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
|
|
||
| <% if @reminder_preview_html.present? %> | ||
| <div class="mb-6"> | ||
| <h2 class="text-lg font-semibold text-gray-800 mb-3 pb-2 border-b border-gray-200">Preview (sample registrant)</h2> | ||
| <div class="border border-gray-200 rounded-lg bg-white overflow-hidden"> | ||
| <div class="email-preview overflow-auto max-h-[70vh] p-4" style="font-family: Lato, sans-serif;"> | ||
| <%= raw @reminder_preview_html %> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <% end %> | ||
|
|
||
| <%= f.submit "Send reminder", class: "btn btn-primary", data: { turbo_confirm: "Send reminder emails to the selected registrant(s)?" } %> | ||
| <% end %> | ||
| <% end %> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit. This will implicitly look up the policy name from the action. Should only need to use
to:when a different policy is required. Sorry I missed this before.