mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 05:34:55 +08:00
Add flag to disable simple_format in custom_auto_link [SCI-940]
This commit is contained in:
parent
310d8c1920
commit
c55f3cb99c
7 changed files with 13 additions and 8 deletions
|
@ -130,7 +130,7 @@ class SampleDatatable < AjaxDatatablesRails::Base
|
||||||
# Add custom attributes
|
# Add custom attributes
|
||||||
record.sample_custom_fields.each do |scf|
|
record.sample_custom_fields.each do |scf|
|
||||||
sample[@cf_mappings[scf.custom_field_id]] =
|
sample[@cf_mappings[scf.custom_field_id]] =
|
||||||
custom_auto_link(scf.value, @organization)
|
custom_auto_link(scf.value, true, @organization)
|
||||||
end
|
end
|
||||||
sample
|
sample
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,9 +11,14 @@ module InputSanitizeHelper
|
||||||
ERB::Util.html_escape(text)
|
ERB::Util.html_escape(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
def custom_auto_link(text, org = nil)
|
def custom_auto_link(text, simple_format = true, org = nil)
|
||||||
|
text = if simple_format
|
||||||
|
simple_format(sanitize_input(text))
|
||||||
|
else
|
||||||
|
sanitize_input(text)
|
||||||
|
end
|
||||||
auto_link(
|
auto_link(
|
||||||
smart_annotation_parser(simple_format(sanitize_input(text)), org),
|
smart_annotation_parser(text, org),
|
||||||
link: :urls,
|
link: :urls,
|
||||||
sanitize: false,
|
sanitize: false,
|
||||||
html: { target: '_blank' }
|
html: { target: '_blank' }
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div class="report-element-body">
|
<div class="report-element-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 text-container ql-editor">
|
<div class="col-xs-12 text-container ql-editor">
|
||||||
<%= custom_auto_link(result_text.text) %>
|
<%= custom_auto_link(result_text.text, false) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<span class="glyphicon glyphicon-list"></span>
|
<span class="glyphicon glyphicon-list"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left checklist-name">
|
<div class="pull-left checklist-name">
|
||||||
<%= custom_auto_link(t 'projects.reports.elements.step_checklist.checklist_name', name: checklist.name) %>
|
<%= custom_auto_link(t('projects.reports.elements.step_checklist.checklist_name', name: checklist.name)) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="pull-left user-time">
|
<div class="pull-left user-time">
|
||||||
<%=t 'projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full) %>
|
<%=t 'projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full) %>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 ql-editor">
|
<div class="col-xs-12 ql-editor">
|
||||||
<% if strip_tags(step.description).present? %>
|
<% if strip_tags(step.description).present? %>
|
||||||
<%= custom_auto_link(step.description) %>
|
<%= custom_auto_link(step.description, false) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<em><%=t "projects.reports.elements.step.no_description" %></em>
|
<em><%=t "projects.reports.elements.step.no_description" %></em>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<div class="ql-editor">
|
<div class="ql-editor">
|
||||||
<%= custom_auto_link(result.result_text.text) %>
|
<%= custom_auto_link(result.result_text.text, false) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<em><%= t("protocols.steps.no_description") %></em>
|
<em><%= t("protocols.steps.no_description") %></em>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ql-editor">
|
<div class="ql-editor">
|
||||||
<%= custom_auto_link(step.description) %>
|
<%= custom_auto_link(step.description, false) %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue