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
Render templated field in Project activity details as specified
Christophe Bliarde7c82d297182
diff --git a/lib/open_project/journal_formatter/template.rb b/lib/open_project/journal_formatter/template.rbindex 2ed6e7b7fb7..7484a95b836 100644--- a/lib/open_project/journal_formatter/template.rb+++ b/lib/open_project/journal_formatter/template.rb@@ -28,8 +28,8 @@class OpenProject::JournalFormatter::Template < JournalFormatter::Basedef render(_key, values, options = { html: true })- label_text = options[:html] ? content_tag('strong', "Template:") : "Template:"- activated_text = values.last ? "Project marked as template" : "Project un-marked as template"+ label_text = options[:html] ? content_tag('strong', "Project") : "Project"+ activated_text = values.last ? "marked as template" : "unmarked as template"I18n.t(:text_journal_label_value, label: label_text, value: activated_text)enddiff --git a/spec/features/activities/project_attributes_activity_spec.rb b/spec/features/activities/project_attributes_activity_spec.rbindex a40c00377d2..fdbc2cc9869 100644--- a/spec/features/activities/project_attributes_activity_spec.rb+++ b/spec/features/activities/project_attributes_activity_spec.rb@@ -93,7 +93,7 @@ describe 'Project attributes activities' doexpect(page).to have_selector('li', text: 'Project unarchived')expect(page).to have_selector('li', text: "Identifier changed from #{previous_project_attributes['identifier']} " \"to #{project.identifier}")- expect(page).to have_selector('li', text: 'Template: Project marked as template')+ expect(page).to have_selector('li', text: 'Project marked as template')# custom fieldsexpect(page).to have_selector('li', text: "#{list_project_custom_field.name} " \diff --git a/spec/lib/journal_formatter/template_spec.rb b/spec/lib/journal_formatter/template_spec.rbindex 5011b6fc79d..b6008cfc115 100644--- a/spec/lib/journal_formatter/template_spec.rb+++ b/spec/lib/journal_formatter/template_spec.rb@@ -29,25 +29,25 @@require 'spec_helper'describe OpenProject::JournalFormatter::Template do- let(:instance) { described_class.new(build(:journal)) }+ let(:instance) { described_class.new(build(:journal, journable: build(:project))) }it "renders correctly when marked as template" dohtml = instance.render("templated", [false, true], html: true)- expect(html).to eq("<strong>Template:</strong> Project marked as template")+ expect(html).to eq("<strong>Project</strong> marked as template")html = instance.render("templated", [false, true], html: false)- expect(html).to eq("Template: Project marked as template")+ expect(html).to eq("Project marked as template")html = instance.render("templated", [nil, true], html: false)- expect(html).to eq("Template: Project marked as template")+ expect(html).to eq("Project marked as template")end- it "renders correctly when un-marked as template" do+ it "renders correctly when unmarked as template" dohtml = instance.render("templated", [true, false], html: true)- expect(html).to eq("<strong>Template:</strong> Project un-marked as template")+ expect(html).to eq("<strong>Project</strong> unmarked as template")html = instance.render("templated", [true, false], html: false)- expect(html).to eq("Template: Project un-marked as template")+ expect(html).to eq("Project unmarked as template")html = instance.render("templated", [nil, false], html: false)- expect(html).to eq("Template: Project un-marked as template")+ expect(html).to eq("Project unmarked as template")endend