mfvico/gCamp

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

Summary

Maintainability
Test Coverage
<% if notice != nil %>
  <p class="alert alert-success" id="notice"><%= notice  %></p>
<% end %>

<div class="page-header">
  <% if current_user.memberships.where(project_id: @project.id, role: "owner").exists? || admin_check %>
  <div class="pull-right">
    <%= link_to "Edit", edit_project_path(@project), class: "btn btn-warning" %>
  </div>
  <% end %>
  <h1><%= @project.name %></h1>
</div>
  <ol class="breadcrumb">
    <li><%= link_to "Projects", projects_path %></li>
    <li class="active">Show</li>
  </ol>

  <p>
  <%= link_to pluralize(@project.tasks.count, "Task"), project_tasks_path(@project) %>
  </p>
  <p>
  <%= link_to pluralize(@project.users.count, "Member"), project_memberships_path(@project) %>
  </p>
  <% if current_user.memberships.where(project_id: @project.id, role: "owner").exists? || current_user.admin %>
  <div class="well">
    <p>
      <strong>Delete Project</strong>
    </p>
    <p>
      Deleting this project with also delete <%= pluralize(@project.memberships.count, "membership") %>,
      <%= pluralize(@project.tasks.count, "task") %>, and associated comments.
    </p>
    <%= link_to "Delete", project_path(@project), class: "btn btn-danger",
      :method => :delete, data: {confirm: "Are you sure?"} %>

  </div>
  <% end %>

<br>
<br>
<%= link_to "back", projects_path, class: "btn btn-primary" %>