Module: BeerDbAdmin::PartHelper

Defined in:
app/helpers/beer_db_admin/part_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_beer(beer) ⇒ Object



28
29
30
# File 'app/helpers/beer_db_admin/part_helper.rb', line 28

def render_beer( beer )
  render partial: 'beer_db_admin/shared/beer', locals: { beer: beer }
end

#render_beers(beers) ⇒ Object



32
33
34
# File 'app/helpers/beer_db_admin/part_helper.rb', line 32

def render_beers( beers )
  render partial: 'beer_db_admin/shared/beers', locals: { beers: beers }
end

#render_breweries_for_city(city) ⇒ Object



48
49
50
# File 'app/helpers/beer_db_admin/part_helper.rb', line 48

def render_breweries_for_city( city )
  render partial: 'beer_db_admin/shared/breweries_for_city', locals: { city: city }
end

#render_breweries_for_country(country) ⇒ Object



56
57
58
# File 'app/helpers/beer_db_admin/part_helper.rb', line 56

def render_breweries_for_country( country )
  render partial: 'beer_db_admin/shared/breweries_for_country', locals: { country: country }
end

#render_breweries_for_region(region) ⇒ Object



52
53
54
# File 'app/helpers/beer_db_admin/part_helper.rb', line 52

def render_breweries_for_region( region )
  render partial: 'beer_db_admin/shared/breweries_for_region', locals: { region: region }
end

#render_breweries_table_rows(breweries) ⇒ Object



37
38
39
40
# File 'app/helpers/beer_db_admin/part_helper.rb', line 37

def render_breweries_table_rows( breweries )
  render partial: 'beer_db_admin/shared/breweries_table_rows',
    locals: { breweries: breweries }
end

#render_breweries_table_rows_for_region(region) ⇒ Object



42
43
44
45
# File 'app/helpers/beer_db_admin/part_helper.rb', line 42

def render_breweries_table_rows_for_region( region )
  render partial: 'beer_db_admin/shared/breweries_table_rows_for_region',
    locals: { region: region }
end

#render_brewery_tags(brewery) ⇒ Object



23
24
25
26
# File 'app/helpers/beer_db_admin/part_helper.rb', line 23

def render_brewery_tags( brewery )
  # NB: will include "pseudo" tags such as production/capacity in hl and others
  render partial: 'beer_db_admin/shared/brewery_tags', locals: { brewery: brewery }
end

#render_countries(countries, opts = {}) ⇒ Object



14
15
16
17
# File 'app/helpers/beer_db_admin/part_helper.rb', line 14

def render_countries( countries, opts={} )
  render partial: 'beer_db_admin/shared/countries',
         locals: { countries: countries }
end

#render_tags(tags) ⇒ Object



19
20
21
# File 'app/helpers/beer_db_admin/part_helper.rb', line 19

def render_tags( tags )
  render partial: 'beer_db_admin/shared/tags', locals: { tags: tags }
end

#render_world_tree(o, opts = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'app/helpers/beer_db_admin/part_helper.rb', line 6

def render_world_tree( o, opts={} )
  render partial: 'beer_db_admin/shared/world_tree',
         locals: { country: o.country,
                   region:  o.region,
                   city:    o.city,
                   show_flag: (opts[:flag].present? ? true : false) }
end