Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
f337c9ea
Commit
f337c9ea
authored
11 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Precompute first & last for intersectHandler
parent
7cda6e6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!355
Implement infinite scrolling and by date navigation for coursebook
,
!350
Resolve "Add simple course book list"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+8
-7
8 additions, 7 deletions
...pps/alsijil/frontend/components/coursebook/Coursebook.vue
with
8 additions
and
7 deletions
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+
8
−
7
View file @
f337c9ea
...
...
@@ -19,9 +19,9 @@
<
template
#default=
"{ items }"
>
<coursebook-loader
/>
<coursebook-day
v-for=
"
{ date, docs,
idx
, last
Idx
} in groupDocsByDay(items)"
v-for=
"
{ date, docs,
first
, last } in groupDocsByDay(items)"
v-intersect="{
handler: intersectHandler(date,
idx
, last
Idx
),
handler: intersectHandler(date,
first
, last),
options: {
rootMargin: '-165px 0px 0px 0px',
threshold: [0, 1],
...
...
@@ -200,8 +200,9 @@ export default {
.
sort
()
.
map
((
key
,
idx
,
{
length
}
)
=>
{
const
day
=
docsByDay
[
key
];
day
.
idx
=
idx
;
day
.
lastIdx
=
length
-
1
;
day
.
first
=
idx
===
0
;
const
lastIdx
=
length
-
1
;
day
.
last
=
idx
===
lastIdx
;
return
day
;
}
);
}
,
...
...
@@ -241,7 +242,7 @@ export default {
}
}
);
}
,
intersectHandler
(
date
,
idx
,
last
Idx
)
{
intersectHandler
(
date
,
first
,
last
)
{
let
once
=
true
;
return
(
entries
)
=>
{
const
entry
=
entries
[
0
];
...
...
@@ -253,7 +254,7 @@ export default {
this
.
setDate
(
date
.
toISODate
());
}
if
(
once
&&
this
.
ready
&&
idx
===
0
)
{
if
(
once
&&
this
.
ready
&&
first
)
{
console
.
log
(
'
load up
'
,
date
.
toISODate
());
this
.
ready
=
false
;
this
.
fetchMore
(
date
.
minus
({
days
:
5
}
).
toISODate
(),
...
...
@@ -263,7 +264,7 @@ export default {
document
.
documentElement
.
scrollTop
);
}
);
once
=
false
;
}
else
if
(
once
&&
this
.
ready
&&
idx
===
last
Idx
)
{
}
else
if
(
once
&&
this
.
ready
&&
last
)
{
console
.
log
(
'
load down
'
,
date
.
toISODate
());
this
.
ready
=
false
;
this
.
fetchMore
(
date
.
plus
({
days
:
1
}
).
toISODate
(),
...
...
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