Re-display images & checkboxes in PDF reports

Closes SCI-953.
This commit is contained in:
Luka Murn 2017-01-26 10:46:58 +01:00
parent 042a85af45
commit 0baaf12de3
2 changed files with 9 additions and 4 deletions

View file

@ -1,9 +1,13 @@
module InputSanitizeHelper
def sanitize_input(text)
def sanitize_input(
text,
tags = [],
attributes = []
)
ActionController::Base.helpers.sanitize(
text,
tags: Constants::WHITELISTED_TAGS,
attributes: Constants::WHITELISTED_ATTRIBUTES
tags: Constants::WHITELISTED_TAGS + tags,
attributes: Constants::WHITELISTED_ATTRIBUTES + attributes
)
end

View file

@ -9,7 +9,8 @@
</head>
<body class="print-report-body">
<div class="print-report">
<%= sanitize_input(@html) %>
<% # Also whitelist <img> and <input type="checkbox"> tags %>
<%= sanitize_input(@html, ['img', 'input'], ['type', 'disabled', 'checked']) %>
</div>
</body>
</html>