Add basic checkbox support to new grids.
Also: * Add 'creatable', 'editable' etc. to master view class. * Add styles for warning/notice grid rows. * Misc. other tweaks.
This commit is contained in:
parent
e79531fda8
commit
d2b065a8fc
13 changed files with 229 additions and 71 deletions
|
@ -44,7 +44,6 @@ p {
|
|||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,18 +133,46 @@
|
|||
* tbody
|
||||
******************************/
|
||||
|
||||
.newgrid table tbody td {
|
||||
.newgrid tbody td {
|
||||
padding: 5px 6px;
|
||||
}
|
||||
|
||||
.newgrid table tbody tr:nth-child(odd) {
|
||||
.newgrid.selectable tbody td {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.newgrid tbody tr:nth-child(odd) {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.newgrid table tbody tr.hovering {
|
||||
.newgrid tbody tr.hovering {
|
||||
background-color: #bbbbbb;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.notice {
|
||||
background-color: #fd6;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.notice:nth-child(odd) {
|
||||
background-color: #fe8;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.notice.hovering {
|
||||
background-color: #ec7;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.warning {
|
||||
background-color: #fcc;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.warning:nth-child(odd) {
|
||||
background-color: #ebb;
|
||||
}
|
||||
|
||||
.newgrid tbody tr.warning.hovering {
|
||||
background-color: #daa;
|
||||
}
|
||||
|
||||
|
||||
/******************************
|
||||
* main actions
|
||||
|
|
23
tailbone/static/js/jquery.ui.tailbone.js
vendored
23
tailbone/static/js/jquery.ui.tailbone.js
vendored
|
@ -115,6 +115,29 @@
|
|||
$(this).removeClass('hovering');
|
||||
});
|
||||
|
||||
// Do some extra stuff for grids with checkboxes.
|
||||
if (this.grid.hasClass('selectable')) {
|
||||
|
||||
// (Un-)Check all rows when clicking check-all box in header.
|
||||
this.element.on('click', 'thead th.checkbox input', function() {
|
||||
var checked = $(this).prop('checked');
|
||||
that.grid.find('tbody td.checkbox input').prop('checked', checked);
|
||||
});
|
||||
|
||||
// Select current row when clicked, unless clicking checkbox
|
||||
// (since that already does select the row) or a link (since
|
||||
// that does something completely different).
|
||||
this.element.on('click', 'tbody td.checkbox input', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
this.element.on('click', 'tbody a', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
this.element.on('click', 'tbody tr', function() {
|
||||
$(this).find('td.checkbox input').click();
|
||||
});
|
||||
}
|
||||
|
||||
// Show 'more' actions when user hovers over 'more' link.
|
||||
this.element.on('mouseenter', '.actions a.more', function() {
|
||||
that.grid.find('.actions div.more').hide();
|
||||
|
|
|
@ -112,11 +112,6 @@ $(function() {
|
|||
$('input[type=submit]').button();
|
||||
$('input[type=reset]').button();
|
||||
|
||||
/*
|
||||
* Enhance new-style grids.
|
||||
*/
|
||||
$('.newgrid-wrapper').gridwrapper();
|
||||
|
||||
/*
|
||||
* When filter labels are clicked, (un)check the associated checkbox.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue