summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/events_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 8a9a878..5e84f53 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -1,2 +1,13 @@
1require 'cgi'
2
1module EventsHelper 3module EventsHelper
4 # Insert a zero-width break opportunity after each semicolon, so a long
5 # RRULE can wrap at a clause boundary instead of overflowing its column.
6 # Deliberately <wbr>, not ellipsis -- unlike a URL, an RRULE's trailing
7 # characters (BYDAY, BYMONTH, etc.) are usually the most specific part,
8 # and truncating them would hide exactly the wrong end of the string.
9 def rrule_with_break_opportunities(rrule)
10 return "" if rrule.blank?
11 raw(rrule.split(';', -1).map { |part| CGI.escapeHTML(part) }.join(';<wbr>'))
12 end
2end 13end