Added row highlighting when selecting action checkmarks.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2009-03-31 16:24:12 +00:00
parent b4f5655c86
commit c823e9d7cc
2 changed files with 25 additions and 3 deletions

View File

@ -232,6 +232,10 @@
margin: 0;
}
#changelist table tbody tr.selected {
background-color: #FFFFCC;
}
#changelist .actions {
color: #999;
padding: 3px;

View File

@ -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);