mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Added in actions_selection_counter, will add tests/polish next commit.
This commit is contained in:
parent
b7b0d9ba8c
commit
6ff47746df
4 changed files with 15 additions and 11 deletions
|
|
@ -8,9 +8,8 @@ from django.conf import settings
|
|||
# views. This is a security feature.
|
||||
# See the docstring on djadmin2.types.ModelAdmin2 for more detail.
|
||||
MODEL_ADMIN_ATTRS = (
|
||||
'list_display', 'list_display_links', 'list_filter', 'admin',
|
||||
'search_fields',
|
||||
'field_renderers',
|
||||
'actions_selection_counter', 'list_display', 'list_display_links',
|
||||
'list_filter', 'admin', 'search_fields', 'field_renderers',
|
||||
'index_view', 'detail_view', 'create_view', 'update_view', 'delete_view',
|
||||
'get_default_view_kwargs', 'get_list_actions',
|
||||
'actions_on_bottom', 'actions_on_top',
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ $(function() {
|
|||
var selectedCount = element.find('.selected-count');
|
||||
|
||||
var updateSelectedCount = function() {
|
||||
var count = 0;
|
||||
for (var ix = 0; ix < selectCheckbox.length; ix++) {
|
||||
if ($(selectCheckbox[ix]).prop('checked')) {
|
||||
count++;
|
||||
}
|
||||
if (selectedCount.length) {
|
||||
var count = 0;
|
||||
for (var ix = 0; ix < selectCheckbox.length; ix++) {
|
||||
if ($(selectCheckbox[ix]).prop('checked')) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
selectAllCheckbox.prop('checked', count == selectCheckbox.length);
|
||||
selectedCount.text(count);
|
||||
}
|
||||
selectAllCheckbox.prop('checked', count == selectCheckbox.length);
|
||||
selectedCount.text(count);
|
||||
};
|
||||
|
||||
selectAllCheckbox.click(function(e) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
</div>
|
||||
<input type="hidden" name="action" value="" />
|
||||
<small class="muted">
|
||||
{% blocktrans with selected='<span class="selected-count">0</span>' total=object_list|length %}{{selected}} of {{total}} selected{% endblocktrans %}
|
||||
{% if view.model_admin.actions_selection_counter %}
|
||||
{% blocktrans with selected='<span class="selected-count">0</span>' total=object_list|length %}{{selected}} of {{total}} selected{% endblocktrans %}
|
||||
{% endif %}
|
||||
</small>
|
||||
<div class="pull-right">
|
||||
{% if permissions.has_add_permission %}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class ModelAdmin2(with_metaclass(ModelAdminBase2)):
|
|||
This prevents us from easily implementing methods/setters which
|
||||
bypass the blocking features of the ImmutableAdmin.
|
||||
"""
|
||||
actions_selection_counter = True
|
||||
list_display = ('__str__',)
|
||||
list_display_links = ()
|
||||
list_filter = ()
|
||||
|
|
|
|||
Loading…
Reference in a new issue