openaustralia/planningalerts

View on GitHub
maizzle/src/templates/alert.html

Summary

Maintainability
Test Coverage
---
title: <%= subject(@alert, @applications, @comments) %>
preheader: <%= preheader(@applications, @comments) %>
bodyClass: bg-light-grey dark-mode:bg-[#333]
permalink: ../app/views/alert_mailer/alert.html.erb
---

<x-standard-image-in-footer>
  <x-spacer height="56px" />
  <% @applications.each do |application| %>
    <x-box>
      <x-application address="<%= application.address %>"
        description="<%= application.description %>"
        distance="<%= distance_and_heading_in_words(@alert.location, application.location) %>"
        url="<%= application_url_with_tracking(id: application.id) %>"
        map="<%= google_static_map_url(lat: application.lat, lng: application.lng, size: '150x150', key: :email) %>"
        map_alignment="right" />
    </x-box>
    <x-spacer height="20px" />
    <% end %>
  <x-spacer height="8px" />
  <% @comments.each do |comment| %>
    <x-spacer height="16px" />
    <x-comment name="<%= comment.name %>"
               comment_as_paragraphs="comment_as_html_paragraphs_no_link(comment.text)"
               url="<%= comment_url_with_tracking(comment:) %>"
               application_address="<%= comment.application.address %>"
               application_map="<%= google_static_map_url(lat: comment.application.lat, lng: comment.application.lng, size: '150x150', key: :email) %>"
               application_description="<%= comment.application.description %>" />
  <% end %>
  <!-- TODO: Style divider correctly -->
  <x-divider />
  <x-box-button url="<%= edit_profile_alert_url(@alert) %>"
                icon="<%= attachments['pencil.png'].url %>">
    Edit alert
  </x-box-button>
  <x-spacer height="8px" />
  <x-box-button url="<%= unsubscribe_alert_url(confirm_id: @alert.confirm_id) %>"
                icon="<%= attachments['trash.png'].url %>">
    Unsubscribe from alert
  </x-box-button>
</x-standard>