1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | (function ($) {
function fix_actions() {
var container = $('div.actions');
if (container.find('option').length < 10) {
container.find('label, button').hide();
var buttons = $('<div></div>')
.prependTo(container)
.css('display', 'inline')
.addClass('class', 'action-buttons');
container.find('option:gt(0)').each(function () {
$('<button>')
.appendTo(buttons)
.attr('name', this.value)
.addClass('button')
.text(this.text)
.click(function () {
container.find('select')
.find(':selected').attr('selected', '').end()
.find('[value=' + this.name + ']').attr('selected', 'selected');
$('#changelist-form button[name="index"]').click();
});
});
}
};
$(function () {
fix_actions();
});
})(django.jQuery);
|
More like this
- Admin actions as buttons instead of a menu by andybak 3 years, 3 months ago
- Generic CSV export admin action factory by anentropic 3 years ago
- MPTTModelAdmin by anentropic 3 years, 7 months ago
- Basic logic filters by mikeivanov 5 years, 8 months ago
- Drag and drop ordering of admin list elements for Grappelli [v2] by brejoc 4 months, 3 weeks ago
Comments