[#4420] Display per period Retainer values on the Contract details page.

This commit is contained in:
Eric Davis
2010-09-09 14:56:20 -07:00
parent 0a1bb9169d
commit 5ef7d0271d
8 changed files with 47 additions and 20 deletions
+10 -1
View File
@@ -28,7 +28,7 @@ class DeliverablesController < InheritedResources::Base
def show
if show_partial?
@period = params[:period]
@period = extract_period(params[:period])
render :partial => 'deliverables/details_row', :locals => {:contract => @contract, :deliverable => @contract.deliverables.find(params[:id]), :period => @period}
else
redirect_to contract_url(@project, @contract)
@@ -57,4 +57,13 @@ class DeliverablesController < InheritedResources::Base
@project = @contract.project
end
def extract_period(param)
period = nil
if param.present? && param.match(/\A\d{4}-\d{2}\z/) # "YYYY-MM"
year, month = param.split('-')
period = Date.new(year.to_i, month.to_i, 1)
end
period
end
end