Module: ForgeButtonHelper
- Defined in:
- lib/forge/app/helpers/forge_button_helper.rb
Instance Method Summary collapse
-
#button_link(text, url, options = {}) ⇒ Object
grey buttons.
-
#button_submit_tag(text, options = {}) ⇒ Object
grey submit buttons.
- #forge_menu_item(title, url, options = {}) ⇒ Object
- #has_submenu(submenu) ⇒ Object
-
#home_button(icon, title, subhead, url, options = {}) ⇒ Object
big home page buttons.
- #is_active(controllers) ⇒ Object
-
#show_menu_item(menu_item) ⇒ Object
forge menu helpers.
Instance Method Details
#button_link(text, url, options = {}) ⇒ Object
grey buttons
28 29 30 31 32 |
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 28 def (text, url, = {}) [:class] ||= "button" icon = content_tag(:div, "", :class => "icon") link_to(content_tag(:span, icon + text), url, ) 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 (text, = {}) [:class] ||= "button" content_tag :input, "", :type => "submit", :value => text, :class => [:class], :id => [: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 (title, url, = {}) klass = [:active] ? "forge-menu-item active" : "forge-menu-item normal" klass += [:submenu] ? "" : " no-submenu" display_title = [:alt_title] ? [:alt_title] : title arrow = content_tag(:div, "", :class => "icon") = [:submenu] ? link_to(arrow, "javascript:;", :class => "#{title} arrow hide") : "" spacer = content_tag(:div, "", :class => "spacer") content_tag(:div, :class => klass) { link_to(display_title.titleize, url, .merge({:class => "forge-menu-link"})) + + spacer} end |
#has_submenu(submenu) ⇒ Object
23 24 25 |
# File 'lib/forge/app/helpers/forge_button_helper.rb', line 23 def () !.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 (icon, title, subhead, url, = {}) content_tag :div, :class => "home-button" do content_tag(:div, "", :class => "image #{icon}") + content_tag(:h1, title) + content_tag(:p, subhead) + link_to('', url, ) 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 () path = proc {|extension| "#{Rails.root}/app/views/forge/shared/menu_items/_#{}.#{extension}"} render :partial => "forge/shared/menu_items/#{}", :locals => {:item => } if File.exist?(path.call('html.erb')) || File.exist?(path.call('html.haml')) end |