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
Simplify (YAGNI): inline WidgetedComponent mixin
Alexander Brandon Coles4537fe41a2ca
diff --git a/modules/grids/app/components/grids/widget_component.rb b/modules/grids/app/components/grids/widget_component.rbindex c31b7a8aea3..08190134c09 100644--- a/modules/grids/app/components/grids/widget_component.rb+++ b/modules/grids/app/components/grids/widget_component.rb@@ -31,6 +31,22 @@module Gridsclass WidgetComponent < Primer::BaseComponentextend Dry::Initializer- include WidgetedComponent++ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ option :current_user, default: -> { User.current }++ def title+ raise NotImplementedError+ end++ def widget_wrapper(**, &)+ component_wrapper tag: "turbo-frame", **, &+ end++ def wrapper_arguments+ {}+ endendenddiff --git a/modules/grids/app/components/grids/widget_grid_component.rb b/modules/grids/app/components/grids/widget_grid_component.rbindex 87f7ef2b2ff..5dfb47e9c86 100644--- a/modules/grids/app/components/grids/widget_grid_component.rb+++ b/modules/grids/app/components/grids/widget_grid_component.rb@@ -48,7 +48,7 @@ module Gridsdef 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)+ raise "Widget must be WidgetedComponent" unless widget.is_a?(WidgetComponent)widgetenddiff --git a/modules/grids/app/components/grids/widgeted_component.rb b/modules/grids/app/components/grids/widgeted_component.rbdeleted file mode 100644index 02df51887ae..00000000000--- a/modules/grids/app/components/grids/widgeted_component.rb+++ /dev/null@@ -1,53 +0,0 @@-# 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-end