mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
Adapt meeting PDF exports for semantic work package identifiers
Agenda item titles and work package outcomes hardcoded the numeric id. Using formatted_id renders the project-based identifier in semantic mode, matching the meeting page rendering.
This commit is contained in:
@@ -61,12 +61,16 @@ module Meetings::PDF::Common::Agenda
|
||||
make_link_href(
|
||||
href,
|
||||
prawn_table_cell_inline_formatting_data(
|
||||
"#{work_package.type.name} ##{work_package.id} #{work_package.subject}",
|
||||
work_package_title_text(work_package),
|
||||
{ styles: [:underline] }
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
def work_package_title_text(work_package)
|
||||
"#{work_package.type.name} #{work_package.formatted_id} #{work_package.subject}"
|
||||
end
|
||||
|
||||
def agenda_wp_title_row(agenda_item)
|
||||
if agenda_item.visible_work_package?
|
||||
work_package = agenda_item.work_package
|
||||
@@ -109,7 +113,7 @@ module Meetings::PDF::Common::Agenda
|
||||
|
||||
def write_visible_work_package_outcome(work_package)
|
||||
href = url_helpers.work_package_url(work_package)
|
||||
link_text = "#{work_package.type.name} ##{work_package.id} #{work_package.subject}"
|
||||
link_text = work_package_title_text(work_package)
|
||||
status_text = " (#{work_package.status.name})"
|
||||
base_style = styles.outcome_work_package
|
||||
pdf.formatted_text([
|
||||
|
||||
@@ -250,6 +250,52 @@ RSpec.describe Meetings::PDF::Default::Exporter do
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
|
||||
context "with semantic work package identifiers",
|
||||
with_settings: { work_packages_identifier: "semantic" } do
|
||||
let(:options) do
|
||||
{
|
||||
participants: "0",
|
||||
outcomes: "0",
|
||||
backlog: "0",
|
||||
attachments: "0"
|
||||
}
|
||||
end
|
||||
let(:wp_agenda_item) do
|
||||
create(:wp_meeting_agenda_item,
|
||||
meeting:,
|
||||
meeting_section: meeting_section_second,
|
||||
work_package:,
|
||||
duration_in_minutes: 10,
|
||||
notes: "<mention class=\"mention\" data-id=\"#{work_package.id}\" data-type=\"work_package\" " \
|
||||
"data-text=\"##{work_package.id}\">##{work_package.id}</mention>")
|
||||
end
|
||||
|
||||
before do
|
||||
work_package.update_columns(identifier: "MEET-1", sequence_number: 1)
|
||||
end
|
||||
|
||||
it "renders the semantic identifier for the agenda item and the mention in its notes" do
|
||||
expected_document = [
|
||||
*expected_cover_page,
|
||||
*meeting_head,
|
||||
|
||||
"Untitled section", " ", "15 mins",
|
||||
"Agenda Item TOP 1", " ", "15 mins", " ", "Export User",
|
||||
"foo",
|
||||
|
||||
"Second section", " ", "10 mins",
|
||||
"Task", "MEET-1", "Important task", " (Workin' on it)", " ", "10 mins",
|
||||
"MEET-1",
|
||||
|
||||
"1", # Page number
|
||||
export_time_formatted,
|
||||
project.name
|
||||
].join(" ")
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a meeting with special work package agenda item" do
|
||||
@@ -362,6 +408,32 @@ RSpec.describe Meetings::PDF::Default::Exporter do
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
|
||||
context "with semantic work package identifiers",
|
||||
with_settings: { work_packages_identifier: "semantic" } do
|
||||
before do
|
||||
outcome_work_package.update_columns(identifier: "MEET-1", sequence_number: 1)
|
||||
end
|
||||
|
||||
it "renders the work package outcome with the semantic identifier" do
|
||||
expected_document = [
|
||||
*expected_cover_page,
|
||||
*meeting_head,
|
||||
|
||||
"Section with outcomes", " ", "15 mins",
|
||||
"Agenda Item", " ", "15 mins", " ", "Export User",
|
||||
"Agenda item notes",
|
||||
"✓ Outcome",
|
||||
"Task", "MEET-1", "Outcome WP", " (In Progress)",
|
||||
|
||||
"1", # Page number
|
||||
export_time_formatted,
|
||||
project.name
|
||||
].join(" ")
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a hidden work package outcome" do
|
||||
|
||||
@@ -258,6 +258,50 @@ RSpec.describe Meetings::PDF::Minutes::Exporter do
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
|
||||
context "with semantic work package identifiers",
|
||||
with_settings: { work_packages_identifier: "semantic" } do
|
||||
let(:options) do
|
||||
default_options.merge(
|
||||
{
|
||||
first_page_header_left: "",
|
||||
outcomes: "0",
|
||||
author: ""
|
||||
}
|
||||
)
|
||||
end
|
||||
let(:wp_agenda_item) do
|
||||
create(:wp_meeting_agenda_item,
|
||||
meeting:,
|
||||
meeting_section: meeting_section_second,
|
||||
work_package:,
|
||||
duration_in_minutes: 10,
|
||||
notes: "<mention class=\"mention\" data-id=\"#{work_package.id}\" data-type=\"work_package\" " \
|
||||
"data-text=\"##{work_package.id}\">##{work_package.id}</mention>")
|
||||
end
|
||||
|
||||
before do
|
||||
work_package.update_columns(identifier: "MEET-1", sequence_number: 1)
|
||||
end
|
||||
|
||||
it "renders the semantic identifier for the agenda item and the mention in its notes" do
|
||||
expected_document = [
|
||||
meeting.title,
|
||||
*meeting_info,
|
||||
"1. Untitled section", " ", "15 mins",
|
||||
"1.1. Agenda Item TOP 1",
|
||||
"foo",
|
||||
|
||||
"2. Second section", " ", "10 mins",
|
||||
"2.1. Task", "MEET-1", "Important task", " (Workin' on it)",
|
||||
"MEET-1",
|
||||
|
||||
*expected_footer
|
||||
].join(" ")
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a meeting with special work package agenda item" do
|
||||
@@ -352,6 +396,29 @@ RSpec.describe Meetings::PDF::Minutes::Exporter do
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
|
||||
context "with semantic work package identifiers",
|
||||
with_settings: { work_packages_identifier: "semantic" } do
|
||||
before do
|
||||
outcome_work_package.update_columns(identifier: "MEET-1", sequence_number: 1)
|
||||
end
|
||||
|
||||
it "renders the work package outcome with the semantic identifier" do
|
||||
expected_document = [
|
||||
meeting.title,
|
||||
*meeting_info,
|
||||
*meeting_info_custom,
|
||||
"1. Section with outcomes", " ", "15 mins",
|
||||
"1.1. Agenda Item",
|
||||
"Agenda item notes",
|
||||
"✓ Outcome",
|
||||
"Task", "MEET-1", "Outcome WP", " (In Progress)",
|
||||
*expected_header_footer
|
||||
].join(" ")
|
||||
|
||||
expect(subject).to eq expected_document
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with a hidden work package outcome" do
|
||||
|
||||
Reference in New Issue
Block a user