Se eliminan las etiquetas HTML en la impresión a texto y se ajusta el formato de impresión

This commit is contained in:
Manuel Cillero 2018-12-10 00:01:46 +01:00
parent b9ba4eb28f
commit 494983367c
4 changed files with 49 additions and 2 deletions

View file

@ -42,6 +42,8 @@ class WikiController < ApplicationController
helper :watchers
include Redmine::Export::PDF
include ActionView::Helpers::SanitizeHelper
# List of pages, sorted alphabetically and by parent (hierarchy)
def index
load_pages_for_index
@ -107,7 +109,7 @@ class WikiController < ApplicationController
send_data(export, :type => 'text/html', :filename => filename_for_content_disposition("#{@page.title}.html"))
return
elsif params[:format] == 'txt'
send_data(@content.text, :type => 'text/plain', :filename => filename_for_content_disposition("#{@page.title}.txt"))
send_data(strip_tags(@content.text), :type => 'text/plain', :filename => filename_for_content_disposition("#{@page.title}.txt"))
return
end
end

View file

@ -47,7 +47,7 @@
<%= render(:partial => "wiki/content", :locals => {:content => @content}) %>
<% if @page.attachments.length > 0 || (@editable && authorize_for('wiki', 'add_attachment')) %>
<fieldset class="collapsible collapsed">
<fieldset class="collapsible collapsed<% if @page.attachments.length == 0 %> hide-when-print<% end %>">
<legend onclick="toggleFieldset(this);"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend>
<div style="display: none;">

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -27,6 +27,7 @@
* 21. OBJECTS
* 22. RESPONSIVE
* 23. SELECT2
* 24. PRINTING
*
* Based on Circle Theme by Kirill Bezrukov.
*/
@ -706,6 +707,7 @@ body.action-login #content {
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
min-height: 525px;
padding: 6em 2.35em;
}
#login-form {
@ -1577,3 +1579,46 @@ div.details { padding: 20px !important; }
border: 1px solid #2996cc;
border-radius: 3px;
}
/**********************************************************/
/* 24. PRINTING */
/**********************************************************/
@media print {
@page {
size: A4;
margin: 1cm;
}
html, body {
margin: 0;
padding: 0;
background: #fff;
-webkit-print-color-adjust: exact;
}
table tr td,
table tr th {
page-break-inside: avoid;
}
#wrapper3,
#main,
#header {
background: #fff;
}
#header {
display: block;
}
#header h1 {
color: #3d454c;
padding-left: 0;
}
#wrapper-header {
background: url(../images/logo_print.png) no-repeat 0 0;
}
#quick-search {
display: none;
}
div#content {
width: 100%;
padding: 0;
}
}