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: Add project journal attribute for template
Mir Bhatia7f079b38338e
diff --git a/app/models/journal.rb b/app/models/journal.rbindex 089d315d039..ed672f249b5 100644--- a/app/models/journal.rb+++ b/app/models/journal.rb@@ -40,6 +40,8 @@ class Journal < ApplicationRecordregister_journal_formatter :schedule_manually, OpenProject::JournalFormatter::ScheduleManuallyregister_journal_formatter :ignore_non_working_days, OpenProject::JournalFormatter::IgnoreNonWorkingDaysregister_journal_formatter :active_status, OpenProject::JournalFormatter::ActiveStatus+ register_journal_formatter :template, OpenProject::JournalFormatter::Template+# Make sure each journaled model instance only has unique version idsvalidates :version, uniqueness: { scope: %i[journable_id journable_type] }diff --git a/app/models/project.rb b/app/models/project.rbindex e8506185fb7..db79e0523d1 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -105,6 +105,7 @@ class Project < ApplicationRecorddatetime: :created_atregister_on_journal_formatter(:active_status, 'active')+ register_on_journal_formatter(:template, 'templated')has_paper_traildiff --git a/lib/open_project/journal_formatter/template.rb b/lib/open_project/journal_formatter/template.rbnew file mode 100644index 00000000000..257453bbd2b--- /dev/null+++ b/lib/open_project/journal_formatter/template.rb@@ -0,0 +1,37 @@+#-- 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::Template < JournalFormatter::Base+ def render(_key, values, options = { html: true })+ # binding.pry+ label_text = options[:html] ? content_tag('strong', "Template:") : "Template"+ activated_text = values.last ? "Project un-marked as template" : "Project marked as template"++ I18n.t(:text_journal_label_value, label: label_text, value: activated_text)+ end+end