Commit dbdd8f88 authored by Jiri Strojil's avatar Jiri Strojil

Merge branch 'fix/pdf-layout-fixes' into 'develop'

Adjusted PDF styles

See merge request !1004
parents cc379f1d 161b0b36
Pipeline #63974 passed with stage
in 36 minutes and 21 seconds
......@@ -18,7 +18,17 @@
body {
&.pdf {
.container {
padding-left: $container-sm / 12;
padding-left: 3.2cm;
}
.header {
padding-top: 1.4cm;
padding-left: 1.5cm;
padding-bottom: 1.6cm;
}
.col-input, .col-label {
font-size: 12px;
}
.col-xs-6 {
......@@ -118,3 +128,13 @@ body {
overflow: hidden;
height: 60px;
}
.row-no-top-padding {
padding-top: 0;
margin-top: 0;
}
.row-no-bottom-padding {
padding-bottom: 0 !important;
margin-bottom: 0 !important;
}
\ No newline at end of file
......@@ -19,9 +19,10 @@ module PdfHelpers
filename: pdf_file_name(record)
end
# currently only used for assignments
def save_with_pdf(record, action = 'show.html', options = {})
{ layout: 'pdf_layout.pdf.slim', zoom: 1.15,
dpi: 600, margin: { top: 10, bottom: 10, left: 0, right: 0 }
{ layout: 'assignments.pdf.slim', zoom: 1.15,
dpi: 600, margin: { top: 0, bottom: 10, left: 0, right: 14 },
}.each do |k,v|
next if options.key?(k)
options[k] = v
......
......@@ -5,63 +5,63 @@ h4.m-b-10= t('assignment_pdf.volunteer_title')
.row.m-b-10
.col-xs-6
.row
.col-xs-3= t('assignment_pdf.last_name')
.col-xs-3.col-label= t('assignment_pdf.last_name')
.col-xs-7.col-input= @assignment.volunteer.contact.last_name
.col-xs-3= t('assignment_pdf.street')
.col-xs-3.col-label= t('assignment_pdf.street')
.col-xs-7.col-input= @assignment.volunteer.contact.street
.col-xs-3= t('assignment_pdf.telephone')
.col-xs-3.col-label= t('assignment_pdf.telephone')
.col-xs-7.col-input= @assignment.volunteer.contact.primary_phone
.col-xs-3= t('assignment_pdf.email')
.col-xs-3.col-label= t('assignment_pdf.email')
.col-xs-7.col-input= @assignment.volunteer.contact.primary_email
.col-xs-6
.row
.col-xs-5= t('assignment_pdf.first_name')
.col-xs-5.col-label= t('assignment_pdf.first_name')
.col-xs-7.col-input= @assignment.volunteer.contact.first_name
.col-xs-5 #{t('assignment_pdf.postal_code')} / #{t('assignment_pdf.city')}
.col-xs-5.col-label #{t('assignment_pdf.postal_code')} / #{t('assignment_pdf.city')}
.col-xs-7.col-input= @assignment.volunteer.contact.full_city
.col-xs-5= t('assignment_pdf.birth_year')
.col-xs-5.col-label= t('assignment_pdf.birth_year')
.col-xs-7.col-input= @assignment.volunteer.birth_year.try(:year)
h4.m-b-10= t('assignment_pdf.client_title')
.row.m-b-10
.col-xs-6
.row
.col-xs-3= t('assignment_pdf.last_name')
.col-xs-3.col-label= t('assignment_pdf.last_name')
.col-xs-7.col-input= @assignment.client.contact.last_name
.col-xs-3= t('assignment_pdf.street')
.col-xs-3.col-label= t('assignment_pdf.street')
.col-xs-7.col-input= @assignment.client.contact.street
.col-xs-3= t('assignment_pdf.telephone')
.col-xs-3.col-label= t('assignment_pdf.telephone')
.col-xs-7.col-input= @assignment.client.contact.primary_phone
.col-xs-3= t('assignment_pdf.email')
.col-xs-3.col-label= t('assignment_pdf.email')
.col-xs-7.col-input= @assignment.client.contact.primary_email
.col-xs-3= t('assignment_pdf.birth_year')
.col-xs-3.col-label= t('assignment_pdf.birth_year')
.col-xs-7.col-input= @assignment.client.birth_year.try(:year)
.col-xs-6
.row
.col-xs-5= t('assignment_pdf.first_name')
.col-xs-5.col-label= t('assignment_pdf.first_name')
.col-xs-7.col-input= @assignment.client.contact.first_name
.col-xs-5 #{t('assignment_pdf.postal_code')} / #{t('assignment_pdf.city')}
.col-xs-5.col-label #{t('assignment_pdf.postal_code')} / #{t('assignment_pdf.city')}
.col-xs-7.col-input #{@assignment.client.contact.postal_code} #{@assignment.client.contact.city}
.col-xs-5= t('assignment_pdf.telephone_2')
.col-xs-5.col-label= t('assignment_pdf.telephone_2')
.col-xs-7.col-input= @assignment.client.contact.secondary_phone
.col-xs-5 #{t('assignment_pdf.nationality')}, #{t('assignment_pdf.state')}
.col-xs-5.col-label #{t('assignment_pdf.nationality')}, #{t('assignment_pdf.state')}
.col-xs-7.col-input
= [nationality_name(@assignment.client.nationality), @assignment.client.permit].compact.reject(&:empty?).join(', ')
.col-xs-5= t('assignment_pdf.languages')
.col-xs-5.col-label= t('assignment_pdf.languages')
.col-xs-7.col-input
- @assignment.client.language_skills.each do |language|
= "#{language.language_name} "
......@@ -69,17 +69,17 @@ h4.m-b-10= t('assignment_pdf.client_title')
.row-box
.col-xs-12
.row
.col-xs-4= t('assignment_pdf.assignment_description')
.col-xs-4.col-label= t('assignment_pdf.assignment_description')
.col-xs-8.col-input = @assignment.assignment_description
.col-xs-4= t('assignment_pdf.frequency')
.col-xs-4.col-label= t('assignment_pdf.frequency')
.col-xs-8.col-input= @assignment.frequency
.col-xs-4= t('assignment_pdf.first_time')
.col-xs-4.col-label= t('assignment_pdf.first_time')
.col-xs-8.col-input= @assignment.first_meeting
.col-xs-4= t('assignment_pdf.trial_time')
.col-xs-4.col-label= t('assignment_pdf.trial_time')
.col-xs-8.col-input= @assignment.trial_period_end
.col-xs-4= t('assignment_pdf.duration')
.col-xs-4.col-label= t('assignment_pdf.duration')
.col-xs-8.col-input= @assignment.duration
.col-xs-4= t('assignment_pdf.special')
.col-xs-4.col-label= t('assignment_pdf.special')
.col-xs-8.col-input= @assignment.special_agreement
h4.m-b-10.m-t-20= t('assignment_pdf.creator_title')
......@@ -87,23 +87,23 @@ h4.m-b-10.m-t-20= t('assignment_pdf.creator_title')
.row.m-b-10
.col-xs-6
.row
.col-xs-3= t('assignment_pdf.last_name')
.col-xs-3.col-label= t('assignment_pdf.last_name')
.col-xs-9.col-input= @assignment.involved_authority_contact.last_name
.row
.col-xs-3= t('assignment_pdf.function')
.col-xs-3.col-label= t('assignment_pdf.function')
.col-xs-9.col-input= @assignment.involved_authority.profession
.row
.col-xs-3= t('assignment_pdf.email')
.col-xs-3.col-label= t('assignment_pdf.email')
.col-xs-9.col-input= @assignment.involved_authority_contact.primary_email
.col-xs-6
.row
.col-xs-3= t('assignment_pdf.first_name')
.col-xs-3.col-label= t('assignment_pdf.first_name')
.col-xs-9.col-input= @assignment.involved_authority_contact.first_name
.row
.col-xs-3= t('assignment_pdf.organization')
.col-xs-3.col-label= t('assignment_pdf.organization')
.col-xs-9.col-input= @assignment.involved_authority_contact.full_address
.row
.col-xs-3= t('assignment_pdf.telephone')
.col-xs-3.col-label= t('assignment_pdf.telephone')
.col-xs-9.col-input= @assignment.involved_authority_contact.primary_phone
.row-box
......
doctype html
html.pdf-export-html
head
= csrf_meta_tags
= wicked_pdf_stylesheet_link_tag 'application'
= wicked_pdf_stylesheet_link_tag 'pdf_styles'
= wicked_pdf_javascript_include_tag 'application'
body.pdf
.header
.row.row-no-top-padding.row-no-bottom-padding
.col-xs-3
.pdf-logo-image
.logo-image = wicked_pdf_image_tag 'AOZ_Logo.svg'
.row.row-no-top-padding.row-no-bottom-padding
.col-xs-3
.col-xs-3
b= t('pdf_header.title').html_safe
.col-xs-3
- if controller_name == 'assignments'
= ContactHelper.address_for_pdf(@assignment&.creator.profile.contact).html_safe
- elsif controller_name == 'group_offers'
= ContactHelper.address_for_pdf(@group_offer&.creator.profile.contact).html_safe
- else
= t('pdf_header.address').html_safe
.col-xs-3
- if controller_name == 'assignments'
== t('pdf_header.contact', phone: @assignment&.creator.profile.contact.primary_phone, email: @assignment&.creator.profile.contact.primary_email)
- elsif controller_name == 'group_offers'
== t('pdf_header.contact', phone: @group_offer&.creator.profile.contact.primary_phone, email: @group_offer&.creator.profile.contact.primary_email)
- elsif controller_name == 'billing_expenses'
== t('pdf_header.contact', phone: @billing_expense&.user.profile.contact.primary_phone, email: 'freiwillige@aoz.ch')
- else
== t('pdf_header.contact', phone: '044 415 66 72', email: 'freiwillige@aoz.ch')
.container
= yield
......@@ -6,7 +6,7 @@ html.pdf-export-html
title= t('voluntary_platform')
= wicked_pdf_stylesheet_link_tag 'certificate_pdf'
= wicked_pdf_stylesheet_link_tag 'pdf_styles'
= wicked_pdf_javascript_include_tag 'application'
body.pdf-export
......
......@@ -3,7 +3,7 @@ html.pdf-export-html
head
= csrf_meta_tags
= wicked_pdf_stylesheet_link_tag 'application'
= wicked_pdf_stylesheet_link_tag 'certificate_pdf'
= wicked_pdf_stylesheet_link_tag 'pdf_styles'
= wicked_pdf_javascript_include_tag 'application'
body.pdf
.container
......
......@@ -11,4 +11,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
Rails.application.config.assets.precompile += ['pdf.css', 'certificate_pdf.css']
Rails.application.config.assets.precompile += ['pdf.css', 'pdf_styles.css']
......@@ -148,7 +148,7 @@ class AssignmentsTest < ApplicationSystemTestCase
visit client_path(client)
click_link 'Herunterladen'
pdf = load_pdf(page.body)
assert_equal 1, pdf.page_count
assert_equal 2, pdf.page_count
assert_match /#{assignment.client.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.volunteer.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.involved_authority_contact.primary_email}/, pdf.pages.first.text
......@@ -199,7 +199,7 @@ class AssignmentsTest < ApplicationSystemTestCase
visit client_path(client)
click_link 'Herunterladen'
pdf = load_pdf(page.body)
assert_equal 1, pdf.page_count
assert_equal 2, pdf.page_count
assert_match /#{assignment.client.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.volunteer.contact.primary_email}/, pdf.pages.first.text
assert_match /#{assignment.involved_authority_contact.primary_email}/, pdf.pages.first.text
......@@ -240,7 +240,7 @@ class AssignmentsTest < ApplicationSystemTestCase
click_on 'Herunterladen', match: :first
pdf = load_pdf(page.body)
assert_equal 1, pdf.page_count
assert_equal 2, pdf.page_count
assert_match(/Ort, Datum: +Zürich, #{I18n.l pdf_date.to_date}/, pdf.pages.first.text)
assert_match(/Wie oft\? +daily/, pdf.pages.first.text)
......
......@@ -35,7 +35,6 @@ class CertificatesTest < ApplicationSystemTestCase
assert page.has_text? I18n.l(@volunteer.certificates.first.created_at.to_date)
assert page.has_text? I18n.l(@volunteer.min_assignment_date)
assert page.has_text? I18n.l(@volunteer.max_assignment_date)
assert page.has_link? 'Ausdrucken'
end
test 'updating_certificate_with_custom_values' do
......
......@@ -299,7 +299,7 @@ class GroupOffersTest < ApplicationSystemTestCase
click_on 'Herunterladen', match: :first
pdf = load_pdf(page.body)
assert_equal 1, pdf.page_count
assert_equal 2, pdf.page_count
assert_match(/Ort, Datum: +Zürich, #{I18n.l pdf_date.to_date}/, pdf.pages.first.text)
assert_match(/Wie oft\? +daily/, pdf.pages.first.text)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment