fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1d5395d
)
User list sorted by last activity.
author
Radek Czajka
<rczajka@rczajka.pl>
Sat, 11 Dec 2021 12:29:13 +0000
(13:29 +0100)
committer
Radek Czajka
<rczajka@rczajka.pl>
Sat, 11 Dec 2021 12:29:13 +0000
(13:29 +0100)
src/documents/templates/documents/book_list/book_list.html
patch
|
blob
|
history
src/documents/templatetags/book_list.py
patch
|
blob
|
history
src/redakcja/static/js/documents/book_list.js
patch
|
blob
|
history
diff --git
a/src/documents/templates/documents/book_list/book_list.html
b/src/documents/templates/documents/book_list/book_list.html
index
eb4c8f5
..
812ea79
100644
(file)
--- a/
src/documents/templates/documents/book_list/book_list.html
+++ b/
src/documents/templates/documents/book_list/book_list.html
@@
-115,3
+115,9
@@
{% endif %}value="{{ user.username }}">{{ user|username }} ({{ user.count }})</option>
{% endfor %}
</select>
{% endif %}value="{{ user.username }}">{{ user|username }} ({{ user.count }})</option>
{% endfor %}
</select>
+
+<select name="active-users" style="display:none;">
+ {% for user in active_users %}
+ <option value="{{ user.username }}">{{ user|username }}</option>
+ {% endfor %}
+</select>
diff --git
a/src/documents/templatetags/book_list.py
b/src/documents/templatetags/book_list.py
index
acd2208
..
bf5fbd0
100644
(file)
--- a/
src/documents/templatetags/book_list.py
+++ b/
src/documents/templatetags/book_list.py
@@
-2,7
+2,7
@@
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from re import split
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from re import split
-from django.db.models import Q, Count
+from django.db.models import Q, Count
, F, Max
from django import template
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django import template
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
@@
-127,9
+127,9
@@
def book_list(context, user=None):
count=Count('chunk')).filter(count__gt=0).order_by(
'-count', 'last_name', 'first_name'),
"other_users": User.objects.annotate(
count=Count('chunk')).filter(count__gt=0).order_by(
'-count', 'last_name', 'first_name'),
"other_users": User.objects.annotate(
- count=Count('chunk')).filter(count=0).
order_by(
-
'last_name', 'first_name'),
-
}
+ count=Count('chunk')).filter(count=0).
annotate(m=Max('chunkchange__created_at')).order_by(F('m').desc(nulls_last=True), 'last_name', 'first_name'),
+
"active_users": User.objects.annotate(m=Max('chunkchange__created_at')).order_by(F('m').desc(nulls_last=True),
'last_name', 'first_name'),
+ }
new_context.update({
"filters": True,
new_context.update({
"filters": True,
diff --git
a/src/redakcja/static/js/documents/book_list.js
b/src/redakcja/static/js/documents/book_list.js
index
9d2511d
..
0f03f4a
100644
(file)
--- a/
src/redakcja/static/js/documents/book_list.js
+++ b/
src/redakcja/static/js/documents/book_list.js
@@
-50,9
+50,7
@@
var user_callback = get_callback('user');
var users = [
var user_callback = get_callback('user');
var users = [
- get_items("user", user_callback),
- {sep: '----'},
- get_items("other-user", user_callback)
+ get_items("active-users", user_callback)
];
var current_user_items = user_items = {};
var i = 0;
];
var current_user_items = user_items = {};
var i = 0;