gitcoinco/code_fund_ads

View on GitHub
app/views/versions/_table.html.erb

Summary

Maintainability
Test Coverage
<%= table do %>
  <%= table_head do %>
    <%= table_row header: true do %>
      <%= table_column {"Index"} %>
      <%= table_column {"Date"} %>
      <%= table_column {"Author"} %>
      <%= table_column {"Event"} %>
      <%= table_column {} %>
    <% end %>
  <% end %>
  <%= table_body do %>
    <% if versionable.versions.exists? %>
      <% versionable.versions.reverse.each do |version| %>
        <%= table_row do %>
          <%= table_data version.index %>
          <%= table_data version.created_at %>
          <%= table_data do %>
            <%= link_to find_version_author(version), user_path(find_version_author(version)) rescue "Not Assigned" %>
          <% end %>
          <%= table_data version.event.humanize %>
          <%= table_data do %>
            <a data-controller="remote-modal"
              data-action="click->remote-modal#displayModal"
              data-url="<%= version_path(version, sgid: versionable.to_sgid) %>"
              href="#">
              <i class="fas fa-exchange"></i> Diff
            </a>
          <% end %>
        <% end %>
      <% end %>
    <% else %>
      <%= render "/shared/no_data_alert" %>
    <% end %>
  <% end %>
<% end %>