Skip to content

Commit d8c0c5b

Browse files
committed
Rename stories_table to project_table
1 parent ac383bc commit d8c0c5b

File tree

3 files changed

+63
-3
lines changed

3 files changed

+63
-3
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<table class="project-table">
2+
<thead class="table-header fixed-header">
3+
<tr class="project-table__row project-table__row--header">
4+
<th class="project-table__cell">Story Title</th>
5+
<th class="project-table__cell">Best Estimate</th>
6+
<th class="project-table__cell">Worst Estimate</th>
7+
<th class="project-table__cell">
8+
<%= link_to "Add a Story", new_project_story_path(@project.id), class: "button magenta" %>
9+
<button id="bulk_delete" class="button magenta" aria-disabled="true" disabled>Bulk Delete</button>
10+
</th>
11+
</tr>
12+
</thead>
13+
14+
<tbody id="stories" data-url="<%= sort_project_path(@project.id) %>">
15+
<% if @stories.present? %>
16+
<% @stories.each do | story | %>
17+
<tr class="project-table__row project-table__row--story" id="<%= dom_id(story)%>" >
18+
<td class="project-table__cell">
19+
<input type="checkbox" name="stories[]" value=<%= story.id %>>
20+
<%= link_to story.title, [story.project, story] %>
21+
</td>
22+
<td class="project-table__cell"><%= story.estimates.where(user: current_user)&.first&.best_case_points %></td>
23+
<td class="project-table__cell"><%= story.estimates.where(user: current_user)&.first&.worst_case_points %></td>
24+
<td class="project-table__cell">
25+
<%= link_to 'Clone', new_project_story_path(@project.id, story_id: story.id), class: "button green clone" %>
26+
<%= link_to 'Edit', edit_project_story_path(@project.id, story), class: "button green edit" %>
27+
<% if estimated(story) %>
28+
<%= link_to 'Edit Estimate', edit_project_story_estimate_path(@project.id, story, @estimate_id), class: "button green edit-estimate", remote: true %>
29+
<% else %>
30+
<%= link_to 'Add Estimate', new_project_story_estimate_path(@project.id, story), class: "button green add-estimate", remote: true %>
31+
<% end %>
32+
<%= link_to 'Delete', project_story_path(@project.id, story, format: "json"), method: "delete", data: { confirm: 'Are you sure?', story_id: story.id }, class: "button green delete", remote: true %>
33+
<% if @siblings.any? %>
34+
<div class="move-story-wrapper">
35+
<button class="button green">Move to</button>
36+
<div class="move-story-dropdown">
37+
<% @siblings.each do |to_project| %>
38+
<%= button_to to_project.title, project_story_move_path(@project, story, to_project: to_project), method: :put, data: {confirm: "Are you sure?"} %>
39+
<% end %>
40+
</div>
41+
</div>
42+
<% end %>
43+
</td>
44+
</tr>
45+
<% end %>
46+
<% else %>
47+
<p> You don't have any stories yet. </p>
48+
<% end %>
49+
</tbody>
50+
51+
<tfoot>
52+
<tr class="project-table__row project-table__row--footer">
53+
<td class="project-table__cell">Total estimates</td>
54+
<td class="project-table__cell"><%= @project.best_estimate_sum_per_user(current_user) %></td>
55+
<td class="project-table__cell"><%= @project.worst_estimate_sum_per_user(current_user) %></td>
56+
<td class="project-table__cell"></td>
57+
</tr>
58+
</tfoot>
59+
60+
</table>

app/views/projects/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<%= f.search_field :title_cont, onkeyup: "filterStories()" %>
77
</div>
88
<% end %>
9-
<div id="stories-table">
10-
<%= render partial: "projects/stories_table", locals: { project: @project, stories: @stories } %>
9+
<div id="project-table">
10+
<%= render partial: "projects/project_table", locals: { project: @project, stories: @stories } %>
1111
</div>
1212
<%= render partial: "projects/import_export" %>
1313

app/views/projects/show.js.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
$("#stories-table").html("<%= j render(partial: 'projects/stories_table', locals: { project: @project, stories: @stories }) %>")
1+
$("#project-table").html("<%= j render(partial: 'projects/project_table', locals: { project: @project, stories: @stories }) %>")

0 commit comments

Comments
 (0)