openaustralia/planningalerts

View on GitHub
app/views/applications/_sort_options.html.erb

Summary

Maintainability
Test Coverage
<%= render(Standard::DropdownComponent.new) do |component| %>
  <% component.with_button do %>
    Sorted by
    <% if sort == "time" %>
      most recent first
    <% else %>
      closest first
    <% end %>
  <% end %>
  <% component.with_menu do |menu| %>
    <% menu.with_item(disabled: sort == "time") do %>
      <%= link_to "most recent first", { sort: "time", page: nil }.merge(extra_params) %>
    <% end %>
    <% menu.with_item(disabled: sort == "distance") do %>
      <%= link_to "closest first", { sort: "distance", page: nil }.merge(extra_params) %>
    <% end %>
  <% end %>
<% end %>