summaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 248704609..5995187d7 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -105,6 +105,18 @@ module ApplicationHelper
@time_format ||= (Setting.time_format.blank? ? l(:general_fmt_time) : Setting.time_format)
include_date ? local.strftime("#{@date_format} #{@time_format}") : local.strftime(@time_format)
end
+
+ def format_activity_title(text)
+ h(truncate_single_line(text, 100))
+ end
+
+ def format_activity_day(date)
+ date == Date.today ? l(:label_today).titleize : format_date(date)
+ end
+
+ def format_activity_description(text)
+ h(truncate(text.to_s, 250).gsub(%r{<(pre|code)>.*$}m, '...'))
+ end
def distance_of_date_in_words(from_date, to_date = 0)
from_date = from_date.to_date if from_date.respond_to?(:to_date)