diff --git a/app/assets/stylesheets/_employees.scss b/app/assets/stylesheets/_employees.scss index 73b6f6a1..e843ebf8 100644 --- a/app/assets/stylesheets/_employees.scss +++ b/app/assets/stylesheets/_employees.scss @@ -6,12 +6,8 @@ .master-data-vcard-qrcode { display: block; - width: 100px; + width: 200px; padding-bottom: 1em; - - @media (min-width: $screen-md-min) { - padding-top: 20px; - } } .employee-positions { diff --git a/app/controllers/employee_master_data_controller.rb b/app/controllers/employee_master_data_controller.rb index 550605d7..491a9a6d 100644 --- a/app/controllers/employee_master_data_controller.rb +++ b/app/controllers/employee_master_data_controller.rb @@ -39,7 +39,7 @@ def show respond_to do |format| format.html - format.vcf { render plain: vcard } + format.vcf { send_data vcard, filename: vcard_filename } format.svg { render plain: qr_code.as_svg(fill: 'fff') } format.png { render plain: qr_code.as_png(fill: 'fff') } end @@ -107,6 +107,10 @@ def vcard(include: nil) Employees::Vcard.new(@employee, include:).render end + def vcard_filename + ActiveStorage::Filename.new("#{@employee.to_s}.vcf").sanitized + end + def qr_code vcf = vcard(include: %i[firstname lastname fullname phone_office phone_private email]) RQRCode::QRCode.new(vcf) diff --git a/app/views/employee_master_data/_attrs.html.haml b/app/views/employee_master_data/_attrs.html.haml index e11a9a71..7f94514a 100644 --- a/app/views/employee_master_data/_attrs.html.haml +++ b/app/views/employee_master_data/_attrs.html.haml @@ -33,7 +33,7 @@ = link_to @employee.email, "mailto:#{@employee.email}" .col-md-6 = link_to({format: :png}, target: :_blank) do - = image_tag('qr-code-scan-icon.svg', class: 'qr-code master-data-vcard-qrcode') + %img.qr-code.master-data-vcard-qrcode{src: employee_master_datum_url(id: @employee.id, format: :svg) } = link_to format: :vcf do vCard herunterladen