[#4181] List the deliverables with each contract.
This commit is contained in:
@@ -8,4 +8,8 @@ class Deliverable < ActiveRecord::Base
|
||||
# Validations
|
||||
|
||||
# Accessors
|
||||
|
||||
def short_type
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,4 +6,8 @@ class FixedDeliverable < Deliverable
|
||||
# Validations
|
||||
|
||||
# Accessors
|
||||
|
||||
def short_type
|
||||
'F'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,3 +17,35 @@
|
||||
<%= link_to(l(:button_update), edit_contract_path(@project, resource)) %>
|
||||
|
||||
<%= link_to(l(:button_add_new), new_contract_deliverable_path(@project, resource), :id => 'new-deliverable') %>
|
||||
|
||||
<% if resource.deliverables.empty? %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
<table class="list" cellspacing="0" border="0" cellpadding="0" id="deliverables">
|
||||
<thead>
|
||||
<th><%= l(:field_end_date) %></th>
|
||||
<th> </th>
|
||||
<th><%= l(:field_title) %></th>
|
||||
<%# TODO: Status %>
|
||||
<th><%= l(:field_manager) %></th>
|
||||
<th><%= l(:field_labor) %></th>
|
||||
<th><%= l(:field_overhead) %></th>
|
||||
<th><%= l(:field_fixed) %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% resource.deliverables.each do |deliverable| %>
|
||||
<% content_tag_for(:tr, deliverable) do %>
|
||||
<td class="end-date"><%= h format_date(deliverable.end_date) %></td>
|
||||
<td class="type"><%= h deliverable.short_type %></td>
|
||||
<td class="title"><%= h deliverable.title %></td>
|
||||
<%# TODO: Status %>
|
||||
<td class="manager"><%= h deliverable.manager.try(:name) %></td>
|
||||
<%# TODO: deliverable calculations %>
|
||||
<td class="labor">---</td>
|
||||
<td class="overhead">---</td>
|
||||
<td class="fixed">---</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
@@ -23,4 +23,7 @@ en:
|
||||
button_add_new: Add New
|
||||
text_new_deliverable: New Deliverable
|
||||
field_manager: Manager
|
||||
field_labor: Labor
|
||||
field_overhead: Overhead
|
||||
field_fixed: Fixed
|
||||
|
||||
|
||||
@@ -32,5 +32,21 @@ class ContractsShowTest < ActionController::IntegrationTest
|
||||
assert_equal "/projects/main/contracts/#{@contract.id}/deliverables/new", current_url
|
||||
end
|
||||
|
||||
should "show a list of deliverables for the contract"
|
||||
should "show a list of deliverables for the contract" do
|
||||
@manager = User.generate!
|
||||
|
||||
@deliverable1 = FixedDeliverable.generate!(:contract => @contract, :manager => @manager)
|
||||
@deliverable2 = FixedDeliverable.generate!(:contract => @contract, :manager => @manager)
|
||||
visit_contract_page(@contract)
|
||||
|
||||
assert_select "table#deliverables" do
|
||||
[@deliverable1, @deliverable2].each do |deliverable|
|
||||
assert_select "td.end-date", :text => /#{format_date(deliverable.end_date)}/
|
||||
assert_select "td.type", :text => "F"
|
||||
assert_select "td.title", :text => /#{deliverable.title}/
|
||||
assert_select "td.manager", :text => /#{deliverable.manager.name}/
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user