Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
die_coolen_jungs
our_own_cloud_project
Commits
8909b574
Commit
8909b574
authored
11 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Make sure there are always enough elements visible on the page
parent
2883f231
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files/js/filelist.js
+10
-0
10 additions, 0 deletions
apps/files/js/filelist.js
apps/files/tests/js/filelistSpec.js
+8
-0
8 additions, 0 deletions
apps/files/tests/js/filelistSpec.js
with
18 additions
and
0 deletions
apps/files/js/filelist.js
+
10
−
0
View file @
8909b574
...
...
@@ -570,6 +570,7 @@ window.FileList = {
this
.
fileSummary
.
add
(
fileData
,
true
);
this
.
updateEmptyContent
();
}
return
$tr
;
},
...
...
@@ -823,6 +824,15 @@ window.FileList = {
FileList
.
updateEmptyContent
();
this
.
fileSummary
.
remove
({
type
:
fileEl
.
attr
(
'
data-type
'
),
size
:
fileEl
.
attr
(
'
data-size
'
)},
true
);
}
var
lastIndex
=
this
.
$fileList
.
children
().
length
;
// if there are less elements visible than one page
// but there are still pending elements in the array,
// then directly append the next page
if
(
lastIndex
<
this
.
files
.
length
&&
lastIndex
<
this
.
pageSize
)
{
this
.
_nextPage
(
true
);
}
return
fileEl
;
},
/**
...
...
This diff is collapsed.
Click to expand it.
apps/files/tests/js/filelistSpec.js
+
8
−
0
View file @
8909b574
...
...
@@ -701,6 +701,14 @@ describe('FileList tests', function() {
FileList
.
_nextPage
(
true
);
expect
(
$
(
'
#fileList tr
'
).
length
).
toEqual
(
81
);
});
it
(
'
automatically renders next page when there are not enough elements visible
'
,
function
()
{
// delete the 15 first elements
for
(
var
i
=
0
;
i
<
15
;
i
++
)
{
FileList
.
remove
(
FileList
.
files
[
0
].
name
);
}
// still makes sure that there are 20 elements visible, if any
expect
(
$
(
'
#fileList tr
'
).
length
).
toEqual
(
25
);
});
});
describe
(
'
file previews
'
,
function
()
{
var
previewLoadStub
;
...
...
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