-
Notifications
You must be signed in to change notification settings - Fork 0
/
_task_card_small.html.erb
46 lines (46 loc) · 2.13 KB
/
_task_card_small.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<div class="card m-3">
<div class="card-body">
<div class="d-flex justify-content-end w-100">
<h5 class="mr-auto"><%= task.title %></h5>
<% if policy(task).edit? %>
<%= link_to edit_task_path(task), class: "mr-3 text-dark" do %>
<i class="far fa-edit"></i>
<% end %>
<% end %>
<% if policy(task).destroy? %>
<%= link_to task_path(task), method: :delete, class: "mr-3 text-danger", data: { confirm: "Are you sure?"} do %>
<i class="fas fa-trash-alt"></i>
<% end %>
<% end %>
</div>
<hr>
<h6 class="card-subtitle mb-2 text-muted"><%= task.location %></h6>
<div class="d-flex justify-content-between align-items-center">
<p class="text-<%= task.status == "pending" ? "secondary" : task.status == "completed" ? "success" : "primary" %>">
<%= task.status.upcase %>
</p>
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#taskModal<%= task.id %>">
Preview
</button>
</div>
<% if card_type == "creator" %>
<hr>
<% if task.status == "pending"%>
<button type="button" class="btn btn-outline-secondary btn-sm w-100 mt-3" data-toggle="modal" data-target="#applicationModal<%= task.id %>">
Applications <span class="badge badge-dark"><%= task.helps.count %></span>
</button>
<% elsif task.status != "completed" %>
<div class="d-flex align-items-center">
<h5 class=" ml-2"><%= link_to task.helper.first_name, user_path(task.helper) %> is your helper!</h5>
</div>
<%= link_to "Mark as done", task_complete_path(task), class: "btn btn-success btn-sm w-100 mt-2", data: { confirm: "Are you sure?"}, method: :patch %>
<%# TODO: Make this path lead to creating a review %>
<%# <%= link_to "Mark as done", new_task_review_path(task), class: "btn btn-success btn-sm w-100 mt-2" %>
<% else %>
<div class="d-flex align-items-center">
<h5 class=" ml-2"><%= link_to task.helper.first_name, user_path(task.helper) %> was your helper!</h5>
</div>
<% end %>
<% end %>
</div>
</div>