ManageIQ/manageiq-ui-classic

View on GitHub
app/views/layouts/print.html.haml

Summary

Maintainability
Test Coverage
= render :partial => 'layouts/doctype'
%html
  %head
    %title= @options[:title]
    = miq_favicon_link_tag
    = javascript_essential_dependencies
    = javascript_pack_tag 'manageiq-ui-classic/print.js'
    -# Mock the gettext calls in javascript
    :javascript
      window.__ = function (data) { return data };
    = javascript_dependencies
    %style
      @media all { @page { size: #{pdf_page_size_style}; } }
  %body
    %h1.center=@options[:title]
    = yield
    .center=@options[:run_date]

    -# Opening the browser's printing dialog
    :javascript
      document.addEventListener('DOMContentLoaded', function() {
        window.setTimeout(function() {
          window.print();
        });
      });

      window.onafterprint = function() {
        window.close();
      };