module ApplicationHelper FLASH_NOTICE_KEYS = [:error, :notice, :warning] def colorize_in_use_locale(locale) @site_in_use_locales.include?(locale)? 'green' : 'red' end def flash_messages return unless messages = flash.keys.select{|k| FLASH_NOTICE_KEYS.include?(k)} formatted_messages = messages.map do |type| content_tag :div, :class => type.to_s do message_for_item(flash[type], flash["#{type}_item".to_sym]) end end raw(formatted_messages.join) end def link_back link_to t('back'), session[:last_page] end def message_for_item(message, item = nil) if item.is_a?(Array) message % link_to(*item) else message % item end end end