5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 14:31:42 +00:00
panel/app/models/metadata_string.rb

25 lines
466 B
Ruby
Raw Normal View History

2019-08-06 17:54:17 +00:00
# frozen_string_literal: true
# Un campo de texto
class MetadataString < MetadataTemplate
# Una string vacía
def default_value
super || ''
2019-08-06 17:54:17 +00:00
end
2020-07-02 14:26:00 +00:00
def indexable?
2021-05-09 15:25:16 +00:00
true && !private?
end
2020-07-02 14:26:00 +00:00
private
# No se permite HTML en las strings
def sanitize(string)
return '' if string.blank?
sanitizer.sanitize(string.strip.unicode_normalize(:nfkc),
2020-07-02 14:26:00 +00:00
tags: [],
2020-11-16 16:17:23 +00:00
attributes: []).strip.html_safe
2020-07-02 14:26:00 +00:00
end
2019-08-06 17:54:17 +00:00
end