[accessibility] add hidden labels for input fields

pull/6827/head
Romano Licker 13 years ago
parent 119496c153
commit 41e4bf7232
  1. 3
      app/views/cost_objects/_labor_budget_item.rhtml
  2. 3
      app/views/cost_objects/_material_budget_item.rhtml

@ -15,12 +15,15 @@
<% fields_for prefix, labor_budget_item do |cost_form| %> <% fields_for prefix, labor_budget_item do |cost_form| %>
<tr class="cost_entry <%= classes %>" id="<%= id_prefix %>"> <tr class="cost_entry <%= classes %>" id="<%= id_prefix %>">
<td class="units"> <td class="units">
<label class="hidden-for-sighted" for="<%= id_prefix %>_units"><%= l(:field_hours) %></label>
<%= cost_form.text_field :hours, :index => id_or_index, :size => 3 %> <%= cost_form.text_field :hours, :index => id_or_index, :size => 3 %>
</td> </td>
<td class="user"> <td class="user">
<label class="hidden-for-sighted" for="<%= id_prefix %>_user_id"><%= l(:label_user) %></label>
<%= cost_form.select :user_id, @project.assignable_users.sort.collect{|u| [u.name, u.id]}, {:prompt => true}, {:index => id_or_index} %> <%= cost_form.select :user_id, @project.assignable_users.sort.collect{|u| [u.name, u.id]}, {:prompt => true}, {:index => id_or_index} %>
</td> </td>
<td class="comment"> <td class="comment">
<label class="hidden-for-sighted" for="<%= id_prefix %>_comments"><%= l(:field_comments) %></label>
<%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %> <%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %>
</td> </td>
<td class="currency"> <td class="currency">

@ -15,17 +15,20 @@
<% fields_for prefix, material_budget_item do |cost_form| %> <% fields_for prefix, material_budget_item do |cost_form| %>
<tr class="cost_entry <%= classes %>" id="<%= id_prefix %>"> <tr class="cost_entry <%= classes %>" id="<%= id_prefix %>">
<td class="units"> <td class="units">
<label class="hidden-for-sighted" for="<%= id_prefix %>_units"><%= l(:field_units) %></label>
<%= cost_form.text_field :units, :index => id_or_index, :size => 3 %> <%= cost_form.text_field :units, :index => id_or_index, :size => 3 %>
<span id="<%= "#{id_prefix}_unit_name" %>"> <span id="<%= "#{id_prefix}_unit_name" %>">
<%=h material_budget_item.cost_type.unit_plural if material_budget_item.cost_type %> <%=h material_budget_item.cost_type.unit_plural if material_budget_item.cost_type %>
</span> </span>
</td> </td>
<td class="cost_type"> <td class="cost_type">
<label class="hidden-for-sighted" for="<%= id_prefix %>_cost_type_id"><%= l(:field_cost_type) %></label>
<%= cost_form.select :cost_type_id, cost_types_collection_for_select_options(material_budget_item.cost_type), {}, {:index => id_or_index} %> <%= cost_form.select :cost_type_id, cost_types_collection_for_select_options(material_budget_item.cost_type), {}, {:index => id_or_index} %>
<%= observe_field( "#{id_prefix}_cost_type_id", :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('#{id_prefix}_units').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %> <%= observe_field( "#{id_prefix}_cost_type_id", :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('#{id_prefix}_units').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %>
<%= observe_field( "#{id_prefix}_units", :frequency => 1, :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %> <%= observe_field( "#{id_prefix}_units", :frequency => 1, :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %>
</td> </td>
<td class="comment"> <td class="comment">
<label class="hidden-for-sighted" for="<%= id_prefix %>_comments"><%= l(:field_comments) %></label>
<%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %> <%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %>
</td> </td>
<td class="currency"> <td class="currency">

Loading…
Cancel
Save