Module: UsersHelper

Defined in:
app/helpers/users_helper.rb

Instance Method Summary collapse

Instance Method Details

#available_color_themesObject

Returns an array of the color themes available, as specified from AVAILABLE_COLOR_THEMES in config/initializers/color_themes.rb.

Examples:

if AVAILABLE_COLOR_THEMES = [“original”, “dark_green”]

available_color_themes
#=> [["Original gray", "original"], ["Dark green", "dark_green"]]

39
40
41
42
43
44
45
# File 'app/helpers/users_helper.rb', line 39

def available_color_themes
  opts = []
  AVAILABLE_COLOR_THEMES.map do |theme_code|
    opts << [I18n.t("color_themes.#{theme_code}"), theme_code]
  end
  opts
end

#current_color_themeObject

Returns the path of the current color theme so that it can be loaded in app/views/layouts/application.html.haml and app/views/layouts/application.mobile.haml. If the user is not signed in or has not specified a color theme, the default (original) color theme is loaded.

Examples:

if user is not signed in

current_color_theme #=> "color_themes/original"

if user Alice has not selected a color theme

current_color_theme #=> "color_themes/original"

if user Alice has selected a “magenta” theme

current_color_theme #=> "color_themes/magenta"

24
25
26
27
28
29
30
# File 'app/helpers/users_helper.rb', line 24

def current_color_theme
  if user_signed_in?
    color_theme = current_user.color_theme
  end
  color_theme ||= AppConfig.settings.default_color_theme
  "color_themes/#{color_theme}"
end

8
9
10
# File 'app/helpers/users_helper.rb', line 8

def owner_image_link
  person_image_link(current_user.person, :size => :thumb_small)
end

#owner_image_tag(size = nil) ⇒ Object


4
5
6
# File 'app/helpers/users_helper.rb', line 4

def owner_image_tag(size=nil)
  person_image_tag(current_user.person, size)
end