summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-08-27 06:40:59 +0000
committerGo MAEDA <maeda@farend.jp>2023-08-27 06:40:59 +0000
commit4e0bb4990ca4422c0d54b4cf1707a4025989b64f (patch)
treecbef1701962cdbb60dded88ff1bc80eb69646dc8 /lib
parent6653f60d7454aa927840eced55b20bde77adbc16 (diff)
downloadredmine-4e0bb4990ca4422c0d54b4cf1707a4025989b64f.tar.gz
redmine-4e0bb4990ca4422c0d54b4cf1707a4025989b64f.zip
Display calendar in vertical list layout on mobile screens (#33682).
Patch by Takashi Kato. git-svn-id: https://svn.redmine.org/redmine/trunk@22283 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/helpers/calendar.rb17
-rw-r--r--lib/redmine/i18n.rb4
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/redmine/helpers/calendar.rb b/lib/redmine/helpers/calendar.rb
index 2f5b5d097..d6730840f 100644
--- a/lib/redmine/helpers/calendar.rb
+++ b/lib/redmine/helpers/calendar.rb
@@ -23,6 +23,8 @@ module Redmine
# Simple class to compute the start and end dates of a calendar
class Calendar
include Redmine::I18n
+ include Redmine::Utils::DateCalculation
+
attr_reader :startdt, :enddt
def initialize(date, lang = current_language, period = :month)
@@ -47,6 +49,21 @@ module Redmine
end
end
+ def format_month
+ (@startdt..@enddt).to_a
+ end
+
+ def week_number(day)
+ (day + (11 - day.cwday) % 7).cweek
+ end
+
+ def day_css_classes(day)
+ css = day.month==month ? +'even' : +'odd'
+ css << " today" if User.current.today == day
+ css << " nwday" if non_working_week_days.include?(day.cwday)
+ css
+ end
+
# Sets calendar events
def events=(events)
@events = events
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 7010437fd..5421c45d5 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -103,6 +103,10 @@ module Redmine
::I18n.t('date.day_names')[day % 7]
end
+ def abbr_day_name(day)
+ ::I18n.t('date.abbr_day_names')[day % 7]
+ end
+
def day_letter(day)
::I18n.t('date.abbr_day_names')[day % 7].first
end