somleng/somleng

View on GitHub
app/views/dashboard/available_phone_numbers/_collection.html.erb

Summary

Maintainability
Test Coverage
<table class="table table-bordered table-striped">
  <thead>
    <tr role="row">
      <th>
        Number
      </th>
      <th>
        Location
      </th>
      <th>
        Type
      </th>
      <th>
        Monthly Fee
      </th>
      <th>
        Actions
      </th>
    </tr>
  </thead>

  <tbody>
    <% resources.each do |phone_number| %>
      <% phone_number = phone_number.decorated %>
      <tr role="row" class="<%= cycle("odd", "even", name: "row_class") -%>">
        <td>
          <%= phone_number.number_formatted %>
        </td>

        <td>
          <%= phone_number.country.emoji_flag %>
          <%= phone_number.formatted_location %>
        </td>

        <td>
          <%= phone_number.type_formatted %>
        </td>

        <td>
          <%= phone_number.price.format %>
        </td>

        <td>
          <%= link_to(new_dashboard_phone_number_plan_path(phone_number_id: phone_number), class: "btn btn-success btn-sm text-white") do %>
            <i class="fa-solid fa-cart-plus"></i> Buy
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>