Module: LayMeOut::ApplicationHelper

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

Instance Method Summary collapse

Instance Method Details

#content_classObject



26
27
28
# File 'app/helpers/lay_me_out/application_helper.rb', line 26

def content_class
  content_for?(:side_menu) ? "two-column" : "one-column"
end

#convert_flash_to_jsonObject



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

def convert_flash_to_json
  messages = []

  flash.each do |key, values|
    values = [values] unless values.is_a?(Array)
    values.each do |value|
      messages << { :content => value, :type => key }
    end
  end

  messages.to_json
end

#css_active_class_for(path) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/lay_me_out/application_helper.rb', line 11

def css_active_class_for(path)
  is_active = false

  if path.is_a? Hash
    path.each do |key, subpath|
      is_active = controller.active_page?(subpath)
      break if is_active
    end
  else
    is_active = controller.active_page?(path)
  end

  is_active ? "active" : ""
end

#render_navigationObject



7
8
9
# File 'app/helpers/lay_me_out/application_helper.rb', line 7

def render_navigation
  render :partial => 'lay_me_out/common/navigation', :locals => { :links => controller.navigation_links } if has_value_for?(:navigation_links)
end

#render_user_profileObject



3
4
5
# File 'app/helpers/lay_me_out/application_helper.rb', line 3

def 
  render :partial => "lay_me_out/common/user_profile", :locals => { :user => controller.current_user_details } if has_value_for?(:current_user_details)
end