Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hold Afstand
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
EXSYS2021
da6
Hold Afstand
Commits
400fb51d
Commit
400fb51d
authored
3 years ago
by
Kent Nielsen
Browse files
Options
Downloads
Patches
Plain Diff
Day now show correct when resizing. Movement of day and week working
parent
1d5be5e3
No related branches found
No related tags found
2 merge requests
!29
Release of Prototype
,
!19
Feature/calendar fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
website/studerende-dk/src/components/blocks/Calendar.vue
+25
-8
25 additions, 8 deletions
website/studerende-dk/src/components/blocks/Calendar.vue
with
25 additions
and
8 deletions
website/studerende-dk/src/components/blocks/Calendar.vue
+
25
−
8
View file @
400fb51d
...
...
@@ -133,15 +133,26 @@ export default {
}
},
methods
:
{
daysToAdd
(
forward
){
if
(
this
.
schedule
.
length
==
1
){
if
((
this
.
today
.
getDay
()
==
5
&&
forward
)
||
(
this
.
today
.
getDay
()
==
1
&&
!
forward
)){
return
3
;
}
else
{
return
1
;
}
}
return
7
;
},
// Move the date 7 days back
prevWeek
(){
this
.
today
=
new
Date
(
this
.
today
.
getFullYear
(),
this
.
today
.
getMonth
(),
this
.
today
.
getDate
()
-
7
);
prevWeek
(){
this
.
today
=
new
Date
(
this
.
today
.
getFullYear
(),
this
.
today
.
getMonth
(),
this
.
today
.
getDate
()
-
this
.
daysToAdd
(
false
)
);
this
.
changeSchedule
();
},
// Move the date 7 days forward
nextWeek
(){
this
.
today
=
new
Date
(
this
.
today
.
getFullYear
(),
this
.
today
.
getMonth
(),
this
.
today
.
getDate
()
+
7
);
this
.
today
=
new
Date
(
this
.
today
.
getFullYear
(),
this
.
today
.
getMonth
(),
this
.
today
.
getDate
()
+
this
.
daysToAdd
(
true
)
);
this
.
changeSchedule
();
},
...
...
@@ -206,18 +217,25 @@ export default {
updateDaysInDisplay
(){
if
(
parseInt
(
document
.
getElementById
(
"
calendar
"
).
clientWidth
)
<
400
){
this
.
colSpanValue
=
5
;
this
.
schedule
=
this
.
scheduleDay
;
if
(
this
.
schedule
.
length
==
5
){
this
.
colSpanValue
=
5
;
const
day
=
(
this
.
schedule
[
this
.
today
.
getDay
()
-
1
])
console
.
log
(
this
.
schedule
);
console
.
log
(
day
);
console
.
log
(
this
.
scheduleDay
);
this
.
scheduleDay
[
0
]
=
day
;
this
.
schedule
=
this
.
scheduleDay
;
}
}
else
{
this
.
colSpanValue
=
1
;
this
.
schedule
=
this
.
scheduleWeek12
;
this
.
changeSchedule
();
}
},
initToday
(){
const
firstDayOfWeek
=
this
.
getDateOfISOWeek
(
this
.
getWeek
(
this
.
today
),
this
.
today
.
getFullYear
(),
0
).
getDate
();
const
lastDayOfWeek
=
this
.
getDateOfISOWeek
(
this
.
getWeek
(
this
.
today
),
this
.
today
.
getFullYear
(),
4
).
getDate
();
console
.
log
(
this
.
today
.
getDate
())
if
(
this
.
today
.
getDate
()
>
lastDayOfWeek
||
this
.
today
.
getDate
()
<
firstDayOfWeek
){
while
(
this
.
today
.
getDate
()
<
lastDayOfWeek
){
this
.
today
=
new
Date
(
this
.
today
.
getFullYear
(),
this
.
today
.
getMonth
(),
this
.
today
.
getDate
()
-
1
);
...
...
@@ -226,11 +244,10 @@ export default {
}
},
mounted
(){
this
.
initToday
();
this
.
updateHalfHourSize
();
this
.
updateDaysInDisplay
();
this
.
initToday
();
window
.
addEventListener
(
"
resize
"
,
this
.
updateDaysInDisplay
)
console
.
log
(
this
.
today
.
getDay
())
// Update en data variable, da alle td også skal have colspan
},
updated
(){
...
...
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