rubygems/adoption-center

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

Summary

Maintainability
Test Coverage
<% page_title! "Gem #{@ruby_gem.name}" %>

<div class="l-overflow">
  <!-- Gem Information / Left container -->
  <div class="l-colspan--l colspan--l--has-border">
    <div class="gem__intro">
      <div id="markup" class="gem__desc">
        <span> <%= @ruby_gem.info %></span>
        <%= link_to "Read more", @ruby_gem.project_uri, target: 'blank' %>.
      </div>
    </div>

    <div class="">
      <h3 class="t-list__heading">About the adoption:</h3><br>
      <div class="gem__desc">
        <% if @gems_adoption.description.present? %>
          <p><%= @gems_adoption.description %></p><br>
        <% end %>
        <p>
          <b><%= link_to @adoption_owner.username, @adoption_owner.rubygems_profile, target: 'blank' %></b> put this gem up for adoption on <b><%= l(@gems_adoption.created_at, format: "%B %d, %Y.").capitalize %></b>
        </p>
      </div>
    </div>
  </div>

  <!-- Actions / Right container -->
  <div class="gem__aside l-col--r--pad">
    <div class="gem__downloads-wrap">
      <% if logged_in? %>
        <% if current_user.owns_gem?(@ruby_gem) %>
          <% if @gems_adoption %>
              <%= link_to 'Remove from adoption', @gems_adoption, method: :delete, data: { confirm: 'Are you sure?' } %>
              <%= link_to 'View adoption requests', :adoption_requests %>
          <% else %>
            <%= link_to 'Put up for adoption', new_gems_adoption_path(id: @ruby_gem.id) %>
          <% end %>
        <% else %>
          <% if @adoption_request %>
            <!-- TODO: Button to cancel adoption request -->
            <p>You are waiting for a response to your adoption request</p>
          <% else %>
            <%= link_to 'Adopt this gem', new_adoption_request_path(id: @gems_adoption.id) %>
          <% end %>
        <% end %>
      <% else %>
        <%= link_to 'Adopt this gem', new_adoption_request_path(id: @gems_adoption.id) %>
      <% end %>
    </div>
  </div>
</div>