Module: BeerDbAdmin::ApplicationHelper

Included in:
DrinksController, FrontpageController, UsersController
Defined in:
app/helpers/beer_db_admin/application_helper.rb

Instance Method Summary collapse

Instance Method Details

todo/fix: try/polish breadcrumb helper



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

def breadcrumb(*parts)
  content_for :breadcrumb do
    parts.join( ' › ' )
  end
end

#current_userObject



17
18
19
# File 'app/helpers/beer_db_admin/application_helper.rb', line 17

def current_user
  User.find( session[:user_id] )
end

#current_user?(user) ⇒ Boolean

Returns:

  • (Boolean)


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

def current_user?( user )
  session[:user_id] == user.id
end

#current_user_idObject



21
22
23
# File 'app/helpers/beer_db_admin/application_helper.rb', line 21

def current_user_id
  session[:user_id]
end

#image_tag_for_country(country, opts = {}) ⇒ Object



45
46
47
48
49
50
51
# File 'app/helpers/beer_db_admin/application_helper.rb', line 45

def image_tag_for_country( country, opts={} )
  if opts[:size] == 'large' || opts[:size] == '64x64'
    image_tag "flags/64x64/#{country.key}.png"
  else
    image_tag "flags/24x24/#{country.key}.png"
  end
end

#powered_byObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/helpers/beer_db_admin/application_helper.rb', line 31

def powered_by
   :div do
    link_to( 'Questions? Comments?', 'http://groups.google.com/group/beerdb' ) + " | " +
    link_to( "world.db/#{WorldDb::VERSION}", 'https://github.com/geraldb/world.db.ruby' )  + ', ' +
    link_to( "beer.db/#{BeerDb::VERSION}", 'https://github.com/geraldb/beer.db.ruby' ) + ', ' +
    link_to( "beer.db.admin/#{BeerDbAdmin::VERSION}", 'https://github.com/geraldb/beer.db.admin' ) + ' - ' +
    ( :span, "Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}/#{RUBY_PLATFORM}) on") + ' ' +
    ( :span, "Rails/#{Rails.version} (#{Rails.env})" ) + " | " + 
    link_to( 'Icon Drawer Flags', 'http://www.icondrawer.com' )
    ## content_tag( :span, "#{request.headers['SERVER_SOFTWARE'] || request.headers['SERVER']}" )
  end
end

#signed_in?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/helpers/beer_db_admin/application_helper.rb', line 13

def signed_in?
  session[:user_id].nil? == false
end