[#4420] Add the options for Retainers to select which month to display. (UI only).
This commit is contained in:
@@ -85,4 +85,15 @@ module ContractsHelper
|
||||
def format_value_field_for_contracts(value)
|
||||
number_with_precision(value, :precision => Contract::ViewPrecision, :delimiter => ',')
|
||||
end
|
||||
|
||||
def retainer_period_options(deliverable)
|
||||
options = []
|
||||
options << content_tag(:option, l(:label_all).capitalize, :value => '')
|
||||
|
||||
deliverable.months.collect do |month|
|
||||
options << content_tag(:option, month.strftime("%B %Y"), :value => month.strftime("%Y-%m"))
|
||||
end
|
||||
|
||||
options
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,8 +122,8 @@
|
||||
<% if deliverable.retainer? %>
|
||||
<form action="">
|
||||
<fieldset>
|
||||
<select name="m">
|
||||
<option value="1">TODO: Release 2</option>
|
||||
<select name="retainer_period_change_<%= h(deliverable.id) %>" id="retainer_period_change_<%= h(deliverable.id) %>">
|
||||
<%= retainer_period_options(deliverable) %>
|
||||
</select>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -226,4 +226,23 @@ class ContractsShowTest < ActionController::IntegrationTest
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
should "show a selector for changing the currently shown Retainer's period" do
|
||||
@manager = User.generate!
|
||||
@retainer_deliverable = RetainerDeliverable.generate!(:contract => @contract, :manager => @manager, :title => "Retainer", :start_date => '2010-01-01', :end_date => '2010-03-31')
|
||||
|
||||
visit_contract_page(@contract)
|
||||
|
||||
assert_select "table#deliverables" do
|
||||
assert_select "#deliverable_details_#{@retainer_deliverable.id}" do
|
||||
assert_select "select#retainer_period_change_#{@retainer_deliverable.id}" do
|
||||
assert_select "option", /All/
|
||||
assert_select "option", /January 2010/
|
||||
assert_select "option", /February 2010/
|
||||
assert_select "option", /March 2010/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user