app/helpers/agilibox/text_helper.rb in agilibox-1.5.13 vs app/helpers/agilibox/text_helper.rb in agilibox-1.6.0
- old
+ new
@@ -3,11 +3,11 @@
include ::ActionView::Helpers::SanitizeHelper
include ::ActionView::Helpers::TextHelper
def nbsp(text = :no_argument)
if text == :no_argument
- " "
+ "\u00A0"
else
text.to_s.gsub(" ", nbsp)
end
end
@@ -19,17 +19,17 @@
return if n.nil?
I18n.t("number.currency.format.format")
.gsub("%n", number(n))
.gsub("%u", u)
- .tr(" ", "\u00A0")
+ .tr(" ", nbsp)
end
def percentage(n)
return if n.nil?
- (number(n) + " %").tr(" ", "\u00A0")
+ number(n) + nbsp + "%"
end
def number(n)
return if n.nil?
@@ -42,11 +42,11 @@
end
opts[:delimiter] = I18n.t("number.format.delimiter")
opts[:separator] = I18n.t("number.format.separator")
- number_with_precision(n, opts).tr(" ", "\u00A0")
+ number_with_precision(n, opts).tr(" ", nbsp)
end
def date(d, *args)
I18n.l(d, *args) unless d.nil?
end
@@ -99,9 +99,10 @@
end
label = options[:label] || object.t(attribute)
tag = options[:tag] || :div
separator = options[:separator] || " : "
+ separator = " :<br/>".html_safe if separator == :br
helper = options[:helper]
i18n_key = "#{object.class.to_s.tableize.singularize}/#{attribute}"
nested = I18n.t("activerecord.attributes.#{i18n_key}", default: "").is_a?(Hash)
klass = object.is_a?(Module) ? object : object.class
object_type = klass.to_s.split("::").last.underscore