openaustralia/planningalerts

View on GitHub
app/views/alerts_new/_alerts.html.haml

Summary

Maintainability
Test Coverage
- if alerts.empty?
  %p You do not have any alerts.
- else
  %ul.email-alert-list
    - alerts.each do |alert|
      -# TODO: Show an error of some sort if the last delivery was not successful
      %li.email-alert
        .map{ data: { lat: alert.lat, lng: alert.lng, address: alert.address, zoom: 13, radius_meters: alert.radius_meters } }
        .email-alert-main
          %h4
            Within
            = link_to meters_in_words(alert.radius_meters.to_f), edit_profile_alert_path(alert)
            of
            = alert.address
          .last-sent= last_sent_in_words(alert.last_sent)
          .unsubscribe= button_to "Unsubscribe", [:profile, alert], method: :delete, data: { confirm: "Are you sure you want to unsubscribe for email alerts for #{alert.address}?" }, class: "button button-action"