mfvico/gCamp

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

Summary

Maintainability
Test Coverage
<% if notice != nil %>
  <p class="alert alert-success" id="notice"><%= notice  %></p>
<% end %>
<div class="page-header">
  <div class="pull-right">
    <%= link_to 'Edit', edit_project_task_path(@project, @task), class: "btn btn-primary"%>
  </div>
  <h1><%= @task.task %></h1>
</div>

<ol class="breadcrumb">
  <li><%= link_to "Projects", projects_path %></li>
  <li><%= link_to @project.name, project_path(@project) %></li>
  <li><%= link_to "Tasks", project_tasks_path %></li>
  <li class="active">Show</li>
</ol>

<p>
  <strong>Due Date:</strong>
  <% if @task.due_date %>
    <%= @task.due_date.strftime("%B %e, %Y") %>
  <% else %>
    None
  <% end %>
</p>
<p>
  <strong>Complete?</strong>
  <%= @task.complete %>
</p>

<br>
<table class="table">
  <tbody>
    <% @task.comments.where(:created_at != nil).each do |comment| %>
        <tr>
          <td class="col-md-3">
          <% if comment.user == nil  %>
            <span class="text-muted">Deleted User</span>
          <% else %>
            <%= link_to comment.user.full_name, user_path(comment.user_id) %>
          <% end %>
            <br><span class="text-muted"><%= time_ago_in_words(comment.created_at) %> ago</span>
            </td>
          <td class="col-md-9"><%= comment.description %></td>
        </tr>
    <% end %>
  </tbody>
</table>



  <% if current_user %>
    <%= form_for [@project, @task, @comment], html: {class: "form-horizontal"} do |f| %>

      <div class="form-group">
        <div class=" col-sm-9 col-sm-offset-3">
          <%= f.text_area :description, class: "form-control" %>
        </div>
      </div>

      <div class="actions form-group">
        <div class="col-sm-offset-3 col-sm-9">
          <%= f.submit class: " btn btn-primary" %>
        </div>
      </div>

    <% end %>
  <% end %>