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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
wip
Dombi Attila5885b03b8ae1
diff --git a/frontend/src/app/features/overview/overview.component.ts b/frontend/src/app/features/overview/overview.component.tsindex 742139d1936..86e75ede5e3 100644--- a/frontend/src/app/features/overview/overview.component.ts+++ b/frontend/src/app/features/overview/overview.component.ts@@ -1,3 +1,31 @@+//-- 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.+//+++import { ChangeDetectionStrategy, Component } from '@angular/core';import { GridPageComponent } from 'core-app/shared/components/grids/grid/page/grid-page.component';import { GRID_PROVIDERS } from 'core-app/shared/components/grids/grid/grid.component';@@ -17,15 +45,34 @@ export class OverviewComponent extends GridPageComponent {}protected isTurboFrameSidebarEnabled():boolean {- const sidebarEnabledTag:HTMLMetaElement|null = document.querySelector('meta[name="sidebar_enabled"]');- return sidebarEnabledTag?.dataset.enabled === 'true';+ return this.isCustomFieldsSidebarEnabled() || this.isLifeCyclesSidebarEnabled();+ }++ protected isCustomFieldsSidebarEnabled():boolean {+ const customFieldsSidebarEnabledTag:HTMLMetaElement|null = document.querySelector('meta[name="custom_fields_sidebar_enabled"]');++ return customFieldsSidebarEnabledTag?.dataset.enabled === 'true';+ }++ protected isLifeCyclesSidebarEnabled():boolean {+ const lifeCyclesSidebarEnabledTag:HTMLMetaElement|null = document.querySelector('meta[name="life_cycles_sidebar_enabled"]');++ return lifeCyclesSidebarEnabledTag?.dataset.enabled === 'true';+ }++ protected lifeCyclesSidebarSrc():string {+ return `${this.pathHelper.staticBase}/projects/${this.currentProject.identifier ?? ''}/project_life_cycles_sidebar`;+ }++ protected lifeCyclesSidebarId():string {+ return 'project-life-cycles-sidebar';}- protected turboFrameSidebarSrc():string {+ protected projectCustomFieldsSidebarSrc():string {return `${this.pathHelper.staticBase}/projects/${this.currentProject.identifier ?? ''}/project_custom_fields_sidebar`;}- protected turboFrameSidebarId():string {+ protected projectCustomFieldsSidebarId():string {return 'project-custom-fields-sidebar';}diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.htmlindex 01a5002f85d..f3c82b9e54c 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html@@ -17,7 +17,27 @@<grid *ngIf="grid" [grid]="grid"></grid></div><div class="op-grid-page--sidebar">- <turbo-frame [src]="turboFrameSidebarSrc()" [id]="turboFrameSidebarId()">+ <turbo-frame+ *ngIf="isLifeCyclesSidebarEnabled()"+ [src]="lifeCyclesSidebarSrc()"+ [id]="lifeCyclesSidebarId()"+ >+ <op-content-loader viewBox="0 0 100 100">+ <svg:rect x="0" y="0" width="70" height="5" rx="1" />++ <svg:rect x="75" y="0" width="25" height="5" rx="1" />++ <svg:rect x="0" y="10" width="100" height="8" rx="1" />++ <svg:rect x="0" y="25" width="100" height="12" rx="1" />+ </op-content-loader>+ </turbo-frame>++ <turbo-frame+ *ngIf="isCustomFieldsSidebarEnabled()"+ [src]="projectCustomFieldsSidebarSrc()"+ [id]="projectCustomFieldsSidebarId()"+ ><op-content-loader viewBox="0 0 100 100"><svg:rect x="0" y="0" width="70" height="5" rx="1" />diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erbnew file mode 100644index 00000000000..cb1fcd5ac93--- /dev/null+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.html.erb@@ -0,0 +1,35 @@+<%=+ component_wrapper do+ render(Primer::OpenProject::SidePanel::Section.new(+ classes: 'op-project-custom-field-section-container',+ test_selector: "project-custom-field-section-#{@project_custom_field_section.id}"+ )) do |section|+ section.with_title { "Life Cycles" }++ if allowed_to_edit?+ section.with_action_icon(+ icon: :pencil,+ tag: :a,+ href: project_custom_field_section_dialog_path(project_id: @project.id, section_id: @project_custom_field_section.id),+ data: {+ controller: 'async-dialog'+ },+ test_selector: "project-custom-field-section-edit-button",+ aria: { label: I18n.t(:label_edit) }+ )+ end++ flex_layout do |details_container|+ @project_custom_fields.each_with_index do |project_custom_field, i|+ margin = i == @project_custom_fields.size - 1 ? 0 : 3+ details_container.with_row(mb: margin) do+ render(ProjectCustomFields::Sections::ProjectCustomFields::ShowComponent.new(+ project_custom_field:,+ project_custom_field_values: get_eager_loaded_project_custom_field_values_for(project_custom_field.id)+ ))+ end+ end+ end+ end+ end+%>diff --git a/modules/overviews/app/components/project_life_cycles/sections/show_component.rb b/modules/overviews/app/components/project_life_cycles/sections/show_component.rbnew file mode 100644index 00000000000..c629c990fa4--- /dev/null+++ b/modules/overviews/app/components/project_life_cycles/sections/show_component.rb@@ -0,0 +1,68 @@+#-- 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.+#++++module ProjectLifeCycles+ module Sections+ class ShowComponent < ApplicationComponent+ include ApplicationHelper+ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ def initialize(project:, project_custom_field_section:, project_custom_fields:)+ super++ @project = project+ @project_custom_field_section = project_custom_field_section+ @project_custom_fields = project_custom_fields++ eager_load_project_custom_field_values+ end++ private++ def allowed_to_edit?+ User.current.allowed_in_project?(:edit_project_attributes, @project)+ end++ def eager_load_project_custom_field_values+ # TODO: move to service+ @eager_loaded_project_custom_field_values = CustomValue+ .includes(custom_field: :custom_options)+ .where(+ custom_field_id: @project_custom_fields.pluck(:id),+ customized_id: @project.id+ )+ .to_a+ end++ def get_eager_loaded_project_custom_field_values_for(custom_field_id)+ @eager_loaded_project_custom_field_values.select { |pcfv| pcfv.custom_field_id == custom_field_id }+ end+ end+ end+enddiff --git a/modules/overviews/app/components/project_life_cycles/side_panel_component.html.erb b/modules/overviews/app/components/project_life_cycles/side_panel_component.html.erbnew file mode 100644index 00000000000..8af7ed711e3--- /dev/null+++ b/modules/overviews/app/components/project_life_cycles/side_panel_component.html.erb@@ -0,0 +1,20 @@+<%=+ component_wrapper do+ if available_project_custom_fields_grouped_by_section.any?+ render(Primer::OpenProject::SidePanel.new(+ spacious: true,+ test_selector: "project-life-cycles-sidebar-async-content"+ )) do |panel|+ available_project_custom_fields_grouped_by_section.each do |project_custom_field_section, project_custom_fields|+ panel.with_section(+ ProjectLifeCycles::Sections::ShowComponent.new(+ project: @project,+ project_custom_field_section:,+ project_custom_fields: project_custom_fields+ )+ )+ end+ end+ end+ end+%>diff --git a/modules/overviews/app/components/project_life_cycles/side_panel_component.rb b/modules/overviews/app/components/project_life_cycles/side_panel_component.rbnew file mode 100644index 00000000000..c21cba59c50--- /dev/null+++ b/modules/overviews/app/components/project_life_cycles/side_panel_component.rb@@ -0,0 +1,48 @@+#-- 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.+#++++module ProjectLifeCycles+ class SidePanelComponent < ApplicationComponent+ include ApplicationHelper+ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ def initialize(project:)+ super++ @project = project+ end++ private++ def available_project_custom_fields_grouped_by_section+ @available_project_custom_fields_grouped_by_section ||=+ @project.available_custom_fields.group_by(&:project_custom_field_section)+ end+ end+enddiff --git a/modules/overviews/app/controllers/overviews/overviews_controller.rb b/modules/overviews/app/controllers/overviews/overviews_controller.rbindex 9f1e34476af..07eba12d7c4 100644--- a/modules/overviews/app/controllers/overviews/overviews_controller.rb+++ b/modules/overviews/app/controllers/overviews/overviews_controller.rb@@ -1,3 +1,31 @@+# -- 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.+# +++module ::Overviewsclass OverviewsController < ::Grids::BaseInProjectControllerinclude OpTurbo::ComponentStream@@ -16,6 +44,10 @@ module ::Overviewsrender :project_custom_fields_sidebar, layout: falseend+ def project_life_cycles_sidebar+ render :project_life_cycles_sidebar, layout: false+ end+def project_custom_field_section_dialogrespond_with_dialog(ProjectCustomFields::Sections::EditDialogComponent.new(@@ -63,9 +95,10 @@ module ::Overviewsenddef set_sidebar_enabled- @sidebar_enabled =+ @custom_fields_sidebar_enabled =User.current.allowed_in_project?(:view_project_attributes, @project) &&@project.project_custom_fields.visible.any?+ @life_cycles_sidebar_enabled = OpenProject::FeatureDecisions.stages_and_gates_active?enddef handle_errors(project_with_errors, section)diff --git a/modules/overviews/app/views/overviews/overviews/project_life_cycles_sidebar.html.erb b/modules/overviews/app/views/overviews/overviews/project_life_cycles_sidebar.html.erbnew file mode 100644index 00000000000..1b05538bb3c--- /dev/null+++ b/modules/overviews/app/views/overviews/overviews/project_life_cycles_sidebar.html.erb@@ -0,0 +1,31 @@+<%#-- 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.++++#%>+<%= content_tag("turbo-frame", id: "project-life-cycles-sidebar") do %>+ <%= render(ProjectLifeCycles::SidePanelComponent.new(project: @project)) %>+<% end %>diff --git a/modules/overviews/app/views/overviews/overviews/show.html.erb b/modules/overviews/app/views/overviews/overviews/show.html.erbindex cce3768ff98..a323d0ca45e 100644--- a/modules/overviews/app/views/overviews/overviews/show.html.erb+++ b/modules/overviews/app/views/overviews/overviews/show.html.erb@@ -1,5 +1,6 @@<% content_for :header_tags do %>- <meta name="sidebar_enabled" data-enabled="<%= @sidebar_enabled %>">+ <meta name="custom_fields_sidebar_enabled" data-enabled="<%= @custom_fields_sidebar_enabled %>">+ <meta name="life_cycles_sidebar_enabled" data-enabled="<%= @life_cycles_sidebar_enabled %>"><% end -%><%=diff --git a/modules/overviews/config/routes.rb b/modules/overviews/config/routes.rbindex 9a007f2a0e7..8acce99b77c 100644--- a/modules/overviews/config/routes.rb+++ b/modules/overviews/config/routes.rb@@ -9,5 +9,8 @@ Rails.application.routes.draw doas: :project_custom_field_section_dialogput "projects/:project_id/update_project_custom_values/:section_id", to: "overviews/overviews#update_project_custom_values",as: :update_project_custom_values++ get "projects/:project_id/project_life_cycles_sidebar", to: "overviews/overviews#project_life_cycles_sidebar",+ as: :project_life_cycles_sidebarendenddiff --git a/modules/overviews/lib/overviews/engine.rb b/modules/overviews/lib/overviews/engine.rbindex eb934b7c033..df4464731f7 100644--- a/modules/overviews/lib/overviews/engine.rb+++ b/modules/overviews/lib/overviews/engine.rb@@ -47,7 +47,8 @@ module OverviewsOpenProject::AccessControl.permission(:view_project).controller_actions.push(- "overviews/overviews/show"+ "overviews/overviews/show",+ "overviews/overviews/project_life_cycles_sidebar")OpenProject::AccessControl.permission(:view_project_attributes)diff --git a/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rbnew file mode 100644index 00000000000..3e1107cdc7b--- /dev/null+++ b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb@@ -0,0 +1,58 @@+#-- 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.+#++++require "spec_helper"++RSpec.describe "Show project life cycles on project overview page", :js, :with_cuprite, with_flag: { stages_and_gates: true } do+ shared_let(:admin) { create(:admin) }+ shared_let(:project) { create(:project, name: "Foo project", identifier: "foo-project") }++ let(:overview_page) { Pages::Projects::Show.new(project) }++ before do+ login_as admin+ end++ it "does show the sidebar" do+ overview_page.visit_page++ within ".op-grid-page" do+ expect(page).to have_css(".op-grid-page--sidebar")+ end+ end++ context "when stages and gates are disabled", with_flag: { stages_and_gates: false } do+ it "does not show the sidebar" do+ overview_page.visit_page++ within ".op-grid-page" do+ expect(page).to have_no_css(".op-grid-page--sidebar")+ end+ end+ end+end