Module: C80Yax::Strsubcats::PropsHelper

Defined in:
app/helpers/c80_yax/strsubcats/props_helper.rb

Overview

noinspection ALL

Instance Method Summary collapse

Instance Method Details

#all_props_list(strsubcat) ⇒ Object

выдать html unordered list всех характеристик, которыми описывается подкатегория



24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 24

def all_props_list(strsubcat)
  res = '-'
  if strsubcat.prop_names.count > 0
    res = ''
    strsubcat.prop_names.each do |prop_name|
      res += "#{title_with_uom(prop_name)}<br>"
    end
  end
  res.html_safe
end

#cat_admin_title(strsubcat) ⇒ Object

выдать название родительской категории в виде active_admin-ссылки



12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 12

def cat_admin_title(strsubcat)
  str = '-'
  if strsubcat.cats.count > 0
    c = strsubcat.cats.first
    t = c.title
    slug = c.slug
    str = "<a href='/admin/cats/#{slug}' title='#{t}'>#{t}</a>"
  end
  str.html_safe
end

#common_props_list(strsubcat) ⇒ Object

выдать html unordered list of ‘common props’



58
59
60
61
62
63
64
65
66
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 58

def common_props_list(strsubcat)
  res = ''
  C80Yax::CommonProp.select_props_sql(strsubcat.id).each do |el|
    s = el[3]
    s += pretty_uom_print_title(el[4]) unless el[4].nil?
    res += "#{s}<br>"
  end
  res.html_safe
end

#main_props_list(strsubcat) ⇒ Object

выдать html unordered list of ‘main props’



36
37
38
39
40
41
42
43
44
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 36

def main_props_list(strsubcat)
  res = ''
  C80Yax::MainProp.select_props_sql(strsubcat.id).each do |el|
    s = el[3]
    s += pretty_uom_print_title(el[4]) unless el[4].nil?
    res += "#{s}<br>"
  end
  res.html_safe
end

#prefix_props_list(strsubcat) ⇒ Object

выдать html unordered list of ‘common props’



69
70
71
72
73
74
75
76
77
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 69

def prefix_props_list(strsubcat)
  res = ''
  C80Yax::PrefixProp.select_props_sql(strsubcat.id).each do |el|
    s = el[3]
    s += pretty_uom_print_title(el[4]) unless el[4].nil?
    res += "#{s}<br>"
  end
  res.html_safe
end

#price_props_list(strsubcat) ⇒ Object

выдать html unordered list of ‘price props’



47
48
49
50
51
52
53
54
55
# File 'app/helpers/c80_yax/strsubcats/props_helper.rb', line 47

def price_props_list(strsubcat)
  res = ''
  C80Yax::PriceProp.select_props_sql(strsubcat.id).each do |el|
    s = el[2]
    s += pretty_uom_print_title(el[3]) unless el[3].nil?
    res += "#{s}<br>"
  end
  res.html_safe
end