Sha256: 3e5c2ad1c6979f288966210d1a4545d8482aaf1a65882d3f10facc477bb0c0c6

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module ExceptionLogger
  module LoggedExceptionsHelper
    def pretty_exception_date(exception)
      if Date.today == exception.created_at.to_date
        "#{I18n.t('exception_logger.logged_exceptions.index.today')}, #{exception.created_at.strftime(Time::DATE_FORMATS[:exc_time])}"
      else
        exception.created_at.strftime(Time::DATE_FORMATS[:exc_date])
      end
    end

    def filtered?
      [:query, :date_ranges_filter, :exception_names_filter, :controller_actions_filter].any? { |p| params[p] }
    end

    def listify(text)
      list_items = text.scan(/^\s*\* (.+)/).map {|match| content_tag(:li, match.first) }
      content_tag(:ul, list_items)
    end

    def page_title(text)
      title = ""
      unless controller.application_name.blank?
        title << "#{controller.application_name} :: "
      end
      title << text.to_s
      content_for(:title, title.to_s)
    end

    # Rescue textilize call if RedCloth is not available.
    def pretty_format(text)
      begin
        textilize(text).html_safe
      rescue
        simple_format(text).html_safe
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception_logger-0.2.0 app/helpers/exception_logger/logged_exceptions_helper.rb