<div class="grid">
  <% required_ids = @category&.required_tag_ids %>
  <% moderator_ids = @category&.moderator_tag_ids %>
  <% topic_ids = @category&.topic_tag_ids %>

  <% ApplicationRecord.with_lax_group_rules do %>
    <% @tags.each do |tag| %>
      <% required = required_ids&.include?(tag.id) ? 'is-filled' : '' %>
      <% topic = topic_ids&.include?(tag.id) ? 'is-outlined' : '' %>
      <% moderator = moderator_ids&.include?(tag.id) ? 'is-red is-outlined' : '' %>
      <% classes = "badge is-tag #{required} #{topic} #{moderator}" %>
      <%= render 'tag', category: @category, tag: tag, classes: classes %>
    <% end %>
  <% end %>
</div>