From: Jean-Philippe Lang Date: Thu, 10 Jul 2008 16:23:42 +0000 (+0000) Subject: Do not use partial in PDF templates (not supported when using rfpdf with Rails 2... X-Git-Tag: 0.8.0-RC1~365 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ff53f97eecbe1f63b226dd3ea2666343316ce6a;p=redmine.git Do not use partial in PDF templates (not supported when using rfpdf with Rails 2.1) (#1619). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1651 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/issues/_pdf.rfpdf b/app/views/issues/_pdf.rfpdf deleted file mode 100644 index 6830506f6..000000000 --- a/app/views/issues/_pdf.rfpdf +++ /dev/null @@ -1,118 +0,0 @@ -<% pdf.SetFontStyle('B',11) - pdf.Cell(190,10, "#{issue.project.name} - #{issue.tracker.name} # #{issue.id}: #{issue.subject}") - pdf.Ln - - y0 = pdf.GetY - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_status) + ":","LT") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, issue.status.name,"RT") - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_priority) + ":","LT") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, issue.priority.name,"RT") - pdf.Ln - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_author) + ":","L") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, issue.author.name,"R") - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_category) + ":","L") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, (issue.category ? issue.category.name : "-"),"R") - pdf.Ln - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_created_on) + ":","L") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, format_date(issue.created_on),"R") - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_assigned_to) + ":","L") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, (issue.assigned_to ? issue.assigned_to.name : "-"),"R") - pdf.Ln - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_updated_on) + ":","LB") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, format_date(issue.updated_on),"RB") - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_due_date) + ":","LB") - pdf.SetFontStyle('',9) - pdf.Cell(60,5, format_date(issue.due_date),"RB") - pdf.Ln - - for custom_value in issue.custom_values - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, custom_value.custom_field.name + ":","L") - pdf.SetFontStyle('',9) - pdf.MultiCell(155,5, (show_value custom_value),"R") - end - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_subject) + ":","LTB") - pdf.SetFontStyle('',9) - pdf.Cell(155,5, issue.subject,"RTB") - pdf.Ln - - pdf.SetFontStyle('B',9) - pdf.Cell(35,5, l(:field_description) + ":") - pdf.SetFontStyle('',9) - pdf.MultiCell(155,5, issue.description,"BR") - - pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) - pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY) - - pdf.Ln - - if @issue.changesets.any? && User.current.allowed_to?(:view_changesets, issue.project) - pdf.SetFontStyle('B',9) - pdf.Cell(190,5, l(:label_associated_revisions), "B") - pdf.Ln - for changeset in @issue.changesets - pdf.SetFontStyle('B',8) - pdf.Cell(190,5, format_time(changeset.committed_on) + " - " + changeset.committer) - pdf.Ln - unless changeset.comments.blank? - pdf.SetFontStyle('',8) - pdf.MultiCell(190,5, changeset.comments) - end - pdf.Ln - end - end - - pdf.SetFontStyle('B',9) - pdf.Cell(190,5, l(:label_history), "B") - pdf.Ln - for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") - pdf.SetFontStyle('B',8) - pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) - pdf.Ln - pdf.SetFontStyle('I',8) - for detail in journal.details - pdf.Cell(190,5, "- " + show_detail(detail, true)) - pdf.Ln - end - if journal.notes? - pdf.SetFontStyle('',8) - pdf.MultiCell(190,5, journal.notes) - end - pdf.Ln - end - - if issue.attachments.any? - pdf.SetFontStyle('B',9) - pdf.Cell(190,5, l(:label_attachment_plural), "B") - pdf.Ln - for attachment in issue.attachments - pdf.SetFontStyle('',8) - pdf.Cell(80,5, attachment.filename) - pdf.Cell(20,5, number_to_human_size(attachment.filesize),0,0,"R") - pdf.Cell(25,5, format_date(attachment.created_on),0,0,"R") - pdf.Cell(65,5, attachment.author.name,0,0,"R") - pdf.Ln - end - end -%> diff --git a/app/views/issues/show.rfpdf b/app/views/issues/show.rfpdf index 08f2cb92d..73d9d66b5 100644 --- a/app/views/issues/show.rfpdf +++ b/app/views/issues/show.rfpdf @@ -4,7 +4,123 @@ pdf.footer_date = format_date(Date.today) pdf.AddPage - render :partial => 'issues/pdf', :locals => { :pdf => pdf, :issue => @issue } + pdf.SetFontStyle('B',11) + pdf.Cell(190,10, "#{@issue.project} - #{@issue.tracker} # #{@issue.id}: #{@issue.subject}") + pdf.Ln + + y0 = pdf.GetY + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_status) + ":","LT") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, @issue.status.name,"RT") + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_priority) + ":","LT") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, @issue.priority.name,"RT") + pdf.Ln + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_author) + ":","L") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, @issue.author.name,"R") + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_category) + ":","L") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, (@issue.category ? @issue.category.name : "-"),"R") + pdf.Ln + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_created_on) + ":","L") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, format_date(@issue.created_on),"R") + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_assigned_to) + ":","L") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, (@issue.assigned_to ? @issue.assigned_to.name : "-"),"R") + pdf.Ln + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_updated_on) + ":","LB") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, format_date(@issue.updated_on),"RB") + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_due_date) + ":","LB") + pdf.SetFontStyle('',9) + pdf.Cell(60,5, format_date(@issue.due_date),"RB") + pdf.Ln + + for custom_value in @issue.custom_values + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, custom_value.custom_field.name + ":","L") + pdf.SetFontStyle('',9) + pdf.MultiCell(155,5, (show_value custom_value),"R") + end + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_subject) + ":","LTB") + pdf.SetFontStyle('',9) + pdf.Cell(155,5, @issue.subject,"RTB") + pdf.Ln + + pdf.SetFontStyle('B',9) + pdf.Cell(35,5, l(:field_description) + ":") + pdf.SetFontStyle('',9) + pdf.MultiCell(155,5, @issue.description,"BR") + + pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) + pdf.Line(pdf.GetX, pdf.GetY, 170, pdf.GetY) + + pdf.Ln + + if @issue.changesets.any? && User.current.allowed_to?(:view_changesets, @issue.project) + pdf.SetFontStyle('B',9) + pdf.Cell(190,5, l(:label_associated_revisions), "B") + pdf.Ln + for changeset in @issue.changesets + pdf.SetFontStyle('B',8) + pdf.Cell(190,5, format_time(changeset.committed_on) + " - " + changeset.committer) + pdf.Ln + unless changeset.comments.blank? + pdf.SetFontStyle('',8) + pdf.MultiCell(190,5, changeset.comments) + end + pdf.Ln + end + end + + pdf.SetFontStyle('B',9) + pdf.Cell(190,5, l(:label_history), "B") + pdf.Ln + for journal in @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") + pdf.SetFontStyle('B',8) + pdf.Cell(190,5, format_time(journal.created_on) + " - " + journal.user.name) + pdf.Ln + pdf.SetFontStyle('I',8) + for detail in journal.details + pdf.Cell(190,5, "- " + show_detail(detail, true)) + pdf.Ln + end + if journal.notes? + pdf.SetFontStyle('',8) + pdf.MultiCell(190,5, journal.notes) + end + pdf.Ln + end + + if @issue.attachments.any? + pdf.SetFontStyle('B',9) + pdf.Cell(190,5, l(:label_attachment_plural), "B") + pdf.Ln + for attachment in @issue.attachments + pdf.SetFontStyle('',8) + pdf.Cell(80,5, attachment.filename) + pdf.Cell(20,5, number_to_human_size(attachment.filesize),0,0,"R") + pdf.Cell(25,5, format_date(attachment.created_on),0,0,"R") + pdf.Cell(65,5, attachment.author.name,0,0,"R") + pdf.Ln + end + end %> <%= pdf.Output %>