Class: ChiliPepper::MenuDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/chili_pepper/menu_decorator.rb

Instance Method Summary collapse

Instance Method Details

#display_availabilityObject



15
16
17
18
19
# File 'app/decorators/chili_pepper/menu_decorator.rb', line 15

def display_availability
  if availability?
    h.(:h2, h.markdown(availability), class: 'menu_availibilities')
  end
end

#display_descriptionObject



21
22
23
24
25
# File 'app/decorators/chili_pepper/menu_decorator.rb', line 21

def display_description
  if description?
    h.(:h3, h.markdown(description), class: 'menu_description')
  end
end

#display_priceObject



7
8
9
10
11
12
13
# File 'app/decorators/chili_pepper/menu_decorator.rb', line 7

def display_price
    if price?
      euro_sign = h.(:span, '', class: euro_sign)
      price_to_display = h.number_to_currency(price, unit: '')
      price_content = h.(:div, euro_sign + price_to_display, id: 'big_price')
  end
end

#footnotesObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/decorators/chili_pepper/menu_decorator.rb', line 41

def footnotes
  return if menu_type == 'drinks'
  
  footnotes_class = "menu_footnotes"
  
  # if menu_annotations.present?
  #   footnotes_class += ' with_supplements'
  #   section_content = health_footnotes + supplementary_footnotes_columns
    
  # else
    # footnotes_class += ' no_supplements'
  section_content = health_footnotes
  # end
  h.(:section, section_content, class: footnotes_class)
end

def header_img

if menu_image?
  h.image_tag menu_image.url(), style: "margin-top: #{menu_img_margin_top(menu_image.url)}"
end

end



33
34
35
36
37
38
39
# File 'app/decorators/chili_pepper/menu_decorator.rb', line 33

def pdf_link
  if downloadable_pdf?
    pdf_size = h.(:span, "(#{h.number_to_human_size(downloadable_pdf.size)})")
    link = h.link_to(h.raw("Download PDF #{pdf_size}"), downloadable_pdf.url, onclick: "javascript: _gaq.push(['_trackPageview', '/downloads/#{slug}']);")
    h.(:p, link, class: 'pdf_download')
  end
end