Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
96285c71
Commit
96285c71
authored
1 year ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
635cef61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/communication/website/agenda/event/with_cal.rb
+23
-19
23 additions, 19 deletions
app/models/communication/website/agenda/event/with_cal.rb
with
23 additions
and
19 deletions
app/models/communication/website/agenda/event/with_cal.rb
+
23
−
19
View file @
96285c71
...
...
@@ -3,37 +3,41 @@ module Communication::Website::Agenda::Event::WithCal
def
cal
@cal
||=
AddToCalendar
::
URLs
.
new
(
start_datetime:
from_time
,
end_datetime:
to_time
,
start_datetime:
cal_
from_time
,
end_datetime:
cal_
to_time
,
timezone:
timezone
.
name
,
all_day:
cal_all_day
,
title:
"
#{
title
}
#{
subtitle
}
"
,
url:
url
,
description:
summary
,
all_day:
(
from_hour
.
nil?
&&
to_hour
.
nil?
)
description:
summary
)
end
protected
def
from_time
def
cal_
from_time
from_hour
.
nil?
?
from_day
.
to_time
:
date_and_time
(
from_day
,
from_hour
)
end
def
to_time
if
to_day
.
nil?
&&
to_hour
.
nil?
# Pas de fin
nil
elsif
to_day
.
nil?
&&
to_hour
.
present?
# Heure de fin sans jour de fin, donc on se base sur le jour de début
date_and_time
(
from_day
,
to_hour
)
elsif
to_day
.
present?
&&
to_hour
.
nil?
# Jour de fin seul
to_day
.
to_time
elsif
to_day
.
present?
&&
to_hour
.
nil?
# Jour et heure de fin
date_and_time
(
to_day
,
to_hour
)
end
def
cal_to_time
to_day
.
nil?
?
cal_to_time_with_no_end_day
:
cal_to_time_with_end_day
end
def
cal_all_day
from_hour
.
nil?
&&
to_hour
.
nil?
end
# Ce cas n'est plus possible depuis la résolution #1386
def
cal_to_time_with_no_end_day
to_hour
.
nil?
?
nil
# Pas de fin
:
date_and_time
(
from_day
,
to_hour
)
# Heure de fin sans jour de fin, donc on se base sur le jour de début
end
def
cal_to_time_with_end_day
to_hour
.
nil?
?
to_day
.
to_time
+
1
.
hour
# Jour de fin seul, on ajoute 1 heure pour éviter les événements sans durée
:
date_and_time
(
to_day
,
to_hour
)
# Jour et heure de fin
end
def
timezone
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment