codeRIT/hackathon_manager

View on GitHub
app/views/application/_triggered_email_summary.html.haml

Summary

Maintainability
Test Coverage
%h3.pb-2#triggered-email-overview Automated Messages

%table.table.table-striped
  %caption
    %ul
      %li.mb-1
        Recipient updates that match a given event will be sent the corresponding email(s) automatically.
        %br
        For example, when a user moves from the "Accepted" to "RSVP Confirmed" state, the user will be sent an email for the "RSVP Confirmed" event.
      %li Hard-coded emails are those managed in the source code repository, and cannot be disabled.
  %thead
    %tr
      %th Automation Event
      %th Message(s)
  %tbody
    - Message::POSSIBLE_TRIGGERS.keys.each do |trigger|
      %tr
        %td= Message::POSSIBLE_TRIGGERS[trigger]
        - messages = Message.automated.where(trigger: trigger).all
        %td
          - if messages.present?
            %ul.list-unstyled.mb-0
              - messages.each do |message|
                %li
                  %strong= link_to(message.name, manage_message_path(message))
          - else
            None
    %tr
      %td Disabled
      %td
        - messages = Message.automated.where(trigger: nil).all
        - if messages.present?
          %ul.list-unstyled.mb-0
            - messages.each do |message|
              %li
                %strong= link_to(message.name, manage_message_path(message))
        - else
          None