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
[#67255] Widget Box Component - WIP
Alexander Brandon Colesbe1fb7724222
diff --git a/frontend/src/global_styles/content/_widget_box.sass b/frontend/src/global_styles/content/_widget_box.sassindex ef37ca8c525..5afa7e9944f 100644--- a/frontend/src/global_styles/content/_widget_box.sass+++ b/frontend/src/global_styles/content/_widget_box.sass@@ -119,6 +119,23 @@ $widget-box--enumeration-width: 20pxoverflow-y: hiddendisplay: block+ &.-no-padding+ padding-right: 0+ padding-bottom: 0+ padding-left: 0++ // apply special treatment for nested boxes, e.g. Border Box+ .Box+ border-right: unset+ border-bottom: unset+ border-left: unset+ border-top-left-radius: unset+ border-top-right-radius: unset++ .Box-row:first-of-type+ border-top-left-radius: unset+ border-top-right-radius: unset+&.-allow-inner-overflow.wikioverflow-y: autodiff --git a/modules/grids/app/components/grids/widget_box_component.html.erb b/modules/grids/app/components/grids/widget_box_component.html.erbnew file mode 100644index 00000000000..8644756ed66--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component.html.erb@@ -0,0 +1,34 @@+<%#-- 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(Primer::BaseComponent.new(**@system_arguments)) do %>+ <%= header %>+ <%= body %>+<% end %>diff --git a/modules/grids/app/components/grids/widget_box_component.rb b/modules/grids/app/components/grids/widget_box_component.rbnew file mode 100644index 00000000000..4b366124506--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component.rb@@ -0,0 +1,59 @@+# 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 Grids+ class WidgetBoxComponent < ApplicationComponent+ attr_reader :title, :content_padding++ renders_one :header, HeaderComponent+ renders_one :body, BodyComponent++ def initialize(title:, content_padding: BodyComponent::DEFAULT_PADDING, **system_arguments)+ super()++ @title = title+ @content_padding = content_padding+ @system_arguments = system_arguments+ @system_arguments[:tag] = :div+ @system_arguments[:classes] = class_names(+ @system_arguments[:classes],+ "widget-box"+ )+ end++ def default_header+ HeaderComponent.new(title:)+ end++ def default_body+ BodyComponent.new(padding: content_padding).with_content(content) if content+ end+ end+enddiff --git a/modules/grids/app/components/grids/widget_box_component/body_component.html.erb b/modules/grids/app/components/grids/widget_box_component/body_component.html.erbnew file mode 100644index 00000000000..8cca3b3ccc8--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component/body_component.html.erb@@ -0,0 +1,33 @@+<%#-- 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(Primer::BaseComponent.new(**@system_arguments)) do %>+ <%= content %>+<% end %>diff --git a/modules/grids/app/components/grids/widget_box_component/body_component.rb b/modules/grids/app/components/grids/widget_box_component/body_component.rbnew file mode 100644index 00000000000..ccb6f187000--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component/body_component.rb@@ -0,0 +1,55 @@+# 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 Grids+ class WidgetBoxComponent < ApplicationComponent+ class BodyComponent < ApplicationComponent+ include Primer::FetchOrFallbackHelper++ DEFAULT_PADDING = :default+ PADDING_MAPPINGS = {+ DEFAULT_PADDING => "",+ :none => "-no-padding"+ }.freeze++ def initialize(padding: DEFAULT_PADDING, **system_arguments)+ super()++ @system_arguments = system_arguments+ @system_arguments[:tag] = :div+ @system_arguments[:classes] = class_names(+ @system_arguments[:classes],+ "op-widget-box--body",+ PADDING_MAPPINGS[fetch_or_fallback(PADDING_MAPPINGS.keys, padding, DEFAULT_PADDING)]+ )+ end+ end+ end+enddiff --git a/modules/grids/app/components/grids/widget_box_component/header_component.html.erb b/modules/grids/app/components/grids/widget_box_component/header_component.html.erbnew file mode 100644index 00000000000..94262efd2a4--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component/header_component.html.erb@@ -0,0 +1,35 @@+<%#-- 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(Primer::BaseComponent.new(**@system_arguments)) do %>+ <div class="op-widget-box--header-title title-container">+ <h3 class="editable-toolbar-title--fixed"><%= title %></h3>+ </div>+<% end %>diff --git a/modules/grids/app/components/grids/widget_box_component/header_component.rb b/modules/grids/app/components/grids/widget_box_component/header_component.rbnew file mode 100644index 00000000000..71bf8940793--- /dev/null+++ b/modules/grids/app/components/grids/widget_box_component/header_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 Grids+ class WidgetBoxComponent < ApplicationComponent+ class HeaderComponent < ApplicationComponent+ attr_reader :title++ def initialize(title:, **system_arguments)+ super()+ @title = title+ @system_arguments = system_arguments+ @system_arguments[:tag] = :header+ @system_arguments[:classes] = class_names(+ @system_arguments[:classes],+ "op-widget-box--header"+ )+ end+ end+ end+enddiff --git a/modules/grids/app/components/grids/widget_component.rb b/modules/grids/app/components/grids/widget_component.rbnew file mode 100644index 00000000000..c31b7a8aea3--- /dev/null+++ b/modules/grids/app/components/grids/widget_component.rb@@ -0,0 +1,36 @@+# 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 Grids+ class WidgetComponent < Primer::BaseComponent+ extend Dry::Initializer+ include WidgetedComponent+ end+enddiff --git a/modules/grids/app/components/grids/widget_grid_component.html.erb b/modules/grids/app/components/grids/widget_grid_component.html.erbnew file mode 100644index 00000000000..e80ba428b50--- /dev/null+++ b/modules/grids/app/components/grids/widget_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(Primer::BaseComponent.new(**@system_arguments)) do %>+ <% widgets.each do |widget| %>+ <%= render(Grids::WidgetBoxComponent.new(title: widget.title, **widget.wrapper_arguments)) do %>+ <%= widget %>+ <% end %>+ <% end %>+<% end %>diff --git a/modules/grids/app/components/grids/widget_grid_component.rb b/modules/grids/app/components/grids/widget_grid_component.rbnew file mode 100644index 00000000000..87f7ef2b2ff--- /dev/null+++ b/modules/grids/app/components/grids/widget_grid_component.rb@@ -0,0 +1,56 @@+# 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 Grids+ class WidgetGridComponent < ApplicationComponent+ renders_many :widgets, ->(widget_class, *widget_args, **system_arguments) {+ build_widget(widget_class, *widget_args, **system_arguments)+ }++ def initialize(**system_arguments)+ super()++ @system_arguments = system_arguments+ @system_arguments[:tag] = :section+ @system_arguments[:classes] = class_names(+ @system_arguments[:classes],+ "widget-boxes",+ "-flex"+ )+ end++ def build_widget(widget_class, *widget_args, **system_arguments)+ widget = widget_class.new(*widget_args, **system_arguments)+ raise "Widget must be WidgetedComponent" unless widget.is_a?(WidgetedComponent)++ widget+ end+ end+enddiff --git a/modules/grids/app/components/grids/widgeted_component.rb b/modules/grids/app/components/grids/widgeted_component.rbnew file mode 100644index 00000000000..02df51887ae--- /dev/null+++ b/modules/grids/app/components/grids/widgeted_component.rb@@ -0,0 +1,53 @@+# 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 Grids+ module WidgetedComponent+ extend ActiveSupport::Concern+ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ included do+ option :current_user, default: -> { User.current }+ end++ def title+ raise NotImplementedError+ end++ def widget_wrapper(**, &)+ component_wrapper tag: "turbo-frame", **, &+ end++ def wrapper_arguments+ {}+ end+ end+enddiff --git a/modules/grids/spec/components/grids/widget_box_component_spec.rb b/modules/grids/spec/components/grids/widget_box_component_spec.rbnew file mode 100644index 00000000000..280e163fc6b--- /dev/null+++ b/modules/grids/spec/components/grids/widget_box_component_spec.rb@@ -0,0 +1,44 @@+# 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.+#+++require "rails_helper"++RSpec.describe Grids::WidgetBoxComponent, type: :component do+ def render_component(**args)+ render_inline(described_class.new(**args))+ end++ subject(:rendered) { render_component(title: "Cool Widget") }++ it "renders with default inset styles" do+ puts rendered++ expect(rendered).to have_css ".widget-box"+ end+enddiff --git a/modules/overviews/app/components/overviews/overview_grid_component.html.erb b/modules/overviews/app/components/overviews/overview_grid_component.html.erbindex 637cbf72224..dd9a8f2ff28 100644--- a/modules/overviews/app/components/overviews/overview_grid_component.html.erb+++ b/modules/overviews/app/components/overviews/overview_grid_component.html.erb@@ -28,12 +28,9 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- grid_layout("op-portfolio-overview", tag: :div, align_items: :flex_start) do |grid|- grid.with_area(:description, tag: :div) do- render(Overviews::Widgets::DescriptionComponent.new(@project))- end- grid.with_area(:subitems, tag: :div) do- render(Overviews::Widgets::SubitemsComponent.new(@project))- end+ render(Grids::WidgetGridComponent.new) do |grid|+ grid.with_widget(Overviews::Widgets::DescriptionComponent, @project)+ grid.with_widget(Overviews::Widgets::SubitemsComponent, @project)+ grid.with_widget(Overviews::Widgets::ProjectStatusComponent, @project)end%>diff --git a/modules/overviews/app/components/overviews/widgets/description_component.html.erb b/modules/overviews/app/components/overviews/widgets/description_component.html.erbindex 8157058ac90..7b19c95c7e8 100644--- a/modules/overviews/app/components/overviews/widgets/description_component.html.erb+++ b/modules/overviews/app/components/overviews/widgets/description_component.html.erb@@ -29,15 +29,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- component_wrapper do- render(Primer::Beta::BorderBox.new) do |component|- component.with_header do- render(Primer::Beta::Text.new) { Project.human_attribute_name(:description) }- end-- component.with_row do- helpers.format_text project, :description- end- end+ widget_wrapper do+ helpers.format_text project, :descriptionend%>diff --git a/modules/overviews/app/components/overviews/widgets/description_component.rb b/modules/overviews/app/components/overviews/widgets/description_component.rbindex 9fc7cd26fc9..da572bb5017 100644--- a/modules/overviews/app/components/overviews/widgets/description_component.rb+++ b/modules/overviews/app/components/overviews/widgets/description_component.rb@@ -30,14 +30,14 @@module Overviewsmodule Widgets- class DescriptionComponent < ApplicationComponent- include OpTurbo::Streamable- include OpPrimer::ComponentHelpers- include ApplicationHelper-- def project = model+ class DescriptionComponent < Grids::WidgetComponent+ param :projectdelegate :description, to: :project++ def title+ Project.human_attribute_name(:description)+ endendendenddiff --git a/modules/overviews/app/components/overviews/widgets/project_status_component.html.erb b/modules/overviews/app/components/overviews/widgets/project_status_component.html.erbindex 58dddd08bfb..a060d896673 100644--- a/modules/overviews/app/components/overviews/widgets/project_status_component.html.erb+++ b/modules/overviews/app/components/overviews/widgets/project_status_component.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- component_wrapper tag: :"turbo-frame" do+ widget_wrapper doflex_layout do |flex|flex.with_row(mb: 3) dorender(Projects::StatusButtonComponent.new(project:, user: current_user, hide_help_text: true))diff --git a/modules/overviews/app/components/overviews/widgets/project_status_component.rb b/modules/overviews/app/components/overviews/widgets/project_status_component.rbindex 9bc73e7e921..d8b18bbb720 100644--- a/modules/overviews/app/components/overviews/widgets/project_status_component.rb+++ b/modules/overviews/app/components/overviews/widgets/project_status_component.rb@@ -30,18 +30,13 @@module Overviewsmodule Widgets- class ProjectStatusComponent < ApplicationComponent+ class ProjectStatusComponent < Grids::WidgetComponentinclude ApplicationHelper- include OpPrimer::ComponentHelpers- include OpTurbo::Streamable- attr_reader :project, :current_user+ param :project- def initialize(project:, current_user:)- super()-- @project = project- @current_user = current_user+ def title+ Project.human_attribute_name(:status_code)endprivatediff --git a/modules/overviews/app/components/overviews/widgets/subitems_component.html.erb b/modules/overviews/app/components/overviews/widgets/subitems_component.html.erbindex 8199e30654b..c465a7b9ac6 100644--- a/modules/overviews/app/components/overviews/widgets/subitems_component.html.erb+++ b/modules/overviews/app/components/overviews/widgets/subitems_component.html.erb@@ -29,32 +29,34 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- component_wrapper do- render(Primer::Beta::BorderBox.new) do |component|- component.with_header do- render(Primer::Beta::Text.new) { title }+ widget_wrapper do+ render(Primer::Beta::BorderBox.new) do |container|+ container.with_header(classes: "sr-only") do+ titleendif children.empty?- component.with_row do+ container.with_row dorender(Primer::Beta::Text.new(color: :subtle)) { I18n.t("overviews.widgets.subitems.no_visible_children") }endelsechildren.find_each do |child|- component.with_row do+ container.with_row doflex_layout do |row|row.with_column dorender(Primer::Beta::Text.new(color: :subtle)) do- concat render Primer::Beta::Octicon.new(icon: helpers.workspace_icon(child),- mr: 1,- color: :subtle,- "aria-label": child.workspace_label)+ concat render Primer::Beta::Octicon.new(+ icon: helpers.workspace_icon(child),+ mr: 1,+ color: :subtle,+ "aria-label": child.workspace_label+ )concat child.workspace_labelendendrow.with_column(ml: 2) do- render(Primer::Beta::Link.new(href: project_path(child))) { child.name }+ # render(Primer::Beta::Link.new(href: project_path(child))) { child.name }endrow.with_column(ml: 2) dodiff --git a/modules/overviews/app/components/overviews/widgets/subitems_component.rb b/modules/overviews/app/components/overviews/widgets/subitems_component.rbindex c2c6fd2622c..77e30b5b87d 100644--- a/modules/overviews/app/components/overviews/widgets/subitems_component.rb+++ b/modules/overviews/app/components/overviews/widgets/subitems_component.rb@@ -30,12 +30,10 @@module Overviewsmodule Widgets- class SubitemsComponent < ApplicationComponent- include OpTurbo::Streamable+ class SubitemsComponent < Grids::WidgetComponentinclude OpPrimer::ComponentHelpers- include ApplicationHelper- def project = model+ param :projectdelegate :description, to: :project@@ -46,6 +44,10 @@ module Overviewsdef children@children ||= project.children.visibleend++ def wrapper_arguments+ { content_padding: :none }+ endendendenddiff --git a/modules/overviews/app/controllers/overviews/widgets/project_statuses_controller.rb b/modules/overviews/app/controllers/overviews/widgets/project_statuses_controller.rbindex 9019ffbd0d9..872e0f12f28 100644--- a/modules/overviews/app/controllers/overviews/widgets/project_statuses_controller.rb+++ b/modules/overviews/app/controllers/overviews/widgets/project_statuses_controller.rb@@ -36,7 +36,7 @@ class Overviews::Widgets::ProjectStatusesController < Overviews::WidgetControlleif call.success?@project = call.result- update_via_turbo_stream(component: Overviews::Widgets::ProjectStatusComponent.new(project: @project, current_user:))+ update_via_turbo_stream(component: Overviews::Widgets::ProjectStatusComponent.new(@project, current_user:))render_success_flash_message_via_turbo_stream(message: t(:notice_successful_update))respond_with_turbo_streamselsediff --git a/modules/overviews/app/views/overviews/widgets/project_statuses/show.html.erb b/modules/overviews/app/views/overviews/widgets/project_statuses/show.html.erbindex a90a69bf247..4b57a59969a 100644--- a/modules/overviews/app/views/overviews/widgets/project_statuses/show.html.erb+++ b/modules/overviews/app/views/overviews/widgets/project_statuses/show.html.erb@@ -27,4 +27,4 @@ See COPYRIGHT and LICENSE files for more details.++#%>-<%= render Overviews::Widgets::ProjectStatusComponent.new(project: @project, current_user:) %>+<%= render Overviews::Widgets::ProjectStatusComponent.new(@project, current_user:) %>diff --git a/modules/overviews/spec/components/overviews/widgets/project_status_component_spec.rb b/modules/overviews/spec/components/overviews/widgets/project_status_component_spec.rbindex 8983133e6b3..0cfda22c15d 100644--- a/modules/overviews/spec/components/overviews/widgets/project_status_component_spec.rb+++ b/modules/overviews/spec/components/overviews/widgets/project_status_component_spec.rb@@ -43,7 +43,7 @@ RSpec.describe Overviews::Widgets::ProjectStatusComponent, type: :component docurrent_user { user }subject(:rendered_component) do- render_component(project:, current_user:)+ render_component(project, current_user:)endit "renders turbo-frame component wrapper" do