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

Interact with progress fields via a modal

Aaron Contreras19d05a57b2d5
diff --git a/app/components/_index.sass b/app/components/_index.sass
index 28d1d6ec9cb..1b6e2778c9b 100644
--- a/app/components/_index.sass
+++ b/app/components/_index.sass
@@ -1,5 +1,6 @@
@import "work_packages/share/modal_body_component"
@import "work_packages/share/invite_user_form_component"
+@import "work_packages/progress/progress_modal"
@import "open_project/common/attribute_component"
@import "filters_component"
@import "projects/settings/project_custom_field_sections/index_component"
diff --git a/app/components/work_packages/progress/modal_body_component.html.erb b/app/components/work_packages/progress/modal_body_component.html.erb
new file mode 100644
index 00000000000..161facb1ec4
--- /dev/null
+++ b/app/components/work_packages/progress/modal_body_component.html.erb
@@ -0,0 +1,26 @@
+<%= turbo_frame_tag "work_package_progress_modal" do %>
+ <%= primer_form_with(
+ model: work_package,
+ url: work_package_progress_path(work_package),
+ id: 'blah') do |f| %>
+ <%= flex_layout do |modal_body| %>
+ <% modal_body.with_row do |_fields| %>
+ <%= render(WorkPackages::ProgressForm.new(f)) %>
+ <% end %>
+
+ <% modal_body.with_row(mt: 3) do |_tooltip| %>
+ <%= render(Primer::Beta::Text.new(font_weight: :semibold)) { "Note:" } %>
+ <%= render(Primer::Beta::Text.new) { "% Complete is automatically derived from Work and Remaining work." } %>
+ <%= render(Primer::Beta::Link.new(href: "#")) { "Learn more" } %>
+ <% end %>
+
+ <% modal_body.with_row(mt: 3) do |_actions_row| %>
+ <%= flex_layout(mt: 3, justify_content: :flex_end) do |action_buttons| %>
+ <%= action_buttons.with_column do %>
+ <%= f.submit "Save", class: "btn btn-primary" %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% end %>
+<% end %>
diff --git a/app/components/work_packages/progress/modal_body_component.rb b/app/components/work_packages/progress/modal_body_component.rb
new file mode 100644
index 00000000000..fc0cb4480e1
--- /dev/null
+++ b/app/components/work_packages/progress/modal_body_component.rb
@@ -0,0 +1,45 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2024 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.
+# ++
+
+module WorkPackages
+ module Progress
+ class ModalBodyComponent < ApplicationComponent
+ include ApplicationHelper
+ include Turbo::FramesHelper
+ include OpPrimer::ComponentHelpers
+
+ attr_reader :work_package
+
+ def initialize(work_package)
+ super()
+
+ @work_package = work_package
+ end
+ end
+ end
+end
diff --git a/app/components/work_packages/progress/progress_modal.sass b/app/components/work_packages/progress/progress_modal.sass
new file mode 100644
index 00000000000..70a30af4ef6
--- /dev/null
+++ b/app/components/work_packages/progress/progress_modal.sass
@@ -0,0 +1,4 @@
+.boob
+ background-color: unset !important
+ border: none !important
+ box-shadow: none !important
diff --git a/app/controllers/work_packages/progress_controller.rb b/app/controllers/work_packages/progress_controller.rb
new file mode 100644
index 00000000000..0dbce26ee69
--- /dev/null
+++ b/app/controllers/work_packages/progress_controller.rb
@@ -0,0 +1,72 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2024 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.
+# ++
+
+class WorkPackages::ProgressController < ApplicationController
+ layout false
+ before_action :set_work_package
+
+ def edit
+ render WorkPackages::Progress::ModalBodyComponent.new(@work_package)
+ end
+
+ def update
+ service_call = WorkPackages::UpdateService
+ .new(user: current_user,
+ model: @work_package)
+ .call(work_package_params)
+
+ if service_call.success?
+ respond_to do |format|
+ format.turbo_stream
+ end
+ else
+ respond_to do |format|
+ format.turbo_stream do
+ # Bundle 422 status code into stream response so
+ # Angular has context as to the success or failure of
+ # the request in order to fetch the new set of Work Package
+ # attributes in the ancestry solely on success.
+ render :update, status: :unprocessable_entity
+ end
+ end
+ end
+ end
+
+ private
+
+ def set_work_package
+ @work_package = WorkPackage.find(params[:work_package_id])
+ end
+
+ def work_package_params
+ params.require(:work_package)
+ .permit(%i[estimated_hours remaining_hours done_ratio])
+ end
+end
diff --git a/app/forms/work_packages/progress_form.rb b/app/forms/work_packages/progress_form.rb
new file mode 100644
index 00000000000..dacb5e58ffc
--- /dev/null
+++ b/app/forms/work_packages/progress_form.rb
@@ -0,0 +1,52 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2024 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.
+# ++
+
+class WorkPackages::ProgressForm < ApplicationForm
+ include OpenProject::StaticRouting::UrlHelpers
+
+ form do |query_form|
+ query_form.group(layout: :horizontal) do |group|
+ group.text_field(
+ name: :estimated_hours,
+ label: "Work"
+ )
+
+ group.text_field(
+ name: :remaining_hours,
+ label: "Remaining work"
+ )
+
+ group.text_field(
+ name: :done_ratio,
+ label: "% Complete",
+ readonly: true,
+ classes: "boob"
+ )
+ end
+ end
+end
diff --git a/app/views/work_packages/progress/edit.html.erb b/app/views/work_packages/progress/edit.html.erb
new file mode 100644
index 00000000000..7d3a939cd84
--- /dev/null
+++ b/app/views/work_packages/progress/edit.html.erb
@@ -0,0 +1,7 @@
+<%= turbo_frame_tag "work_package_progress_modal" do %>
+ <%= flex_layout do |modal_body| %>
+ <%= modal_body.with_row do %>
+ <%= render Primer::Beta::Text.new { 'hello' } %>
+ <% end %>
+ <% end %>
+<% end %>
diff --git a/app/views/work_packages/progress/update.turbo_stream.erb b/app/views/work_packages/progress/update.turbo_stream.erb
new file mode 100644
index 00000000000..8ff0932f7dd
--- /dev/null
+++ b/app/views/work_packages/progress/update.turbo_stream.erb
@@ -0,0 +1,3 @@
+<%= turbo_stream.update "work_package_progress_modal" do %>
+ <%= render WorkPackages::Progress::ModalBodyComponent.new(@work_package) %>
+<% end %>
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 18683672b21..d11253fa4f0 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -1002,6 +1002,8 @@ en:
message_work_package_read_only: "Work package is locked in this status. No attribute other than status can be altered."
message_work_package_status_blocked: "Work package status is not writable due to closed status and closed version being assigned."
placeholder_filter_by_text: "Subject, description, comments, ..."
+ progress:
+ title: "Progress"
baseline:
addition_label: "Added to view within the comparison time period"
removal_label: "Removed from view within the comparison time period"
diff --git a/config/routes.rb b/config/routes.rb
index d8708bef06b..acb00ed6b3e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -524,6 +524,8 @@ Rails.application.routes.draw do
end
end
+ resource :progress, only: %i[edit update], controller: 'work_packages/progress'
+
# states managed by client-side (angular) routing on work_package#show
get "/" => "work_packages#index", on: :collection, as: "index"
get "/create_new" => "work_packages#index", on: :collection, as: "new_split"
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index e330626b81d..74f7cab322f 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -264,6 +264,10 @@ export class PathHelperService {
return `${this.workPackagePath(workPackageId)}/shares`;
}
+ public workPackageProgressModalPath(workPackageId:string|number) {
+ return `${this.workPackagePath(workPackageId)}/progress/edit`;
+ }
+
// Work Package Bulk paths
public workPackagesBulkEditPath() {
diff --git a/frontend/src/app/shared/components/fields/edit/edit-field.initializer.ts b/frontend/src/app/shared/components/fields/edit/edit-field.initializer.ts
index a51873f3626..bae07d2a729 100644
--- a/frontend/src/app/shared/components/fields/edit/edit-field.initializer.ts
+++ b/frontend/src/app/shared/components/fields/edit/edit-field.initializer.ts
@@ -27,27 +27,66 @@
//++
import { EditFieldService } from 'core-app/shared/components/fields/edit/edit-field.service';
-import { TextEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/text-edit-field/text-edit-field.component';
-import { IntegerEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/integer-edit-field/integer-edit-field.component';
-import { SelectEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component';
-import { MultiSelectEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/multi-select-edit-field.component';
+import {
+ TextEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/text-edit-field/text-edit-field.component';
+import {
+ IntegerEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/integer-edit-field/integer-edit-field.component';
+import {
+ SelectEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component';
+import {
+ MultiSelectEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/multi-select-edit-field.component';
import { FloatEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/float-edit-field.component';
-import { BooleanEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/boolean-edit-field/boolean-edit-field.component';
-import { WorkPackageEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/work-package-edit-field.component';
-import { DateEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component';
-import { FormattableEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component';
-import { SelectAutocompleterRegisterService } from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-autocompleter-register.service';
-import { ProjectStatusEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/project-status-edit-field.component';
-import { PlainFormattableEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/plain-formattable-edit-field.component';
-import { TimeEntryWorkPackageEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/te-work-package-edit-field.component';
-import { CombinedDateEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/combined-date-edit-field.component';
-import { VersionAutocompleterComponent } from 'core-app/shared/components/autocompleter/version-autocompleter/version-autocompleter.component';
-import { WorkPackageAutocompleterComponent } from 'core-app/shared/components/autocompleter/work-package-autocompleter/wp-autocompleter.component';
-import { WorkPackageCommentFieldComponent } from 'core-app/features/work-packages/components/work-package-comment/wp-comment-field.component';
+import {
+ BooleanEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/boolean-edit-field/boolean-edit-field.component';
+import {
+ WorkPackageEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/work-package-edit-field.component';
+import {
+ DateEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/date-edit-field/date-edit-field.component';
+import {
+ FormattableEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/formattable-edit-field/formattable-edit-field.component';
+import {
+ SelectAutocompleterRegisterService,
+} from 'core-app/shared/components/fields/edit/field-types/select-edit-field/select-autocompleter-register.service';
+import {
+ ProjectStatusEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/project-status-edit-field.component';
+import {
+ PlainFormattableEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/plain-formattable-edit-field.component';
+import {
+ TimeEntryWorkPackageEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/te-work-package-edit-field.component';
+import {
+ CombinedDateEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/combined-date-edit-field.component';
+import {
+ VersionAutocompleterComponent,
+} from 'core-app/shared/components/autocompleter/version-autocompleter/version-autocompleter.component';
+import {
+ WorkPackageAutocompleterComponent,
+} from 'core-app/shared/components/autocompleter/work-package-autocompleter/wp-autocompleter.component';
+import {
+ WorkPackageCommentFieldComponent,
+} from 'core-app/features/work-packages/components/work-package-comment/wp-comment-field.component';
import { ProjectEditFieldComponent } from './field-types/project-edit-field.component';
-import { HoursDurationEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/hours-duration-edit-field.component';
+import {
+ HoursDurationEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/hours-duration-edit-field.component';
import { UserEditFieldComponent } from './field-types/user-edit-field.component';
-import { DaysDurationEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/days-duration-edit-field.component';
+import {
+ DaysDurationEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/days-duration-edit-field.component';
+import {
+ ProgressPopoverEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/progress-popover-edit-field.component';
export function initializeCoreEditFields(editFieldService:EditFieldService, selectAutocompleterRegisterService:SelectAutocompleterRegisterService) {
return ():void => {
@@ -55,7 +94,7 @@ export function initializeCoreEditFields(editFieldService:EditFieldService, sele
editFieldService
.addFieldType(TextEditFieldComponent, 'text', ['String'])
.addFieldType(IntegerEditFieldComponent, 'integer', ['Integer'])
- .addFieldType(HoursDurationEditFieldComponent, 'estimatedTime', ['estimatedTime'])
+ .addFieldType(ProgressPopoverEditFieldComponent, 'remainingTime', ['estimatedTime'])
.addFieldType(ProjectEditFieldComponent, 'project', ['Project'])
.addFieldType(UserEditFieldComponent, 'user', ['User'])
.addFieldType(SelectEditFieldComponent, 'select', [
@@ -80,17 +119,23 @@ export function initializeCoreEditFields(editFieldService:EditFieldService, sele
.addFieldType(WorkPackageCommentFieldComponent, '_comment', ['comment']);
editFieldService
- .addSpecificFieldType('WorkPackage', CombinedDateEditFieldComponent,
+ .addSpecificFieldType(
+ 'WorkPackage',
+ CombinedDateEditFieldComponent,
'date',
- ['combinedDate', 'startDate', 'dueDate', 'date'])
- .addSpecificFieldType('WorkPackage', DaysDurationEditFieldComponent,
+ ['combinedDate', 'startDate', 'dueDate', 'date'],
+ )
+ .addSpecificFieldType(
+ 'WorkPackage',
+ DaysDurationEditFieldComponent,
'duration',
- ['duration'])
+ ['duration'],
+ )
.addSpecificFieldType('Project', ProjectStatusEditFieldComponent, 'status', ['status'])
.addSpecificFieldType('TimeEntry', PlainFormattableEditFieldComponent, 'comment', ['comment'])
.addSpecificFieldType('TimeEntry', TimeEntryWorkPackageEditFieldComponent, 'workPackage', ['WorkPackage'])
.addSpecificFieldType('TimeEntry', HoursDurationEditFieldComponent, 'hours', ['hours'])
- .addSpecificFieldType('WorkPackage', HoursDurationEditFieldComponent, 'remainingTime', ['remainingTime']);
+ .addSpecificFieldType('WorkPackage', ProgressPopoverEditFieldComponent, 'remainingTime', ['remainingTime']);
selectAutocompleterRegisterService.register(VersionAutocompleterComponent, 'Version');
selectAutocompleterRegisterService.register(WorkPackageAutocompleterComponent, 'WorkPackage');
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/progress-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/progress-edit-field.component.ts
new file mode 100644
index 00000000000..3edf25cdc20
--- /dev/null
+++ b/frontend/src/app/shared/components/fields/edit/field-types/progress-edit-field.component.ts
@@ -0,0 +1,62 @@
+/*
+ * OpenProject is an open source project management software.
+ * Copyright (C) 2010-2022 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.
+ */
+
+import { Directive, Injector, OnDestroy, OnInit } from '@angular/core';
+import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
+import { TimezoneService } from 'core-app/core/datetime/timezone.service';
+import { EditFieldComponent } from 'core-app/shared/components/fields/edit/edit-field.component';
+import { DeviceService } from 'core-app/core/browser/device.service';
+
+@Directive()
+export abstract class ProgressEditFieldComponent extends EditFieldComponent implements OnInit, OnDestroy {
+ @InjectField() readonly timezoneService:TimezoneService;
+
+ @InjectField() deviceService:DeviceService;
+
+ @InjectField() injector:Injector;
+
+ ngOnInit():void {
+ super.ngOnInit();
+
+ this.handler
+ .$onUserActivate
+ .pipe(
+ this.untilDestroyed(),
+ )
+ .subscribe(() => {
+ this.showProgressModal();
+ });
+ }
+
+ ngOnDestroy():void {
+ super.ngOnDestroy();
+ }
+
+ public showProgressModal():void {
+ }
+}
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.html b/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.html
new file mode 100644
index 00000000000..46aaf3cc353
--- /dev/null
+++ b/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.html
@@ -0,0 +1,93 @@
+<spot-drop-modal
+ [opened]="opened"
+ (closed)="onModalClosed()"
+ alignment="bottom-center"
+>
+ <input
+ slot="trigger"
+ type="text"
+ class="spot-input"
+ (click)="onInputClick($event)"
+ (focus)="showProgressModal()"
+ />
+
+ <ng-container slot="body">
+ <div
+ class="spot-modal--header"
+ >
+ <div
+ id="spotModalTitle"
+ class="spot-modal--header-title"
+ [textContent]="this.text.title">
+ </div>
+
+ <button
+ class="button button_no-margin -transparent spot-modal--header-close-button"
+ [attr.aria-label]="text.button_close"
+ (click)="closeMe()"
+ data-test-selector="op-share-wp-modal--close-icon"
+ >
+ <svg x-icon size="small" class="spot-modal--header-close-button-icon"></svg>
+ </button>
+ </div>
+
+ <div class="spot-modal--body spot-container">
+ <turbo-frame
+ #frameElement
+ id="work_package_progress_modal"
+ src="{{this.frameSrc}}">
+ <op-content-loader
+ viewBox="0 0 180 80"
+ >
+ <svg:rect height="10" rx="2" ry="2" width="110" x="0" y="0"/>
+ <svg:rect height="10" rx="2" ry="2" width="25" x="120" y="0"/>
+ <svg:rect height="10" rx="2" ry="2" width="25" x="155" y="0"/>
+ <svg:rect height="25%" rx="2" ry="2" width="180" x="0" y="16"/>
+ </op-content-loader>
+ </turbo-frame>
+ </div>
+ </ng-container>
+</spot-drop-modal>
+
+<!-- Other modal-->
+<!--<div-->
+<!-- class="spot-modal spot-modal_wide op-share-wp-modal"-->
+<!--&gt;-->
+<!-- <div-->
+<!-- class="spot-modal&#45;&#45;header"-->
+<!-- >-->
+<!-- <div-->
+<!-- id="spotModalTitle"-->
+<!-- class="spot-modal&#45;&#45;header-title"-->
+<!-- [textContent]="this.text.title">-->
+<!-- </div>-->
+<!-- <button-->
+<!-- class="button button_no-margin -transparent spot-modal&#45;&#45;header-close-button"-->
+<!-- [attr.aria-label]="text.button_close"-->
+<!-- (click)="closeMe($event)"-->
+<!-- data-test-selector="op-share-wp-modal&#45;&#45;close-icon"-->
+<!-- >-->
+<!-- <svg-->
+<!-- x-icon-->
+<!-- size="small"-->
+<!-- class="spot-modal&#45;&#45;header-close-button-icon"-->
+<!-- ></svg>-->
+<!-- </button>-->
+<!-- </div>-->
+
+<!-- <div class="spot-modal&#45;&#45;body spot-container">-->
+<!-- <turbo-frame-->
+<!-- #frameElement-->
+<!-- id="work_package_progress_modal"-->
+<!-- src="{{this.frameSrc}}">-->
+<!-- <op-content-loader-->
+<!-- viewBox="0 0 180 80"-->
+<!-- >-->
+<!-- <svg:rect height="10" rx="2" ry="2" width="110" x="0" y="0"/>-->
+<!-- <svg:rect height="10" rx="2" ry="2" width="25" x="120" y="0"/>-->
+<!-- <svg:rect height="10" rx="2" ry="2" width="25" x="155" y="0"/>-->
+<!-- <svg:rect height="25%" rx="2" ry="2" width="180" x="0" y="16"/>-->
+<!-- </op-content-loader>-->
+<!-- </turbo-frame>-->
+<!-- </div>-->
+<!--</div>-->
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.ts
new file mode 100644
index 00000000000..fd7e20f268d
--- /dev/null
+++ b/frontend/src/app/shared/components/fields/edit/field-types/progress-popover-edit-field.component.ts
@@ -0,0 +1,152 @@
+/*
+ * -- copyright
+ * OpenProject is an open source project management software.
+ * Copyright (C) 2010-2024 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.
+ * ++
+ */
+
+import {
+ AfterViewInit,
+ ChangeDetectionStrategy,
+ ChangeDetectorRef,
+ Component,
+ ElementRef,
+ Inject,
+ Injector,
+ OnDestroy,
+ OnInit,
+ ViewChild,
+} from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
+import {
+ ProgressEditFieldComponent,
+} from 'core-app/shared/components/fields/edit/field-types/progress-edit-field.component';
+import { ResourceChangeset } from 'core-app/shared/components/fields/changeset/resource-changeset';
+import { HalResource } from 'core-app/features/hal/resources/hal-resource';
+import { IFieldSchema } from 'core-app/shared/components/fields/field.base';
+import { EditFieldHandler } from 'core-app/shared/components/fields/edit/editing-portal/edit-field-handler';
+import {
+ OpEditingPortalChangesetToken,
+ OpEditingPortalHandlerToken,
+ OpEditingPortalSchemaToken,
+} from 'core-app/shared/components/fields/edit/edit-field.component';
+import { HalEventsService } from 'core-app/features/hal/services/hal-events.service';
+import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+
+@Component({
+ templateUrl: './progress-popover-edit-field.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+export class ProgressPopoverEditFieldComponent extends ProgressEditFieldComponent implements OnInit, AfterViewInit, OnDestroy {
+ @ViewChild('frameElement') frameElement:ElementRef<HTMLIFrameElement>;
+
+ text = {
+ title: this.I18n.t('js.work_packages.progress.title'),
+ button_close: this.I18n.t('js.button_close'),
+ };
+
+ public frameSrc:string;
+ public frameId:string;
+
+ opened = false;
+
+ constructor(
+ readonly I18n:I18nService,
+ readonly elementRef:ElementRef,
+ @Inject(OpEditingPortalChangesetToken) protected change:ResourceChangeset<HalResource>,
+ @Inject(OpEditingPortalSchemaToken) public schema:IFieldSchema,
+ @Inject(OpEditingPortalHandlerToken) readonly handler:EditFieldHandler,
+ readonly cdRef:ChangeDetectorRef,
+ readonly injector:Injector,
+ readonly pathHelper:PathHelperService,
+ private halEvents:HalEventsService,
+ ) {
+ super(I18n, elementRef, change, schema, handler, cdRef, injector);
+ }
+
+ ngOnInit() {
+ super.ngOnInit();
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ this.frameSrc = this.pathHelper.workPackageProgressModalPath(this.resource.id as string);
+ this.frameId = 'work_package_progress_modal';
+ }
+
+ ngAfterViewInit() {
+ this
+ .frameElement
+ .nativeElement
+ .addEventListener('turbo:submit-end', this.propagateSuccessfulUpdate.bind(this));
+ }
+
+ ngOnDestroy() {
+ super.ngOnDestroy();
+
+ this
+ .frameElement
+ .nativeElement
+ .removeEventListener('turbo:submit-end', this.propagateSuccessfulUpdate.bind(this));
+ }
+
+ private propagateSuccessfulUpdate(event:CustomEvent) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const { fetchResponse } = event.detail;
+
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ if (fetchResponse.succeeded) {
+ this.halEvents.push(
+ this.resource as WorkPackageResource,
+ { eventType: 'updated' },
+ );
+ }
+ }
+
+ public onInputClick(event:MouseEvent) {
+ event.stopPropagation();
+ }
+
+ public showProgressModal():void {
+ this.opened = true;
+ this.cdRef.detectChanges();
+ }
+
+ public onModalClosed():void {
+ this.opened = false;
+
+ if (!this.handler.inEditMode) {
+ this.handler.deactivate(false);
+ }
+ }
+
+ public closeMe():void {
+ this.cancel();
+ }
+
+ public cancel():void {
+ this.handler.reset();
+ this.onModalClosed();
+ }
+}
diff --git a/frontend/src/app/shared/components/fields/openproject-fields.module.ts b/frontend/src/app/shared/components/fields/openproject-fields.module.ts
index bbb87b76de5..c03fd9f1c1b 100644
--- a/frontend/src/app/shared/components/fields/openproject-fields.module.ts
+++ b/frontend/src/app/shared/components/fields/openproject-fields.module.ts
@@ -26,7 +26,7 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { APP_INITIALIZER, Injector, NgModule } from '@angular/core';
+import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Injector, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';
import { OpenprojectEditorModule } from 'core-app/shared/components/editor/openproject-editor.module';
@@ -98,6 +98,7 @@ import { ProjectEditFieldComponent } from './edit/field-types/project-edit-field
import {
HoursDurationEditFieldComponent,
} from 'core-app/shared/components/fields/edit/field-types/hours-duration-edit-field.component';
+import { ProgressPopoverEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/progress-popover-edit-field.component';
import { UserEditFieldComponent } from './edit/field-types/user-edit-field.component';
import {
DaysDurationEditFieldComponent,
@@ -150,6 +151,7 @@ import { FormsModule } from '@angular/forms';
declarations: [
EditFormPortalComponent,
HoursDurationEditFieldComponent,
+ ProgressPopoverEditFieldComponent,
DaysDurationEditFieldComponent,
FloatEditFieldComponent,
PlainFormattableEditFieldComponent,
@@ -168,6 +170,7 @@ import { FormsModule } from '@angular/forms';
WorkPackageQuickinfoMacroComponent,
],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class OpenprojectFieldsModule {
constructor(injector:Injector) {
diff --git a/lookbook/previews/open_project/progress/modal_preview.rb b/lookbook/previews/open_project/progress/modal_preview.rb
new file mode 100644
index 00000000000..c52ec965521
--- /dev/null
+++ b/lookbook/previews/open_project/progress/modal_preview.rb
@@ -0,0 +1,43 @@
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2024 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.
+# ++
+
+module OpenProject
+ module Progress
+ # @logical_path OpenProject/Progress
+ class ModalPreview < Lookbook::Preview
+
+ def default
+ work_package = FactoryBot.build_stubbed(:work_package,
+ estimated_hours: 5.0,
+ remaining_hours: 2.5,
+ done_ratio: 50)
+ render_with_template(locals: { work_package: })
+ end
+ end
+ end
+end
diff --git a/lookbook/previews/open_project/progress/modal_preview/default.html.erb b/lookbook/previews/open_project/progress/modal_preview/default.html.erb
new file mode 100644
index 00000000000..3200f9beb95
--- /dev/null
+++ b/lookbook/previews/open_project/progress/modal_preview/default.html.erb
@@ -0,0 +1,14 @@
+<div class="spot-drop-modal--body spot-container">
+ <div class="spot-modal--header">
+ <div class="spot-modal--header-title">Progress</div>
+
+ <button
+ class="button button_no-margin -transparent spot-modal--header-close-button"
+ data-test-selector="op-share-wp-modal--close-icon">
+ Close
+ </button>
+ </div>
+ <div class="spot-modal--body spot-container">
+ <%= render(WorkPackages::Progress::ModalBodyComponent.new(work_package)) %>
+ </div>
+</div>