Merge pull request #5893 from ivanscinote/SCI-8925-show-paragraphs-checklist

Show paragraphs for checklist items in print protocol and pdf/docx [SCI-8925]
This commit is contained in:
artoscinote 2023-08-21 09:19:10 +02:00 committed by GitHub
commit 28fe2b8a60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 16 deletions

View file

@ -81,11 +81,18 @@ hr {
}
.print-checklist-item {
display: flex;
margin-bottom: 1em;
span {
vertical-align: top;
}
div {
margin-bottom: .7em;
margin-left: .7em;
white-space: pre-line;
}
}
.checklist-checkbox {

View file

@ -535,6 +535,23 @@ label {
padding-top: 0;
}
.report-checklist-item {
-webkit-box-pack: start; // for wkhtmltopdf compatibility
display: -webkit-box; // for wkhtmltopdf compatibility
display: flex;
justify-content: start;
margin-top: .5em;
div:nth-child(2) {
margin-top: .2em;
}
> div {
margin-left: .7em;
white-space: pre-wrap;
}
}
&:hover > .report-element-header .checklist-name {
color: $brand-primary;
}

View file

@ -23,7 +23,16 @@ module Reports::Docx::DrawStepChecklist
@docx.ul do
items.each do |item|
li do
text SmartAnnotations::TagToText.new(user, team, item.text).text
lines = SmartAnnotations::TagToText.new(user, team, item.text).text.split("\n")
lines.each_with_index do |line, index|
# Add the text line
text line
# If this isn't the last line in the array, start a new paragraph for the next line
br if index < lines.length - 1
end
text " (#{I18n.t('projects.reports.elements.step_checklist.checked')})", color: '2dbe61' if item.checked
end
end

View file

@ -68,8 +68,8 @@
<% else %>
<span class="checklist-checkbox not-checked"></span>
<% end %>
<%= smart_annotation_parser(checklist_item.text, current_team).html_safe %>
</span>
<div><%= smart_annotation_parser(checklist_item.text, current_team).html_safe %></div> <%# Should stay in one line %>
</div>
<% end %>
</div>

View file

@ -14,20 +14,17 @@
</div>
</div>
<div class="report-element-body">
<ul class="no-style">
<% items.each do |item| %>
<li>
<input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/>
<span class="<%= 'checked' if item.checked %>">
<%= custom_auto_link(item.text,
team: current_team,
simple_format: true,
wrapper_tag: { wrapper_tag: 'span'},
base64_encoded_imgs: export_all) %>
</span>
</li>
<% end %>
</ul>
<% items.each do |item| %>
<div class="report-checklist-item">
<div><input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/></div>
<div class="report-checklist-item-text"><%= custom_auto_link(item.text, # Must be on one line
team: current_team,
simple_format: false,
wrapper_tag: { wrapper_tag: 'span'},
base64_encoded_imgs: export_all) %>
</div>
</div>
<% end %>
</div>
<% if defined?(children) %>
<div class="report-element-children">