Skip to content

Commit 51c0700

Browse files
authored
Migrate initiatives print to HexaPDF (decidim#13677)
1 parent 70fc90e commit 51c0700

File tree

10 files changed

+196
-357
lines changed

10 files changed

+196
-357
lines changed

decidim-initiatives/app/controllers/decidim/initiatives/initiatives_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def update
108108

109109
def print
110110
enforce_permission_to :print, :initiative, initiative: current_initiative
111+
output = Decidim::Initiatives::ApplicationFormPDF.new(current_initiative).render
112+
send_data(output, filename: "initiative_submit_#{current_initiative.id}.pdf", type: "application/pdf")
111113
end
112114

113115
private

decidim-initiatives/app/packs/entrypoints/decidim_initiatives_print.js

-1
This file was deleted.

decidim-initiatives/app/packs/entrypoints/decidim_initiatives_print.scss

-1
This file was deleted.

decidim-initiatives/app/packs/stylesheets/decidim/initiatives/print-initiative.scss

-172
This file was deleted.

decidim-initiatives/app/views/decidim/initiatives/initiatives/print.html.erb

-161
This file was deleted.

decidim-initiatives/config/assets.rb

-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
Decidim::Webpacker.register_entrypoints(
77
decidim_initiatives: "#{base_path}/app/packs/entrypoints/decidim_initiatives.js",
88
decidim_initiatives_admin: "#{base_path}/app/packs/entrypoints/decidim_initiatives_admin.js",
9-
decidim_initiatives_print: "#{base_path}/app/packs/entrypoints/decidim_initiatives_print.js",
109
decidim_initiatives_initiatives_votes: "#{base_path}/app/packs/entrypoints/decidim_initiatives_initiatives_votes.js"
1110
)

decidim-initiatives/config/locales/en.yml

-2
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,7 @@ en:
533533
phone_number: Phone Number
534534
place_date: Place, Date
535535
postal_code: Postal Code/ZIP
536-
print: Print
537536
province: Province/State
538-
section: 'If requested by the organization, please print and fill out this form to submit where indicated:'
539537
signature: Signature
540538
result:
541539
answer_title: This initiative has been answered.

decidim-initiatives/lib/decidim/initiatives.rb

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
module Decidim
1010
# Base module for the initiatives engine.
1111
module Initiatives
12+
autoload :ApplicationFormPDF, "decidim/initiatives/application_form_pdf"
13+
1214
include ActiveSupport::Configurable
1315

1416
# Public setting that defines whether creation is allowed to any validated

0 commit comments

Comments
 (0)