gitcoinco/code_fund_ads

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

Summary

Maintainability
Test Coverage
<%= table_wrapper do %>
  <%= paginated_table do %>
    <%= table_head do %>
      <%= table_row header: true do %>
        <%= table_column "Name", add_style: "min-width: 260px" %>
        <%= table_column "URL" %>
        <%= table_column "Type" %>
        <%= table_column "Status" %>
        <%= table_column "" %>
      <% end %>
    <% end %>
    <%= table_body do %>
      <% if properties.exists? %>
        <% properties.each do |property| %>
          <%= table_row do %>
            <%= table_data add_class: "text-truncate" do %>
              <%= link_to image_tag("", class: "mr-2 lozad", alt: "#{property.name} icon", style: "width: 16px; height: 16px;", data: {src: property.favicon_image_url}) %>
              <%= link_to property.name, property %>
            <% end %>
            <%= table_data link_to(pretty_url(property.url), property.url, target: "_blank") %>
            <%= table_data property.property_type.humanize %>
            <%= table_data do %>
              <span class="badge badge-<%= status_color(property.status) %>">
              <%= property.status.humanize %>
            <% end %>
            <%= table_data do %>
              <%= edit_button(link: edit_property_path(property)) %>
              <%= delete_button(link: property_path(property, redir: user_properties_path(@user))) unless property.archived? %>
            <% end %>
          <% end %>
        <% end %>
      <% else %>
        <%= render "/shared/no_data_alert" %>
      <% end %>
    <% end %>
  <% end %>
  <%= pagination_wrapper do %>
    <span><%== pagy_bootstrap_nav(pagy) %></span>
    <%= pagy_entries(pagy) %>
  <% end if pagy.pages > 1 %>
<% end %>