Module: RailsExceptionLogger::LoggedExceptionsHelper

Defined in:
app/helpers/rails_exception_logger/logged_exceptions_helper.rb

Instance Method Summary collapse

Instance Method Details

#filtered?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/helpers/rails_exception_logger/logged_exceptions_helper.rb', line 16

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

#listify(text) ⇒ Object



20
21
22
23
# File 'app/helpers/rails_exception_logger/logged_exceptions_helper.rb', line 20

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

#page_title(text) ⇒ Object



25
26
27
28
29
30
31
32
# File 'app/helpers/rails_exception_logger/logged_exceptions_helper.rb', line 25

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

#pretty_exception_date(exception) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/rails_exception_logger/logged_exceptions_helper.rb', line 4

def pretty_exception_date(exception)
  if Date.today == exception.created_at.to_date
    if false # exception.created_at > Time.now - 4.hours
      "#{time_ago_in_words(exception.created_at).gsub(/about /,"~ ")} agox"
    else
      "Today, #{exception.created_at.strftime(Time::DATE_FORMATS[:exc_time])}"
    end
  else
    exception.created_at.strftime(Time::DATE_FORMATS[:exc_date])
  end
end

#pretty_format(text) ⇒ Object

Rescue textilize call if RedCloth is not available.



35
36
37
38
39
40
41
# File 'app/helpers/rails_exception_logger/logged_exceptions_helper.rb', line 35

def pretty_format(text)
  begin
    textilize(text).html_safe
  rescue
    simple_format(text).html_safe
  end
end