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

Create individual components per workspace to make it easier to create different overviews later when we have more widgets

Henriette Darge896ea060caea
diff --git a/modules/overviews/app/components/overviews/overview_grid_component.html.erb b/modules/overviews/app/components/overviews/overview_grid_component.html.erb
index c868d31ca60..dfde971ae76 100644
--- a/modules/overviews/app/components/overviews/overview_grid_component.html.erb
+++ b/modules/overviews/app/components/overviews/overview_grid_component.html.erb
@@ -26,15 +26,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-
<%=
- render(Grids::WidgetGridComponent.new(align_boxes_start: true)) do |grid|
- grid.with_widget(Overviews::Widgets::DescriptionComponent, @project)
- grid.with_widget(Overviews::Widgets::ProjectStatusComponent, @project)
- grid.with_widget(Overviews::Widgets::SubitemsComponent, @project)
- grid.with_widget(Overviews::Widgets::MembersComponent, @project)
- if show_news_widget?
- grid.with_widget(Overviews::Widgets::NewsComponent, @project)
- end
+ if @project.project?
+ render(Overviews::Workspaces::ProjectOverviewGridComponent.new(project: @project))
+ elsif @project.program?
+ render(Overviews::Workspaces::ProgramOverviewGridComponent.new(program: @project))
+ elsif @project.portfolio?
+ render(Overviews::Workspaces::PortfolioOverviewGridComponent.new(portfolio: @project))
end
%>
diff --git a/modules/overviews/app/components/overviews/overview_grid_component.rb b/modules/overviews/app/components/overviews/overview_grid_component.rb
index e984ca611be..8da276ff9b1 100644
--- a/modules/overviews/app/components/overviews/overview_grid_component.rb
+++ b/modules/overviews/app/components/overviews/overview_grid_component.rb
@@ -38,9 +38,5 @@ module Overviews
@project = project
end
-
- def show_news_widget?
- @project.workspace_type == "project"
- end
end
end
diff --git a/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.html.erb b/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.html.erb
new file mode 100644
index 00000000000..84b2058faea
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.html.erb
@@ -0,0 +1,37 @@
+<%#-- 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.
+
+++#%>
+
+<%=
+ render(Grids::WidgetGridComponent.new(align_boxes_start: true)) do |grid|
+ grid.with_widget(Overviews::Widgets::DescriptionComponent, @portfolio)
+ grid.with_widget(Overviews::Widgets::ProjectStatusComponent, @portfolio)
+ grid.with_widget(Overviews::Widgets::SubitemsComponent, @portfolio)
+ grid.with_widget(Overviews::Widgets::MembersComponent, @portfolio)
+ end
+%>
diff --git a/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.rb b/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.rb
new file mode 100644
index 00000000000..3bede72c582
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/portfolio_overview_grid_component.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+#-- 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 Overviews
+ module Workspaces
+ class PortfolioOverviewGridComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpPrimer::ComponentHelpers
+
+ def initialize(portfolio:)
+ super
+
+ @portfolio = portfolio
+ end
+
+ def render?
+ @portfolio.portfolio?
+ end
+ end
+ end
+end
diff --git a/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.html.erb b/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.html.erb
new file mode 100644
index 00000000000..85d29c670f4
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.html.erb
@@ -0,0 +1,37 @@
+<%#-- 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.
+
+++#%>
+
+<%=
+ render(Grids::WidgetGridComponent.new(align_boxes_start: true)) do |grid|
+ grid.with_widget(Overviews::Widgets::DescriptionComponent, @program)
+ grid.with_widget(Overviews::Widgets::ProjectStatusComponent, @program)
+ grid.with_widget(Overviews::Widgets::SubitemsComponent, @program)
+ grid.with_widget(Overviews::Widgets::MembersComponent, @program)
+ end
+%>
diff --git a/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.rb b/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.rb
new file mode 100644
index 00000000000..b7c71d4b3d5
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/program_overview_grid_component.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+#-- 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 Overviews
+ module Workspaces
+ class ProgramOverviewGridComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpPrimer::ComponentHelpers
+
+ def initialize(program:)
+ super
+
+ @program = program
+ end
+
+ def render?
+ @program.program?
+ end
+ end
+ end
+end
diff --git a/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.html.erb b/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.html.erb
new file mode 100644
index 00000000000..c9ebcaece36
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.html.erb
@@ -0,0 +1,38 @@
+<%#-- 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.
+
+++#%>
+
+<%=
+ render(Grids::WidgetGridComponent.new(align_boxes_start: true)) do |grid|
+ grid.with_widget(Overviews::Widgets::DescriptionComponent, @project)
+ grid.with_widget(Overviews::Widgets::ProjectStatusComponent, @project)
+ grid.with_widget(Overviews::Widgets::SubitemsComponent, @project)
+ grid.with_widget(Overviews::Widgets::MembersComponent, @project)
+ grid.with_widget(Overviews::Widgets::NewsComponent, @project)
+ end
+%>
diff --git a/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.rb b/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.rb
new file mode 100644
index 00000000000..576a9c60a34
--- /dev/null
+++ b/modules/overviews/app/components/overviews/workspaces/project_overview_grid_component.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+#-- 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 Overviews
+ module Workspaces
+ class ProjectOverviewGridComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpPrimer::ComponentHelpers
+
+ def initialize(project:)
+ super
+
+ @project = project
+ end
+
+ def render?
+ @project.project?
+ end
+ end
+ end
+end