Use <pre> tag for formatting

This commit is contained in:
2026-07-05 18:33:20 +02:00
parent 65e5643b13
commit d4be84875e
7 changed files with 13 additions and 8 deletions

View File

@@ -199,6 +199,10 @@ textarea:invalid {
border-color: var(--color-red); border-color: var(--color-red);
outline-color: var(--color-red); outline-color: var(--color-red);
} }
pre {
display: inline;
font: inherit;
}
/* `.button`: button-styled <a>, <button>, <input type=submit>. /* `.button`: button-styled <a>, <button>, <input type=submit>.
* `.link`: any other <a>. * `.link`: any other <a>.

View File

@@ -1,4 +1,6 @@
class ApplicationRecord < ActiveRecord::Base class ApplicationRecord < ActiveRecord::Base
include ActionView::Helpers::TagHelper
class << self class << self
# Cached attribute has non-user assignable value calculated from other # Cached attribute has non-user assignable value calculated from other
# attributes' values on create/update. This simplifies and speeds up # attributes' values on create/update. This simplifies and speeds up

View File

@@ -98,7 +98,7 @@ class Quantity < ApplicationRecord
} }
def to_s def to_s
name tag.pre name
end end
def to_s_with_depth def to_s_with_depth

View File

@@ -91,7 +91,7 @@ class Unit < ApplicationRecord
end end
def to_s def to_s
symbol tag.pre symbol
end end
def movable? def movable?

View File

@@ -4,7 +4,7 @@
<th><%= User.human_attribute_name(:email) %></th> <th><%= User.human_attribute_name(:email) %></th>
<th><%= User.human_attribute_name(:status) %></th> <th><%= User.human_attribute_name(:status) %></th>
<th><%= User.human_attribute_name(:confirmed_at) %></th> <th><%= User.human_attribute_name(:confirmed_at) %></th>
<th><%= User.human_attribute_name(:created_at) %>&nbsp;<sup>(UTC)</sup></th> <th><pre><%= User.human_attribute_name(:created_at) %> <sup>(UTC)</sup></pre></th>
<th><%= t :actions %></th> <th><%= t :actions %></th>
</tr> </tr>
</thead> </thead>
@@ -23,7 +23,7 @@
<% end %> <% end %>
</td> </td>
<td><%= svg_tag 'checkbox-marked-outline' if user.confirmed_at.present? %></td> <td><%= svg_tag 'checkbox-marked-outline' if user.confirmed_at.present? %></td>
<td><%= l user.created_at, format: :without_tz %></td> <td><pre><%= l user.created_at, format: :without_tz %></pre></td>
<td class="flex"> <td class="flex">
<% if allow_disguise?(user) %> <% if allow_disguise?(user) %>
<%= image_link_to t('.disguise'), 'incognito', disguise_user_path(user) %> <%= image_link_to t('.disguise'), 'incognito', disguise_user_path(user) %>

View File

@@ -1,9 +1,8 @@
en: en:
time: time:
formats: formats:
# Format contains non-breaking space: 160.chr(Encoding::UTF_8) default: "%Y-%m-%d %H:%M %Z"
default: "%Y-%m-%d %H:%M %Z" without_tz: "%Y-%m-%d %H:%M"
without_tz: "%Y-%m-%d %H:%M"
errors: errors:
messages: messages:
precision_exceeded: must not exceed %{value} significant digits precision_exceeded: must not exceed %{value} significant digits

View File

@@ -20,7 +20,7 @@ class Float
result += "&times;" if significand != '1' result += "&times;" if significand != '1'
result += "10<sup>% d</sup>" % exponent result += "10<sup>% d</sup>" % exponent
end end
result.html_safe "<pre>#{result}</pre>".html_safe
end end
# Assume #finite? is true. # Assume #finite? is true.