%#-- copyright
OpenProject Costs Plugin
Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++#%>
<%-
index ||= "INDEX"
new_or_existing = material_budget_item.new_record? ? 'new' : 'existing'
id_or_index = material_budget_item.new_record? ? index : material_budget_item.id
prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][]"
id_prefix = "cost_object_#{new_or_existing}_material_budget_item_attributes_#{id_or_index}"
name_prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][#{id_or_index}]"
classes ||= ""
@material_budget_item = material_budget_item
error_messages = error_messages_for 'material_budget_item'
-%>
<% unless error_messages.blank? %>
<%= error_messages %>
<% end %>
<%= fields_for prefix, material_budget_item do |cost_form| %>