rubygems/adoption-center

View on GitHub
app/views/gems/index.html.erb

Summary

Maintainability
Test Coverage
<% page_title! 'My Gems' %>

<h1><%= current_user.username %></h1>
<h3 class="text-muted"><%= pluralize(@ruby_gems.count, 'Gem') %></h3>
<hr>

<% if @ruby_gems.empty? %>
  <h3 class="text-muted">You haven't pushed any gems yet.</h3>
<% else %>
  <% @ruby_gems.each do |ruby_gem| %>
    <div class="clearfix">
      <h4 class="pull-left"><%= link_to ruby_gem.name, gem_path(ruby_gem) %></h4>
      <% if ruby_gem.gems_adoption %>
        <%= link_to 'Remove from adoption', ruby_gem.gems_adoption, method: :delete, class: 'btn btn-danger pull-right', data: { confirm: 'Are you sure?' } %>
      <% else %>
        <%= link_to 'Put up for adoption', new_gems_adoption_path(id: ruby_gem.id), class: 'btn btn-primary pull-right' %>
      <% end %>
    </div>
    <hr>
  <% end %>
<% end %>