module Grandstand::MainHelper # Renders a # # The extra spans are for any sliding door styling you may be interested in adding. Adding :icon to the options will # give the inner-most span a class of "#{options[:icon]} icon", allowing you to add extra images inside of your button. def button_link_to(*args) options, icon = button_options(args.extract_options! || {}) link_to(content_tag(:span, :class => icon ? "#{icon} icon" : nil) { args.shift }, *args.push(options)) end def button_options(options) classes = %w(button) if icon = options.delete(:icon) classes.push('has-icon') end if options.delete(:default) classes.push('default') end classes.push(options[:class].to_s.split(' ')) if options[:class] options[:class] = classes.uniq.join(' ') [options, icon] end def expand(*controllers) options = controllers.extract_options! options[:class] = Array(options[:class]).compact options[:class].push(:expandable) section = controllers.first controllers.map!(&:to_s) if controllers.include?(controller_name) || !((session[:expand] ||= []) & controllers).empty? options[:class].push(:expanded) end raw %( class="#{options[:class].join(' ')}") end def expand_link(section) link_to(raw(''), '#', :class => 'expand', :rel => section) end def hide(condition) raw ' style="display:none;"' if condition end # A form wrapper that's used to override the default field_error_proc in a thread-safeish way. # The new field_error_proc returns a