TechLadies/home-web

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

Summary

Maintainability
Test Coverage
<div class='page-header'>
  <div class='container'>
    <h1 class='pull-left'><%= @organization.name %></h1>
    <div class='pull-right'>
      <%= link_to 'edit', edit_organization_path, class: 'btn btn-default' %>
    </div>
  </div>

  <div class='page-header-list'>
    <div class='container'>
      <ul class="list-inline">

        <%- if @organization.industry %>
          <li>
            <span>Industry</span>
            <strong><%= @organization.industry %>&nbsp;</strong>
          </li>
        <%- end %>

        <%- if @organization.phone %>
          <li>
            <span>Phone</span>
            <strong><%= @organization.phone %>&nbsp;</strong>
          </li>
        <%- end %>

        <%- if @organization.address %>
          <li>
            <span>Address</span>
            <strong><%= @organization.address %>&nbsp;</strong>
          </li>
        <%- end %>

        <%- if @organization.email %>
          <li>
            <span>Email</span>
            <strong><%= @organization.email %>&nbsp;</strong>
          </li>
        <%- end %>

      </ul>
    </div>
  </div>
</div>

<!-- Show Organization Case History -->
<div class='container'>
  <div class='panel panel-default'>
    <div class='panel-heading'>
        <h2>Case History</h2>
    </div>

    <div class='panel-body'>
    <!-- Tabs for Pending/Closed -->
      <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active">
          <a href="#pending" aria-controls="pending" role="tab" data-toggle="tab">
            <span>Pending</span>
            <span class="badge"><%= @case_files.pending.count %></span>
          </a>
        </li>
        <li role="presentation">
          <a href="#closed" aria-controls="closed" role="tab" data-toggle="tab">
            <span>Closed</span>
            <span class="badge"><%= @case_files.closed.count %></span>
          </a>
        </li>
      </ul>

      <div class="tab-content">
    <!-- Cases Pending (start) -->
        <div role="tabpanel" class="tab-pane active table-responsive" id="pending">
          <table class='table table-default'>
            <thead>
              <tr>
                <th>Case ID</th>
                <th>Type</th>
                <th>Status</th>
                <th>Involvement</th>
              </tr>
            </thead>

            <tbody>
              <%- @involvements.each do |i| %>
                <%- if i.case_file.pending? %>
                  <tr>
                    <td><%= link_to i.case_file, case_path(i.case_file) %></td>
                    <td><%= i.case_file.case_type %></td>
                    <td><%= i.case_file.status.titleize %></td>
                    <td><%= i.role.titleize %></td>
                  </tr>
                <%- end %>
              <%- end %>
            </tbody>
          </table>
        </div>
    <!-- Cases Pending (end) -->
    <!-- Cases Closed (start)-->
        <div role="tabpanel" class="tab-pane table-responsive" id="closed">
          <table class='table table-default'>
            <thead>
              <tr>
                <th>Case ID</th>
                <th>Type</th>
                <th>Status</th>
                <th>Involvement</th>
              </tr>
            </thead>

            <tbody>
              <%- @involvements.each do |i| %>
                <%- if i.case_file.closed? %>
                  <tr>
                    <td><%= link_to i.case_file, case_path(i.case_file) %></td>
                    <td><%= i.case_file.case_type %></td>
                    <td><%= i.case_file.status.titleize %></td>
                    <td><%= i.role.titleize %></td>
                  </tr>
                <%- end %>
              <%- end %>
            </tbody>
          </table>
        </div>
    <!-- Cases Closed (end)-->
      </div>
    </div>
  </div>
</div>