Skip to content

Commit

Permalink
Add style to Fs::Messages HTML visualizations (to use same font as in…
Browse files Browse the repository at this point in the history
… the app)
  • Loading branch information
luciajanikova committed Oct 25, 2024
1 parent 63ce7b3 commit a5167d9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 31 deletions.
3 changes: 2 additions & 1 deletion app/helpers/fs/message_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def self.build_html_visualization_from_form(message)
return unless message.form_object&.unsigned_content

template = Nokogiri::XSLT(message.form.xslt_txt)
ActionController::Base.helpers.simple_format(template.transform(message.form_object.xml_unsigned_content).to_s)

ActionController::Base.new.render_to_string('fs/messages/_style', layout: false, locals: { message: message }) + ActionController::Base.helpers.simple_format(template.transform(message.form_object.xml_unsigned_content).to_s)
end
end
11 changes: 1 addition & 10 deletions app/views/fs/messages/_delivery_report.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<style>
th {
font-weight: normal;
text-align: left;
}

th, td {
padding: 0.25rem 2rem 0.25rem 0;
}
</style>
<%= render partial: "fs/messages/style" %>

<table class="min-w-full divide-y divide-gray-300">
<tbody class="divide-y divide-gray-200">
Expand Down
11 changes: 1 addition & 10 deletions app/views/fs/messages/_generic_message.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<style>
th {
font-weight: normal;
text-align: left;
}

th, td {
padding: 0.25rem 2rem 0.25rem 0;
}
</style>
<%= render partial: "fs/messages/style" %>

<table>
<tbody>
Expand Down
11 changes: 11 additions & 0 deletions app/views/fs/messages/_style.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<style>
th {
font-weight: normal;
text-align: left;
}

p, th, td {
padding: 0.25rem 2rem 0.25rem 0;
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
</style>
11 changes: 1 addition & 10 deletions app/views/fs/messages/_submission.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<style>
th {
font-weight: normal;
text-align: left;
}

th, td {
padding: 0.25rem 2rem 0.25rem 0;
}
</style>
<%= render partial: "fs/messages/style" %>

<table>
<tbody>
Expand Down

0 comments on commit a5167d9

Please sign in to comment.