Skip to content

Commit

Permalink
Rename stories_table to project_table
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusdeap committed Dec 10, 2021
1 parent ac383bc commit d8c0c5b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
60 changes: 60 additions & 0 deletions app/views/projects/_project_table.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<table class="project-table">
<thead class="table-header fixed-header">
<tr class="project-table__row project-table__row--header">
<th class="project-table__cell">Story Title</th>
<th class="project-table__cell">Best Estimate</th>
<th class="project-table__cell">Worst Estimate</th>
<th class="project-table__cell">
<%= link_to "Add a Story", new_project_story_path(@project.id), class: "button magenta" %>
<button id="bulk_delete" class="button magenta" aria-disabled="true" disabled>Bulk Delete</button>
</th>
</tr>
</thead>

<tbody id="stories" data-url="<%= sort_project_path(@project.id) %>">
<% if @stories.present? %>
<% @stories.each do | story | %>
<tr class="project-table__row project-table__row--story" id="<%= dom_id(story)%>" >
<td class="project-table__cell">
<input type="checkbox" name="stories[]" value=<%= story.id %>>
<%= link_to story.title, [story.project, story] %>
</td>
<td class="project-table__cell"><%= story.estimates.where(user: current_user)&.first&.best_case_points %></td>
<td class="project-table__cell"><%= story.estimates.where(user: current_user)&.first&.worst_case_points %></td>
<td class="project-table__cell">
<%= link_to 'Clone', new_project_story_path(@project.id, story_id: story.id), class: "button green clone" %>
<%= link_to 'Edit', edit_project_story_path(@project.id, story), class: "button green edit" %>
<% if estimated(story) %>
<%= link_to 'Edit Estimate', edit_project_story_estimate_path(@project.id, story, @estimate_id), class: "button green edit-estimate", remote: true %>
<% else %>
<%= link_to 'Add Estimate', new_project_story_estimate_path(@project.id, story), class: "button green add-estimate", remote: true %>
<% end %>
<%= 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 %>
<% if @siblings.any? %>
<div class="move-story-wrapper">
<button class="button green">Move to</button>
<div class="move-story-dropdown">
<% @siblings.each do |to_project| %>
<%= button_to to_project.title, project_story_move_path(@project, story, to_project: to_project), method: :put, data: {confirm: "Are you sure?"} %>
<% end %>
</div>
</div>
<% end %>
</td>
</tr>
<% end %>
<% else %>
<p> You don't have any stories yet. </p>
<% end %>
</tbody>

<tfoot>
<tr class="project-table__row project-table__row--footer">
<td class="project-table__cell">Total estimates</td>
<td class="project-table__cell"><%= @project.best_estimate_sum_per_user(current_user) %></td>
<td class="project-table__cell"><%= @project.worst_estimate_sum_per_user(current_user) %></td>
<td class="project-table__cell"></td>
</tr>
</tfoot>

</table>
4 changes: 2 additions & 2 deletions app/views/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<%= f.search_field :title_cont, onkeyup: "filterStories()" %>
</div>
<% end %>
<div id="stories-table">
<%= render partial: "projects/stories_table", locals: { project: @project, stories: @stories } %>
<div id="project-table">
<%= render partial: "projects/project_table", locals: { project: @project, stories: @stories } %>
</div>
<%= render partial: "projects/import_export" %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/projects/show.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$("#stories-table").html("<%= j render(partial: 'projects/stories_table', locals: { project: @project, stories: @stories }) %>")
$("#project-table").html("<%= j render(partial: 'projects/project_table', locals: { project: @project, stories: @stories }) %>")

0 comments on commit d8c0c5b

Please sign in to comment.