Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added row highlighting when selecting action checkmarks.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c823e9d7ccba303fb37ce232eb1db901ef580a2a 1 parent b4f5655
Jacob Kaplan-Moss jacobian authored
4 django/contrib/admin/media/css/changelists.css
View
@@ -232,6 +232,10 @@
margin: 0;
}
+#changelist table tbody tr.selected {
+ background-color: #FFFFCC;
+}
+
#changelist .actions {
color: #999;
padding: 3px;
24 django/contrib/admin/media/js/actions.js
View
@@ -1,19 +1,37 @@
var Actions = {
init: function() {
- selectAll = document.getElementById('action-toggle');
+ var selectAll = document.getElementById('action-toggle');
if (selectAll) {
selectAll.style.display = 'inline';
addEvent(selectAll, 'click', function() {
Actions.checker(selectAll.checked);
});
}
+ var changelistTable = document.getElementsBySelector('#changelist table')[0];
+ addEvent(changelistTable, 'click', function(e) {
+ if (!e) { var e = window.event; }
+ var target = e.target ? e.target : e.srcElement;
+ if (target.nodeType == 3) { target = target.parentNode; }
+ if (target.className == 'action-select') {
+ var tr = target.parentNode.parentNode;
+ Actions.toggleRow(tr, target.checked);
+ }
+ });
+ },
+ toggleRow: function(tr, checked) {
+ if (checked) {
+ tr.className += ' selected';
+ } else {
+ tr.className = tr.className.replace(' selected', '');
+ }
},
checker: function(checked) {
- actionCheckboxes = document.getElementsBySelector('tr input.action-select');
+ var actionCheckboxes = document.getElementsBySelector('tr input.action-select');
for(var i = 0; i < actionCheckboxes.length; i++) {
actionCheckboxes[i].checked = checked;
+ Actions.toggleRow(actionCheckboxes[i].parentNode.parentNode, checked);
}
}
-}
+};
addEvent(window, 'load', Actions.init);
Please sign in to comment.
Something went wrong with that request. Please try again.