module Tenon module ApplicationHelper def flash_messages messages = [] %w(notice alert warning error).each do |msg| unless flash[msg.to_sym].blank? content = content_tag(:p, flash[msg.to_sym]) content += link_to fa_icon('times'), '#', id: 'flash-dismiss' messages << content_tag(:div, content, class: "flash flash-#{msg}") end end messages.join('').html_safe end def menu_item(title, link, options = {}) klass = '' # set the link class to active if it matches the current link or any of the alternate supplied links options[:alt_links].each { |a| klass = request.fullpath.match(a) ? 'active' : '' unless klass == 'active' } if options[:alt_links].is_a?(Array) klass = 'active' if link == request.fullpath klass += " #{options[:class]}" unless options[:class].blank? link_to(title, link, class: klass) end # now uses http://github.com/mdeering/gravatar_image_tag def gravatar_for(object) gravatar_image_tag(object.email) end def table_row(*args) html = '