Module: Odania::ApplicationHelper

Defined in:
app/helpers/odania/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_date(datum) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/odania/application_helper.rb', line 3

def format_date(datum)
  if datum.nil? then
    return '';
  end

  return datum.strftime('%d.%m.%Y')
end

#icon_for_bool(b) ⇒ Object



19
20
21
22
# File 'app/helpers/odania/application_helper.rb', line 19

def icon_for_bool(b)
  return '<span class="glyphicon glyphicon-ok"></span>'.html_safe if b
  '<span class="glyphicon glyphicon-remove"></span>'.html_safe
end

#language_flag(language) ⇒ Object



29
30
31
# File 'app/helpers/odania/application_helper.rb', line 29

def language_flag(language)
  (image_tag("flags/#{language.flag_image}", alt: language.iso_639_1, height: 20) + " #{language.name}").html_safe
end

#list_languages(languages) ⇒ Object



11
12
13
14
15
16
17
# File 'app/helpers/odania/application_helper.rb', line 11

def list_languages(languages)
  result = []
  languages.each do |language|
    result << language.iso_639_1
  end
  result.join(', ')
end

#star_icon_for_bool(b) ⇒ Object



24
25
26
27
# File 'app/helpers/odania/application_helper.rb', line 24

def star_icon_for_bool(b)
  return '<span class="glyphicon glyphicon-star"></span>'.html_safe if b
  '<span class="glyphicon glyphicon-star-empty"></span>'.html_safe
end