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

10.6 KB
Raw Blame
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.

OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

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.

See COPYRIGHT and LICENSE files for more details.

++#%>

<% html_title t(:label_bulk_edit_selected_work_packages) %>

<%=
  render Primer::OpenProject::PageHeader.new do |header|
    header.with_title { t(:label_bulk_edit_selected_work_packages) }
    header.with_breadcrumbs(
      [*([href: project_overview_path(@project.id), text: @project.name] if @project),
       { href: (@project ? project_work_packages_path(@project) : work_packages_path), text: t(:label_work_package_plural) },
       t(:label_bulk_edit_selected_work_packages)]
    )
  end
%>
<ul>
  <% @work_packages.each do |wp| %>
    <li>
      <%= link_to(h("#{wp.type} ##{wp.id}"), work_package_path(wp)) %>:
      <%= wp.subject %>
    </li>
  <% end %>
</ul>

<%= styled_form_tag(
      url_for(controller: "/work_packages/bulk", action: :update),
      method: :put, class: "-wide-labels"
    ) do %>
  <% @work_packages.each do |wp| %>
    <%= hidden_field_tag "ids[]", wp.id %>
  <% end %>
  <%= back_url_hidden_field_tag %>
  <section class="form--section">
    <fieldset class="form--fieldset">
      <legend class="form--fieldset-legend"><%= t(:label_change_properties) %></legend>
      <div class="grid-block grid-block_visible-overflow">
        <div class="grid-content medium-6">
          <div class="form--field">
            <%= styled_label_tag :work_package_type_id, WorkPackage.human_attribute_name(:type) %>
            <div class="form--field-container">
              <%= styled_select_tag(
                    "work_package[type_id]",
                    options_from_collection_for_select(@types, :id, :name),
                    include_blank: t(:label_no_change_option)
                  ) %>
            </div>
          </div>
          <% if @available_statuses.any? %>
            <div class="form--field">
              <%= styled_label_tag :work_package_status_id, WorkPackage.human_attribute_name(:status) %>
              <div class="form--field-container">
                <%= styled_select_tag(
                      "work_package[status_id]",
                      options_from_collection_for_select(@available_statuses, :id, :name),
                      include_blank: t(:label_no_change_option)
                    ) %>
              </div>
            </div>
          <% else %>
            <div class="form--field">
              <%= 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">
            <%= styled_label_tag :work_package_priority_id, WorkPackage.human_attribute_name(:priority) %>
            <div class="form--field-container">
              <%= styled_select_tag(
                    "work_package[priority_id]",
                    options_from_collection_for_select(IssuePriority.active, :id, :name),
                    include_blank: t(:label_no_change_option)
                  ) %>
            </div>
          </div>
          <div class="form--field">
            <%= 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_nobody), value: "none") +
                    options_from_collection_for_select(@assignables, :id, :name),
                    include_blank: t(:label_no_change_option)
                  ) %>
            </div>
          </div>
          <div class="form--field">
            <%= 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_nobody), value: "none") +
                    options_from_collection_for_select(@responsibles, :id, :name),
                    include_blank: t(:label_no_change_option)
                  ) %>
            </div>
          </div>
          <% if @project %>
            <div class="form--field">
              <%= 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_none), value: "none") +
                      options_from_collection_for_select(@project.categories, :id, :name),
                      include_blank: t(:label_no_change_option)
                    ) %>
              </div>
            </div>
            <%# TODO: allow editing versions when multiple projects %>
            <div class="form--field">
              <%= 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_none), value: "none") +
                      version_options_for_select(@project.shared_versions.with_status_open.order(:name)),
                      include_blank: t(:label_no_change_option)
                    ) %>
              </div>
            </div>
            <div class="form--field">
              <%= 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: "") +
                        content_tag("option", t(:label_none), value: "none") +
                        options_from_collection_for_select(@project.budgets.order(Arel.sql("subject ASC")), :id, :subject)
                    ) %>
              </div>
            </div>
          <% end %>
          <% @custom_fields.each do |custom_field| %>
            <div class="form--field">
              <%= blank_custom_field_label_tag("work_package", custom_field) %>
              <div class="form--field-container">
                <%= custom_field_tag_for_bulk_edit("work_package", custom_field, @project) %>
              </div>
            </div>
          <% end %>
          <%= call_hook(:view_work_packages_bulk_edit_details_bottom, { work_packages: @work_packages }) %>
        </div>
        <div class="grid-content medium-6">
          <div class="form--field">
            <%= styled_label_tag :work_package_subject, WorkPackage.human_attribute_name(:subject) %>
            <div class="form--field-container">
              <%= styled_text_field_tag "work_package[subject]", "", size: 10 %>
            </div>
          </div>
          <% if @project && User.current.allowed_in_project?(:manage_subtasks, @project) %>
            <div class="form--field">
              <%= 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>
            </div>
            <div id="parent_work_package_candidates" class="autocomplete"></div>
          <% end %>
          <div class="form--field">
            <%= styled_label_tag :work_package_start_date, WorkPackage.human_attribute_name(:start_date) %>
            <div class="form--field-container -visible-overflow">
              <%= angular_component_tag "opce-basic-single-date-picker",
                                        class: "form--text-field-container",
                                        inputs: {
                                          id: "work_package_start_date",
                                          name: "work_package[start_date]"
                                        } %>
            </div>
          </div>
          <div class="form--field">
            <%= styled_label_tag :work_package_due_date, WorkPackage.human_attribute_name(:due_date) %>
            <div class="form--field-container -visible-overflow">
              <%= angular_component_tag "opce-basic-single-date-picker",
                                        class: "form--text-field-container",
                                        inputs: {
                                          id: "work_package_due_date",
                                          name: "work_package[due_date]"
                                        } %>
            </div>
          </div>
          <% if WorkPackage.work_based_mode? %>
            <div class="form--field">
              <%= styled_label_tag :work_package_done_ratio, WorkPackage.human_attribute_name(:done_ratio) %>
              <div class="form--field-container">
                <%= styled_text_field_tag "work_package[done_ratio]", "", type: :number, size: 10 %>
              </div>
            </div>
          <% end %>
        </div>
      </div>
    </fieldset>
    <fieldset class="form--fieldset">
      <legend class="form--fieldset-legend"><%= Journal.human_attribute_name(:notes) %></legend>
      <%= label_tag "work_package_journal_notes", Journal.human_attribute_name(:notes), class: "sr-only" %>
      <%= styled_text_area_tag "work_package[journal_notes]", @notes, class: "wiki-edit", with_text_formatting: true %>
      <p><%= send_notification_option %></p>
    </fieldset>
  </section>
  <p><%= styled_button_tag t(:button_submit), class: "-primary -with-icon icon-checkmark" %></p>
<% end %>