Module: BeerDbAdmin::LinkHelper
- Defined in:
- app/helpers/beer_db_admin/link_helper.rb
Instance Method Summary collapse
- #link_to_beer(beer, opts = {}) ⇒ Object
- #link_to_brewery(brewery, opts = {}) ⇒ Object
- #link_to_city(city, opts = {}) ⇒ Object
- #link_to_country(country, opts = {}) ⇒ Object
- #link_to_region(region, opts = {}) ⇒ Object
Instance Method Details
#link_to_beer(beer, opts = {}) ⇒ Object
11 12 13 |
# File 'app/helpers/beer_db_admin/link_helper.rb', line 11 def link_to_beer( beer, opts={} ) link_to beer.title, short_beer_path( beer ) end |
#link_to_brewery(brewery, opts = {}) ⇒ Object
7 8 9 |
# File 'app/helpers/beer_db_admin/link_helper.rb', line 7 def link_to_brewery( brewery, opts={} ) link_to brewery.title, short_brewery_path( brewery ) end |
#link_to_city(city, opts = {}) ⇒ Object
15 16 17 |
# File 'app/helpers/beer_db_admin/link_helper.rb', line 15 def link_to_city( city, opts={} ) link_to city.title, short_city_path( city ) end |
#link_to_country(country, opts = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/helpers/beer_db_admin/link_helper.rb', line 23 def link_to_country( country, opts={} ) pp opts buf = "" ## add flag (image tag) if flag opt present e.g. flag:true if opts[:flag].present? puts "add flag (image tag) for country #{country.title}" buf << image_tag_for_country( country ) buf << ' ' end buf << link_to( country.title, short_country_path( country )) buf.html_safe # note: make sure html will NOT get escaped end |
#link_to_region(region, opts = {}) ⇒ Object
19 20 21 |
# File 'app/helpers/beer_db_admin/link_helper.rb', line 19 def link_to_region( region, opts={} ) link_to region.title, short_region_path( region ) end |