From 3e3ed87b188e83832ff0db5e8f4a8b8579c5a758 Mon Sep 17 00:00:00 2001 From: Pfingstfrosch Date: Thu, 4 Jun 2020 19:24:45 +0200 Subject: [PATCH] Introduce and use print.css --- app/assets/stylesheets/print.css | 17 +++++++++++++++++ app/views/favorites/_nav.html.erb | 4 +++- app/views/layouts/application.html.erb | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/assets/stylesheets/print.css diff --git a/app/assets/stylesheets/print.css b/app/assets/stylesheets/print.css new file mode 100644 index 0000000..7fada74 --- /dev/null +++ b/app/assets/stylesheets/print.css @@ -0,0 +1,17 @@ +@media print { + nav, input, button, .favNav { + display: none; + } + + @page { + size: A4; + } + + body { + counter-reset: chapternum figurenum; + font-family: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif; + line-height: 1.5; + font-size: 11pt; + } +} + diff --git a/app/views/favorites/_nav.html.erb b/app/views/favorites/_nav.html.erb index 00728b8..265a051 100644 --- a/app/views/favorites/_nav.html.erb +++ b/app/views/favorites/_nav.html.erb @@ -3,4 +3,6 @@ <%= link_to 'Courses', favorites_courses_url %> <%= link_to 'Theses', favorites_theses_url %> <%= link_to 'Projects', favorites_projects_url %> - \ No newline at end of file + + <%= link_to "Print", '#', onclick: "print()" %> + diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e48e0f0..37c8872 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,7 +5,9 @@ <%= csrf_meta_tags %> <%= csp_meta_tag %> + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'print', media: 'print' %> <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> @@ -43,4 +45,5 @@ +