diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-03 03:22:02 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-03 03:22:02 +0200 |
| commit | 287569c9bbfdadae767254792cd2b53d0515d928 (patch) | |
| tree | 8a9b1fb8dd9b26c315fd2b0e9e412e2cc056d80b /app/helpers | |
| parent | e5e8212db58ec6ed7421ed95a85f6b654e8e300a (diff) | |
Add weekday abbreviation for open-today widget
RruleHumanizer gains WEEKDAY_NAMES_ABBR (Mo/Di/Mi/...) alongside the
existing WEEKDAY_NAMES and WEEKDAY_NAMES_ADVERBIAL hashes, plus a
self.wday_abbr(time, locale) utility mapping a Time's wday to its
RFC5545 code and looking up the abbreviation - keeping RFC5545
vocabulary in one place rather than teaching ContentHelper about day
codes directly.
ContentHelper#weekday_abbr is a thin wrapper passing I18n.locale
through. The partial now renders "Fr 19:00" instead of just "19:00",
joined with a non-breaking space so the pair can't split across a
line wrap.
Takes an explicit Time rather than reading Date.today, matching this
file's existing style of passing state in rather than reading it
ambiently - and staying correct if the currently-unused
calendar/_front_page_calendar partial (spanning six weeks, not just
today) is ever revived and reuses this helper.
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/content_helper.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index bf7287f..6043089 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb | |||
| @@ -39,6 +39,10 @@ module ContentHelper | |||
| 39 | ) | 39 | ) |
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | def weekday_abbr(time) | ||
| 43 | RruleHumanizer.wday_abbr(time, I18n.locale) | ||
| 44 | end | ||
| 45 | |||
| 42 | def tags | 46 | def tags |
| 43 | render :partial => 'content/tags' | 47 | render :partial => 'content/tags' |
| 44 | end | 48 | end |
