OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/deliverables/_deliverable_hour.rhtml

35 lines
2.1 KiB

<%-
index ||= "INDEX"
new_or_existing = deliverable_hour.new_record? ? 'new' : 'existing'
id_or_index = deliverable_hour.new_record? ? index : deliverable_hour.id
prefix = "deliverable[#{new_or_existing}_deliverable_hour_attributes][]"
id_prefix = "deliverable_#{new_or_existing}_deliverable_hour_attributes_#{id_or_index}"
classes ||= ""
@deliverable_hour = deliverable_hour
error_messages = error_messages_for 'deliverable_hour'
-%>
<%if error_messages %><tr><td colspan="4"><%= error_messages %></td></tr><% end %>
<% fields_for prefix, deliverable_hour do |cost_form| %>
<tr class="cost_entry <%= classes %>" id="<%= id_prefix %>">
<td class="units">
<%= cost_form.text_field :hours, :index => id_or_index, :size => 3 %>
</td>
<td class="user">
<%= cost_form.select :user_id, @project.assignable_users.sort.select{|u| u.rate_at(@deliverable.fixed_date, @project)}.collect{|u| [u.name, u.id]}, {:prompt => true}, {:index => id_or_index} %>
</td>
<td class="comment">
<%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %>
</td>
<td class="currency">
<span id="<%= "#{id_prefix}_costs" %>"><%= number_to_currency(deliverable_hour.costs) if deliverable_hour.can_view_costs?(User.current, @project) %></span>
<%= observe_field( "#{id_prefix}_user_id", :url => {:action => :update_deliverable_hour}, :with => "'user_id=' + encodeURIComponent(value) + '&hours=' + encodeURIComponent(document.getElementById('#{id_prefix}_hours').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('deliverable_fixed_date').value) + '&element_id=#{id_prefix}'") %>
<%= observe_field( "#{id_prefix}_hours", :frequency => 1, :url => {:action => :update_deliverable_hour}, :with => "'user_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_user_id').value) + '&hours=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('deliverable_fixed_date').value) + '&element_id=#{id_prefix}'") %>
</td>
<td class="delete" rowspan="2">
<%= image_to_function 'delete.png', "deleteDeliverableHour('#{id_prefix}')" %>
</td>
</tr>
<% end %>