[#4177] Created a Contract list view based on the comps.

This commit is contained in:
Eric Davis
2010-06-17 15:39:12 -07:00
parent 5960a4359a
commit 1729bc48c9
4 changed files with 57 additions and 6 deletions

View File

@@ -1 +1,25 @@
Yay!
<% if collection.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
<table class="list" cellspacing="0" border="0" cellpadding="0" id="contracts">
<thead>
<th><%= l(:field_id) %></th>
<th><%= l(:field_name) %></th>
<%# TODO: Status %>
<%# TODO: Type %>
<th><%= l(:field_account_executive_short) %></th>
<%# TODO: Total Budget %>
<th><%= l(:field_end_date) %></th>
</thead>
<tbody>
<% collection.each do |contract| %>
<% content_tag_for(:tr, contract) do %>
<td><%= h contract.id %></td>
<td><%= h contract.name %></td>
<td><%= h contract.account_executive.name %></td>
<td><%= h format_date(contract.end_date) %></td>
<% end %>
<% end %>
</tbody>
</table>
<% end %>

View File

@@ -2,4 +2,8 @@ en:
field_end_date: End Date
field_executed: Executed
text_contracts: Contracts
field_id: ID
field_account_executive: Account Executive
field_account_executive_short: "Acct. Mgr."
field_end_date: "End Date"

View File

@@ -1,17 +1,32 @@
require 'test_helper'
class ContractsListTest < ActionController::IntegrationTest
include Redmine::I18n
def setup
@project = Project.generate!
@contract = Contract.generate!(:project => @project)
@contract2 = Contract.generate!(:project => @project)
end
should "allow any user to list the contracts on a project" do
visit_project(@project)
click_link "Contracts"
assert_response :success
assert_template 'contracts/index'
visit_contracts_for_project(@project)
end
should "list all contracts for the project" do
visit_contracts_for_project(@project)
assert_select "table#contracts" do
[@contract, @contract2].each do |contract|
assert_select "td", :text => /#{contract.id}/
assert_select "td", :text => /#{contract.name}/
assert_select "td", :text => /#{contract.account_executive.name}/
assert_select "td", :text => /#{format_date(contract.end_date)}/
end
end
end
should "not list contracts from other projects"
end

View File

@@ -31,6 +31,14 @@ module IntegrationTestHelper
assert_response :success
end
def visit_contracts_for_project(project)
visit_project(project)
click_link "Contracts"
assert_response :success
assert_template 'contracts/index'
end
def assert_forbidden
assert_response :forbidden
assert_template 'common/403'