eBooru/app/helpers/note_versions_helper.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

25 lines
733 B
Ruby

# frozen_string_literal: true
module NoteVersionsHelper
def note_version_body_diff_info(note_version)
previous = note_version.previous
if note_version.body == previous&.body
tag.span("(body not changed)", class: "inactive")
else
""
end
end
def note_version_position_diff(note_version)
previous = note_version.previous
html = "#{note_version.width}x#{note_version.height} #{note_version.x},#{note_version.y}"
return html if previous.nil?
if note_version.x == previous.x && note_version.y == previous.y && note_version.width == previous.width && note_version.height == previous.height
html
else
tag.span(html, style: "text-decoration: underline;")
end
end
end