Module: ForgeButtonHelper

Defined in:
lib/forge/app/helpers/forge_button_helper.rb

Instance Method Summary collapse

Instance Method Details

grey buttons



28
29
30
31
32
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 28

def button_link(text, url, options = {})
  options[:class] ||= "button"
  icon = (:div, "", :class => "icon")
  link_to((:span, icon + text), url, options)
end

#button_submit_tag(text, options = {}) ⇒ Object

grey submit buttons



35
36
37
38
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 35

def button_submit_tag(text, options = {})
  options[:class] ||= "button"
   :input, "", :type => "submit", :value => text, :class => options[:class], :id => options[:id]
end

#forge_menu_item(title, url, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 8

def forge_menu_item(title, url, options = {})
  klass = options[:active] ? "forge-menu-item active" : "forge-menu-item normal"
  klass += options[:submenu] ? "" : " no-submenu"
  display_title = options[:alt_title] ? options[:alt_title] : title
  arrow = (:div, "", :class => "icon")
  submenu = options[:submenu] ? link_to(arrow, "javascript:;", :class => "#{title} arrow hide") : ""
  spacer = (:div, "", :class => "spacer")
  (:div, :class => klass) { link_to(display_title.titleize, url, options.merge({:class => "forge-menu-link"})) + submenu + spacer}
end

#has_submenu(submenu) ⇒ Object



23
24
25
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 23

def has_submenu(submenu)
  !submenu.blank?
end

#home_button(icon, title, subhead, url, options = {}) ⇒ Object

big home page buttons



41
42
43
44
45
46
47
48
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 41

def home_button(icon, title, subhead, url, options = {})
   :div, :class => "home-button" do
    (:div, "", :class => "image #{icon}") +
    (:h1, title) +
    (:p, subhead) +
    link_to('', url, options)
  end
end

#is_active(controllers) ⇒ Object



18
19
20
21
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 18

def is_active(controllers)
  controllers = controllers.is_a?(Array) ? controllers : [controllers]
  controllers.map{|c| "forge/#{c}"}.include?(params[:controller]) ? true : false
end

#show_menu_item(menu_item) ⇒ Object

forge menu helpers



3
4
5
6
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 3

def show_menu_item(menu_item)
  path = proc {|extension| "#{Rails.root}/app/views/forge/shared/menu_items/_#{menu_item}.#{extension}"}
  render :partial => "forge/shared/menu_items/#{menu_item}", :locals => {:item => menu_item} if File.exist?(path.call('html.erb')) || File.exist?(path.call('html.haml'))
end