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

WIP: Update project journal formatter to display in the required formats

Mir Bhatia7e560f62e941
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 6bcf9ff3d75..c400d1c6e39 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -43,6 +43,7 @@ class Journal < ApplicationRecord
register_journal_formatter :active_status, OpenProject::JournalFormatter::ActiveStatus
register_journal_formatter :template, OpenProject::JournalFormatter::Template
register_journal_formatter :visibility, OpenProject::JournalFormatter::Visibility
+ # register_journal_formatter :subproject, OpenProject::JournalFormatter::Subproject
# Make sure each journaled model instance only has unique version ids
validates :version, uniqueness: { scope: %i[journable_id journable_type] }
diff --git a/app/models/project.rb b/app/models/project.rb
index 6c28d86f1a1..bacffe15879 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -110,7 +110,7 @@ class Project < ApplicationRecord
register_journal_formatted_fields(:plaintext, 'name')
register_journal_formatted_fields(:diff, 'description')
register_journal_formatted_fields(:visibility, 'public')
- register_journal_formatted_fields(:named_association, 'parent_id')
+ register_journal_formatted_fields(:named_association, 'parent_id') # Replace with custom for parent?
register_journal_formatted_fields(:custom_field, /custom_fields_\d+/)
has_paper_trail
diff --git a/lib/open_project/journal_formatter/subproject.rb b/lib/open_project/journal_formatter/subproject.rb
new file mode 100644
index 00000000000..86778f75da3
--- /dev/null
+++ b/lib/open_project/journal_formatter/subproject.rb
@@ -0,0 +1,38 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2023 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 OpenProject::JournalFormatter::Subproject < JournalFormatter::Base
+ def render(key, values, options = { html: true })
+ # label_text = options[:html] ? content_tag(:strong, label(key)) : label(key)
+ # activated_text = values.last ? I18n.t('scheduling.activated') : I18n.t('scheduling.deactivated')
+
+ # I18n.t(:text_journal_label_value, label: label_text, value: activated_text)
+
+ # Maybe need to revert some of 5570e2c?
+ end
+end