Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses-legacy
Commits
77a4d27f
Commit
77a4d27f
authored
4 years ago
by
Glaucia S. Santos
Browse files
Options
Download
Email Patches
Plain Diff
Fix pagination
parent
439a5012
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
courses_legacy/static/js/reports/general-user-report-list/general-user-report-list.component.js
...al-user-report-list/general-user-report-list.component.js
+9
-12
courses_legacy/templates/components/general-user-report-list.template.html
...mplates/components/general-user-report-list.template.html
+1
-1
No files found.
courses_legacy/static/js/reports/general-user-report-list/general-user-report-list.component.js
View file @
77a4d27f
...
...
@@ -22,7 +22,7 @@
ctrl
.
keyword
=
''
;
ctrl
.
filteredUsers
=
[];
ctrl
.
nte
=
''
;
ctrl
.
page
=
1
;
ctrl
.
page
=
null
;
ctrl
.
paginatedUsers
=
[];
ctrl
.
role
=
''
;
ctrl
.
users
=
[];
...
...
@@ -48,12 +48,9 @@
ctrl
.
$doCheck
=
function
()
{
if
(
ctrl
.
city
!==
ctrl
.
old
.
city
||
ctrl
.
classroom
!==
ctrl
.
old
.
classroom
||
ctrl
.
nte
!==
ctrl
.
old
.
nte
||
ctrl
.
role
!==
ctrl
.
old
.
role
)
{
fetchUserReportPage
();
fetchUserReportPage
(
1
);
}
if
(
ctrl
.
users
!==
ctrl
.
old
.
users
)
{
filterUsers
();
paginateUsers
();
}
else
if
(
ctrl
.
page
!==
ctrl
.
old
.
page
)
{
paginateUsers
();
}
ctrl
.
old
.
city
=
ctrl
.
city
;
...
...
@@ -66,7 +63,7 @@
};
function
fetchUserReportPage
(
page
)
{
const
params
=
{
page
:
ctrl
.
page
};
const
params
=
{
page
:
page
};
let
filteredRequest
=
false
;
if
(
ctrl
.
city
)
{
...
...
@@ -91,6 +88,7 @@
ctrl
.
users
=
data
.
results
;
ctrl
.
filteredUsers
=
ctrl
.
users
;
ctrl
.
totalUsers
=
data
.
count
;
ctrl
.
page
=
page
;
// if (page === 1) {
// const totalPages = Math.ceil(data.count / 50);
// for (let extraPage = 2; (filteredRequest && extraPage <= totalPages) || (extraPage <= 20); extraPage++) {
...
...
@@ -100,13 +98,12 @@
});
}
function
filterUsers
()
{
ctrl
.
page
=
1
;
ctrl
.
filteredUsers
=
ctrl
.
users
;
}
function
paginateUsers
()
{
ctrl
.
paginatedUsers
=
ctrl
.
filteredUsers
.
slice
((
ctrl
.
page
-
1
)
*
100
,
(
ctrl
.
page
*
100
))
;
ctrl
.
paginatedUsers
=
ctrl
.
filteredUsers
;
}
$scope
.
filter_page
=
function
()
{
fetchUserReportPage
(
ctrl
.
page
);
};
}
})();
This diff is collapsed.
Click to expand it.
courses_legacy/templates/components/general-user-report-list.template.html
View file @
77a4d27f
...
...
@@ -33,7 +33,7 @@
<div
class=
"classroom-reports--list"
>
<user-report
ng-repeat=
"user in $ctrl.paginatedUsers track by user.id"
user=
"user"
></user-report>
</div>
<ul
uib-pagination
boundary-links=
"true"
total-items=
"$ctrl.totalUsers"
ng-model=
"$ctrl.page"
rotate=
"false"
force-ellipses=
"true"
max-size=
"20"
items-per-page=
"50"
class=
"pagination pagination-md"
previous-text=
"‹"
next-text=
"›"
first-text=
"primeira"
last-text=
"última"
ng-if=
"$ctrl.totalUsers > 50"
></ul>
<ul
uib-pagination
boundary-links=
"true"
total-items=
"$ctrl.totalUsers"
ng-model=
"$ctrl.page"
rotate=
"false"
force-ellipses=
"true"
max-size=
"20"
items-per-page=
"50"
ng-change=
"filter_page()"
class=
"pagination pagination-md"
previous-text=
"‹"
next-text=
"›"
first-text=
"primeira"
last-text=
"última"
ng-if=
"$ctrl.totalUsers > 50"
></ul>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment