Merge pull request #454 from Ducz0r/lm-sci-953-fix

Re-display images & checkboxes in PDF reports [SCI-953]
This commit is contained in:
Luka Murn 2017-01-26 13:54:10 +01:00 committed by GitHub
commit 4deb472dc9
2 changed files with 9 additions and 4 deletions

View file

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

View file

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