TechLadies/home-web

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

Summary

Maintainability
Test Coverage
<div class='page-header'>

  <div class='container'>
    <h1 class='pull-left'><%= @person.name %></h1>
    <div class='pull-right'>
      <%= link_to 'edit', edit_person_path, class: 'btn btn-default' %>
    </div>
  </div>

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

        <%- if @person.date_of_birth %>
          <li>
            <span>DOB</span>
            <strong><%= @person.date_of_birth.to_formatted_s(:rfc822) unless @person.date_of_birth == nil %></strong>
          </li>
        <%- end %>

        <%- if @person.gender %>
          <li>
            <span>Gender</span>
            <strong><%= @person.gender %>&nbsp;</strong>
          </li>
        <%- end %>

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

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

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

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

</div>

<!-- <div class="container">
  <div class='panel panel-default'>
    <div class='panel-heading'>
      <h2>Related Organization</h2>
    </div>
    <div class='panel-body'>
      <div class="row">
        <div class="col-xs-12">

            <ul>
              <li>Tinkerbox</li>
              <li>Mc Donalds</li>
              <li>KFC</li>
            </ul>

        </div>
      </div>
    </div>
  </div>
</div> -->

<!-- Show Person 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>