orbit-basic/app/helpers/admin/user_helper.rb

17 lines
367 B
Ruby

module Admin::UserHelper
def show_user_attribute(object, key, locale = '')
attribute = object.attribute_values.detect {|av| av.key.to_s.eql?(key.to_s) || av[locale.to_s].eql?(locale.to_s) } rescue nil
if attribute
if locale.to_s.blank?
attribute['key']
else
attribute[locale.to_s]
end
else
''
end
end
end