Module: Goldberg::Helper

Defined in:
lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb

Overview

Goldberg::Helper will be added as a helper to ActionController::Base, so its methods will be available in the views throughout all controllers (just as if they’d been added to ApplicationHelper).

Instance Method Summary collapse

Instance Method Details

#goldberg_breadcrumbsObject

Renders the breadcrumbs (i.e. representing the user’s current position in the menu hierarchy).



41
42
43
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 41

def goldberg_breadcrumbs
  render :file => "#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_breadcrumbs.rhtml", :use_full_path => false, :locals => {:crumbs => Goldberg.menu.crumbs}
end

#goldberg_left_menuObject

Renders a nested side menu, for all levels below the main menu.



25
26
27
28
29
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 25

def goldberg_left_menu
  render :file => "#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml", :use_full_path => false,  
  :locals => {:level => 1, :depth => (Goldberg.settings.menu_depth - 2),
    :class_attr => 'sidemenu'}
end

#goldberg_loginObject

Renders the login prompt. This changes depending on whether a user is logged in or not. If a user is logged in, a mini-form is presented with a button to log out. If not, a link to the auth/login page is presented.



49
50
51
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 49

def 
  render :file => "#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/auth/_login.rhtml", :use_full_path => false
end

#goldberg_main_menuObject

Renders a top (i.e. one level deep) static menu.



20
21
22
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 20

def goldberg_main_menu
  render :file => "#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml", :use_full_path => false, :locals => {:level => 0, :depth => 0, :class_attr => nil}
end

#goldberg_suckerfish_menuObject

Renders an entire multilevel suckerfish menu. Whether this is to be rendered along the top, left hand or right hand side of the page depends on the page’s stylesheet. This code just returns the menu structure.



35
36
37
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 35

def goldberg_suckerfish_menu
  render :file => "#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_suckerfish.rhtml", :use_full_path => false, :locals => {:items => Goldberg.menu.get_menu(0)}
end

#goldberg_titleObject

Renders the title of the page: either the ContentPage.name or the current controller and action.



9
10
11
12
13
14
15
16
17
# File 'lib/six-updater-web/vendor/plugins/goldberg/lib/goldberg/helper.rb', line 9

def goldberg_title
  if params[:controller] == 'goldberg/content_pages' and
      ( params[:action] == 'view' or 
        params[:action] == 'view_default')
    "#{@content_page.title}"
  else
    "#{params[:controller]} | #{params[:action]}" 
  end
end