Add new list templates toolbar

Add the new generic list and generic list items toolbar which allow
switching the list display mode.

This toolbar also includes a stylized button to select and deselect
all items emulating the check-all checkbox.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2018-12-21 23:51:20 -04:00
parent 9784798118
commit 14f31d5614
9 changed files with 129 additions and 42 deletions

View File

@@ -498,6 +498,18 @@ class SingleObjectListView(PaginationMixin, ViewPermissionCheckMixin, ObjectList
return result
def get_context_data(self, **kwargs):
context = super(SingleObjectListView, self).get_context_data(**kwargs)
if context.get('list_as_items'):
default_mode = 'items'
else:
default_mode = 'list'
list_mode = self.request.GET.get('_list_mode', default_mode)
context.update({'list_as_items': list_mode=='items'})
return context
def get_paginate_by(self, queryset):
return setting_paginate_by.value