module C80Push
module AdminHelper
# noinspection RubyResolve
def first_region(subj)
res = '-'
unless subj.regions.count.zero?
res = subj.regions.first.title
end
res.html_safe
end
# noinspection RubyResolve
def ul_offices(subj)
res = '-'
unless subj.offices.count.zero?
res = ''
subj.offices.each do |office|
e = "
#{office.title}"
res += e
end
res = "".html_safe
end
res
end
# noinspection RubyResolve
def ul_dealers(subj)
res = '-'
unless subj.dealers.count.zero?
res = ''
subj.dealers.each do |dealer|
e = "#{dealer.title}"
res += e
end
res = "".html_safe
end
res
end
def dealer_col_title(dealer)
res = "#{dealer.title}"
res += "
email: #{format_val(dealer.email)}"
res += "
site: #{format_val(dealer.site)}"
res += "
цвет: #{format_dealer_preset_val(dealer)}"
res.html_safe
end
# private
def format_val(val)
res = '-'
unless val.blank?
res = val
end
"#{res}".html_safe
end
def format_dealer_preset_val(dealer)
res = '-'
if dealer.presets.count > 0
p = dealer.presets.first
res = format_preset_val(p)
end
res.html_safe
end
def format_preset_val(preset)
""
end
end
end