renaming of partials (remainder of last commit)

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@52 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent d5483343ac
commit 575d1705cf
  1. 36
      app/views/deliverables/_deliverable_cost.rhtml
  2. 34
      app/views/deliverables/_deliverable_costs_row.rhtml
  3. 33
      app/views/deliverables/_deliverable_hour.rhtml
  4. 29
      app/views/deliverables/_deliverable_hours_row.rhtml
  5. 0
      app/views/deliverables/_forrm_costs.rhtml

@ -0,0 +1,36 @@
<%-
index ||= "INDEX"
new_or_existing = deliverable_cost.new_record? ? 'new' : 'existing'
id_or_index = deliverable_cost.new_record? ? index : deliverable_cost.id
prefix = "deliverable[#{new_or_existing}_deliverable_cost_attributes][]"
id_prefix = "deliverable_#{new_or_existing}_deliverable_cost_attributes_#{id_or_index}"
@deliverable_cost = deliverable_cost
error_messages = error_messages_for 'deliverable_cost'
-%>
<%if error_messages %><tr><td colspan="4"><%= error_messages %></td></tr><% end %>
<tr class="cost-entry" id="<%= id_prefix %>">
<% fields_for prefix, deliverable_cost do |cost_form| %>
<td class="cost_units">
<%= cost_form.text_field :units, :index => id_or_index, :size => 3 %>
<span id="<%= "#{id_prefix}_unit_name" %>">
<%= h deliverable_cost.cost_type.unit_plural %>
</span>
</td>
<td>
<%= cost_form.select :cost_type_id, cost_types_collection_for_select_options, {}, {:index => id_or_index} %>
<%= cost_form.hidden_field :rate_id, :index => id_or_index %>
<%= observe_field( "#{id_prefix}_cost_type_id", :url => {:action => :update_deliverable_cost}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('#{id_prefix}_units').value) + '&element_id=#{id_prefix}'") %>
<%= observe_field( "#{id_prefix}_units", :frequency => 1, :url => {:action => :update_deliverable_cost}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&element_id=#{id_prefix}'") %>
</td>
<% if User.current.allowed_to?(:view_unit_price, @project)%>
<td class="currency">
<span id="<%= "#{id_prefix}_costs" %>"><%= number_to_currency(deliverable_cost.costs) %></span>
</td>
<% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableCost('#{id_prefix}')" %>
</td>
<% end %>
</tr>

@ -1,34 +0,0 @@
<%
suffix = suffix ? "_#{suffix}" : ""
deliverable_cost = nil unless defined?(deliverable_cost)
row_id = deliverable_cost.id unless row_id || !deliverable_cost
%>
<tr class="cost-entry" id="<%= "deliverable_costs#{suffix}_#{row_id}" %>">
<td class="cost_units">
<% if deliverable_cost %>
<%= text_field deliverable_cost, :units, :value => deliverable_cost.units, :size => 3, :id => "deliverable_costs#{suffix}_#{row_id}_units", :name => "deliverable_costs#{suffix}[#{row_id}][units]" %>
<% else %>
<%= text_field_tag "deliverable_costs#{suffix}[#{row_id}][units]", nil, :size => 3, :id => "deliverable_costs#{suffix}_#{row_id}_units" %>
<% end %>
<span id="<%= "deliverable_costs#{suffix}_#{row_id}_unit_name" %>"><% if deliverable_cost -%>
<%=h deliverable_cost.units.to_s == '1.0' ? deliverable_cost.rate.cost_type.unit : deliverable_cost.rate.cost_type.unit_plural %>
<%- else -%>
<%=h CostType.default.unit_plural %>
<%- end -%></span>
</td>
<td>
<% if deliverable_cost -%>
<%= select "deliverable_costs#{suffix}[#{row_id}]", :cost_type_id, cost_types_collection_for_select_options, {:object => deliverable_cost.rate} %>
<%- else -%>
<%= select "deliverable_costs#{suffix}[#{row_id}]", :cost_type_id, cost_types_collection_for_select_options, {:selected => CostType.default.id} %>
<%- end %>
<%= observe_field( "deliverable_costs#{suffix}_#{row_id}_cost_type_id", :url => {:action => :update_deliverable_costs_row}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('deliverable_costs#{suffix}_#{row_id}_units').value) + '&element_id=deliverable_costs#{suffix}_#{row_id}'") %>
</td>
<% if User.current.allowed_to?(:view_unit_price, @project)%><td class="currency">
<span id="<%= "deliverable_costs#{suffix}_#{row_id}_costs" %>"><%= number_to_currency(deliverable_cost.costs) if deliverable_cost && deliverable_cost.costs > 0 %></span>
<%= observe_field( "deliverable_costs#{suffix}_#{row_id}_units", :frequency => 1, :url => {:action => :update_deliverable_costs_row}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('deliverable_costs#{suffix}_#{row_id}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&element_id=deliverable_costs#{suffix}_#{row_id}'") %>
</td><% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableCostsEntry('deliverable_costs#{suffix}_#{row_id}')" %>
</td>
</tr>

@ -0,0 +1,33 @@
<%-
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}"
@deliverable_hour = deliverable_hour
error_messages = error_messages_for 'deliverable_hour'
-%>
<%if error_messages %><tr><td colspan="4"><%= error_messages %></td></tr><% end %>
<tr class="cost-entry" id="<%= id_prefix %>">
<% fields_for prefix, deliverable_hour do |cost_form| %>
<td class="cost_units">
<%= cost_form.text_field :hours, :index => id_or_index, :size => 3 %>
</td>
<td>
<%= cost_form.select :user_id, user_collection_for_select_options(:generic_user => true), {}, {:index => id_or_index} %>
<%= cost_form.hidden_field :rate_id, :index => id_or_index %>
</td>
<% if User.current.allowed_to?(:view_all_rates, @project) || User.current.allowed_to?(:view_own_rate, @project) %>
<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) + '&units=' + encodeURIComponent(document.getElementById('#{id_prefix}_hours').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) + '&element_id=#{id_prefix}'") %>
</td>
<% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableHour('#{id_prefix}')" %>
</td>
<% end %>
</tr>

@ -1,29 +0,0 @@
<%
suffix = suffix ? "_#{suffix}" : ""
deliverable_hour = nil unless defined?(deliverable_hour)
row_id = deliverable_hour.id unless row_id || !defined?(deliverable_hour)
%>
<tr class="cost-entry" id="<%= "deliverable_hours#{suffix}_#{row_id}" %>">
<td class="cost_units">
<% if deliverable_hour %>
<%= text_field deliverable_hour, :hours, :value => deliverable_hour.hours, :size => 3, :id => "deliverable_hours#{suffix}_#{row_id}_hours", :name => "deliverable_hours#{suffix}[#{row_id}][hours]" %>
<% else %>
<%= text_field_tag "deliverable_hours#{suffix}[#{row_id}][hours]", nil, :size => 3, :id => "deliverable_hours#{suffix}_#{row_id}_hours" %>
<% end %>
</td>
<td>
<% if deliverable_hour %>
<%= select "deliverable_hours#{suffix}[#{row_id}]", :user_id, user_collection_for_select_options(:generic_user => true), {:object => deliverable_hour.rate} %>
<%- else -%>
<%= select "deliverable_hours#{suffix}[#{row_id}]", :user_id, user_collection_for_select_options(:generic_user => true) %>
<%- end %>
<%= observe_field( "deliverable_hours#{suffix}_#{row_id}_user_id", :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(value) + '&hours=' + encodeURIComponent(document.getElementById('deliverable_hours#{suffix}_#{row_id}_hours').value) + '&element_id=deliverable_hours#{suffix}_#{row_id}'") %>
</td>
<% if User.current.allowed_to?(:view_all_rates, @project) || User.current.allowed_to?(:view_own_rate, @project) %><td class="currency">
<span id="<%= "deliverable_hours#{suffix}_#{row_id}_costs" %>"><%= number_to_currency(deliverable_hour.costs) if deliverable_hour && deliverable_hour.can_view_costs?(User.current, @project) %></span>
<%= observe_field( "deliverable_hours#{suffix}_#{row_id}_hours", :frequency => 1, :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(document.getElementById('deliverable_hours#{suffix}_#{row_id}_user_id').value) + '&hours=' + encodeURIComponent(value) + '&element_id=deliverable_hours#{suffix}_#{row_id}'") %>
</td><% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableHoursEntry('deliverable_hours#{suffix}_#{row_id}')" %>
</td>
</tr>
Loading…
Cancel
Save