openaustralia/planningalerts

View on GitHub
app/views/_tailwind/applications/_application.html.erb

Summary

Maintainability
Test Coverage
<%= render Tailwind::PanelListItem.new(url: application_path(application)) do |c| %>
  <div class="flex items-end gap-6">
    <%= render Tailwind::Heading.new(tag: :h2, size: "xl", font: "sans") do %>
      <%= c.linkify(application.address) %>
    <% end %>
    <%# TODO: Make it the right width at different numbers %>
    <% if application.visible_comments_count.positive? %>
      <div class="pb-1 text-lg font-bold text-lavender">
        <%= render Tailwind::SpeechBubbleComponent.new(size: "lg", alignment: :left) do %>
          <%= application.visible_comments_count %>
        <% end %>
        <%= application.visible_comments_count == 1 ? "comment" : "comments" %>
      </div>
    <% end %>
  </div>
  <p class="max-w-xl text-xl text-navy">
    <%# Local variable highlights is optional. Only use it if it is there %>
    <% if local_assigns.key? :highlights %>
      <%= local_assigns[:highlights][:description].html_safe %><%# erblint:disable Rubocop %>
    <% else %>
      <%= application.description %>
    <% end %>
  </p>
  <p class="text-lg text-warm-grey">
    <%= time_ago_in_words(application.first_date_scraped).capitalize %>
    <% if application.respond_to? :distance %>
      ago, <%= km_in_words(application.distance.to_f) %> away
    <% else %>
      ago
    <% end %>
  </p>
<% end %>