fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
68fb564
)
Add non active users to context menu.
author
Marcin Koziej
<marcin@lolownia.org>
Thu, 10 May 2012 13:52:18 +0000
(15:52 +0200)
committer
Marcin Koziej
<marcin@lolownia.org>
Thu, 10 May 2012 13:52:18 +0000
(15:52 +0200)
apps/catalogue/templates/catalogue/book_list/book_list.html
patch
|
blob
|
history
apps/catalogue/templatetags/book_list.py
patch
|
blob
|
history
redakcja/static/js/catalogue/book_list.js
patch
|
blob
|
history
diff --git
a/apps/catalogue/templates/catalogue/book_list/book_list.html
b/apps/catalogue/templates/catalogue/book_list/book_list.html
index
f1ed46f
..
8b76326
100755
(executable)
--- a/
apps/catalogue/templates/catalogue/book_list/book_list.html
+++ b/
apps/catalogue/templates/catalogue/book_list/book_list.html
@@
-90,3
+90,10
@@
<input type="hidden" name="status" />
</form>
<input type="hidden" name="status" />
</form>
+<select name="other-user" style="display:none;">
+ {% for user in other_users %}
+ <option {% if request.GET.user == user.username %}selected="selected"
+ {% endif %}value="{{ user.username }}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
+ {% endfor %}
+</select>
+
diff --git
a/apps/catalogue/templatetags/book_list.py
b/apps/catalogue/templatetags/book_list.py
index
f7e7047
..
46cf87a
100755
(executable)
--- a/
apps/catalogue/templatetags/book_list.py
+++ b/
apps/catalogue/templatetags/book_list.py
@@
-125,9
+125,14
@@
def book_list(context, user=None):
new_context = {"viewed_user": user}
else:
filters = {}
new_context = {"viewed_user": user}
else:
filters = {}
- new_context = {"users": User.objects.annotate(
+ new_context = {
+ "users": User.objects.annotate(
count=Count('chunk')).filter(count__gt=0).order_by(
count=Count('chunk')).filter(count__gt=0).order_by(
- '-count', 'last_name', 'first_name')}
+ '-count', 'last_name', 'first_name'),
+ "other_users": User.objects.annotate(
+ count=Count('chunk')).filter(count=0).order_by(
+ 'last_name', 'first_name'),
+ }
new_context.update({
"filters": True,
new_context.update({
"filters": True,
diff --git
a/redakcja/static/js/catalogue/book_list.js
b/redakcja/static/js/catalogue/book_list.js
index
4d67ca1
..
a3d092b
100644
(file)
--- a/
redakcja/static/js/catalogue/book_list.js
+++ b/
redakcja/static/js/catalogue/book_list.js
@@
-31,7
+31,11
@@
var field = kp[0];
var idx = parseInt(kp[1]);
var field = kp[0];
var idx = parseInt(kp[1]);
- fds[field] = $("select[name="+field+"] option[value!=]").eq(idx).val();
+ var target_field = field;
+ if (field == 'other-user')
+ target_field = 'user';
+
+ fds[target_field] = $("select[name="+field+"] option[value!=]").eq(idx).val();
}
/* fill in the form */
$("#chunk_mass_edit [name=ids]").val(get_ids());
}
/* fill in the form */
$("#chunk_mass_edit [name=ids]").val(get_ids());
@@
-70,7
+74,14
@@
},
"user": {
name: "Set user",
},
"user": {
name: "Set user",
- items: get_items("user"),
+ items: (function() {
+ var active_users = get_items("user");
+ active_users['other'] = {
+ name: "Other",
+ items: get_items("other-user"),
+ };
+ return active_users;
+ })(),
icon: "user",
},
"publish": {
icon: "user",
},
"publish": {