Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Refactor work package bulk edit label tags to use helper

Dombi Attilae3ffce110afa
diff --git a/app/views/work_packages/bulk/edit.html.erb b/app/views/work_packages/bulk/edit.html.erb
index e964d94a1fb..6c76e47cca9 100644
--- a/app/views/work_packages/bulk/edit.html.erb
+++ b/app/views/work_packages/bulk/edit.html.erb
@@ -51,34 +51,34 @@ See COPYRIGHT and LICENSE files for more details.
<div class="grid-block">
<div class="grid-content medium-6">
<div class="form--field">
- <label class="form--label" for="work_package_type_id"><%= WorkPackage.human_attribute_name(:type) %></label>
+ <%= styled_label_tag :work_package_type_id, WorkPackage.human_attribute_name(:type) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[type_id]', "<option value=\"\">#{t(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@types, :id, :name)) %>
</div>
</div>
<% if @available_statuses.any? %>
<div class="form--field">
- <label class="form--label" for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
+ <%= styled_label_tag :work_package_status_id, WorkPackage.human_attribute_name(:status) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[status_id]', "<option value=\"\">#{t(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(@available_statuses, :id, :name)) %>
</div>
</div>
<% else %>
<div class="form--field">
- <label class="form--label" for='status_id'><%= WorkPackage.human_attribute_name(:status) %></label>
+ <%= styled_label_tag :work_package_status_id, WorkPackage.human_attribute_name(:status) %>
<div class="form--field-container">
<%= t('work_packages.move.no_common_statuses_exists') %>
</div>
</div>
<% end %>
<div class="form--field">
- <label class="form--label" for='work_package_priority_id'><%= WorkPackage.human_attribute_name(:priority) %></label>
+ <%= styled_label_tag :work_package_priority_id, WorkPackage.human_attribute_name(:priority) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[priority_id]', "<option value=\"\">#{t(:label_no_change_option)}</option>".html_safe + options_from_collection_for_select(IssuePriority.active, :id, :name)) %>
</div>
</div>
<div class="form--field">
- <label class="form--label" for='work_package_assigned_to_id'><%= WorkPackage.human_attribute_name(:assigned_to) %></label>
+ <%= styled_label_tag :work_package_assigned_to_id, WorkPackage.human_attribute_name(:assigned_to) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[assigned_to_id]', content_tag('option', t(:label_no_change_option), value: '') +
content_tag('option', t(:label_nobody), value: 'none') +
@@ -86,7 +86,7 @@ See COPYRIGHT and LICENSE files for more details.
</div>
</div>
<div class="form--field">
- <label class="form--label" for='work_package_responsible_id'><%= WorkPackage.human_attribute_name(:responsible) %></label>
+ <%= styled_label_tag :work_package_responsible_id, WorkPackage.human_attribute_name(:responsible) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[responsible_id]', content_tag('option', t(:label_no_change_option), value: '') +
content_tag('option', t(:label_nobody), value: 'none') +
@@ -95,7 +95,7 @@ See COPYRIGHT and LICENSE files for more details.
</div>
<% if @project %>
<div class="form--field">
- <label class="form--label" for='category_id'><%= WorkPackage.human_attribute_name(:category) %></label>
+ <%= styled_label_tag :work_package_category_id, WorkPackage.human_attribute_name(:category) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[category_id]', content_tag('option', t(:label_no_change_option), value: '') +
content_tag('option', t(:label_none), value: 'none') +
@@ -106,7 +106,7 @@ See COPYRIGHT and LICENSE files for more details.
<% #TODO: allow editing versions when multiple projects %>
<% if @project %>
<div class="form--field">
- <label class="form--label" for='work_package_version_id'><%= WorkPackage.human_attribute_name(:version) %></label>
+ <%= styled_label_tag :work_package_version_id, WorkPackage.human_attribute_name(:version) %>
<div class="form--field-container">
<%= styled_select_tag('work_package[version_id]', content_tag('option', t(:label_no_change_option), value: '') +
content_tag('option', t(:label_none), value: 'none') +
@@ -116,7 +116,7 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<% if @project %>
<div class="form--field">
- <label class="form--label" for='work_package_budget_id'><%= Budget.model_name.human %></label>
+ <%= styled_label_tag :work_package_budget_id, Budget.model_name.human %>
<div class="form--field-container">
<%= styled_select_tag('work_package[budget_id]',
content_tag('option', t(:label_no_change_option), :value => '') +
@@ -139,7 +139,7 @@ See COPYRIGHT and LICENSE files for more details.
<div class="grid-content medium-6">
<% if @project && User.current.allowed_to?(:manage_subtasks, @project) %>
<div class="form--field">
- <label class="form--label" for='work_package_parent_id'><%= WorkPackage.human_attribute_name(:parent) %></label>
+ <%= styled_label_tag :work_package_parent_id, WorkPackage.human_attribute_name(:parent) %>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[parent_id]', '', size: 10 %>
</div>
@@ -147,20 +147,20 @@ See COPYRIGHT and LICENSE files for more details.
<div id="parent_work_package_candidates" class="autocomplete"></div>
<% end %>
<div class="form--field">
- <label class="form--label" for='work_package_start_date'><%= WorkPackage.human_attribute_name(:start_date) %></label>
+ <%= styled_label_tag :work_package_start_date, WorkPackage.human_attribute_name(:start_date) %>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[start_date]', '', size: 10, class: '-augmented-datepicker' %>
</div>
</div>
<div class="form--field">
- <label class="form--label" for='work_package_due_date'><%= WorkPackage.human_attribute_name(:due_date) %></label>
+ <%= styled_label_tag :work_package_due_date, WorkPackage.human_attribute_name(:due_date) %>
<div class="form--field-container">
<%= styled_text_field_tag 'work_package[due_date]', '', size: 10, class: '-augmented-datepicker' %>
</div>
</div>
<% if WorkPackage.use_field_for_done_ratio? %>
<div class="form--field">
- <label class="form--label" for='work_package_done_ratio'><%= WorkPackage.human_attribute_name(:done_ratio) %></label>
+ <%= styled_label_tag :work_package_done_ratio, WorkPackage.human_attribute_name(:done_ratio) %>
<div class="form--field-container">
<%= styled_select_tag 'work_package[done_ratio]', options_for_select([[t(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>
</div>