Add new dashboard item to display the total page count.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -35,7 +35,8 @@ from navigation import SourceColumn
|
||||
from rest_api.fields import DynamicSerializerField
|
||||
|
||||
from .dashboard_widgets import (
|
||||
DashboardWidgetDocumentsInTrash, DashboardWidgetDocumentsNewThisMonth,
|
||||
DashboardWidgetDocumentPagesTotal, DashboardWidgetDocumentsInTrash,
|
||||
DashboardWidgetDocumentsNewThisMonth,
|
||||
DashboardWidgetDocumentsPagesNewThisMonth, DashboardWidgetDocumentsTotal,
|
||||
DashboardWidgetDocumentsTypesTotal,
|
||||
)
|
||||
@@ -394,16 +395,19 @@ class DocumentsApp(MayanAppConfig):
|
||||
widget=DashboardWidgetDocumentsTotal, order=0
|
||||
)
|
||||
dashboard_main.add_widget(
|
||||
widget=DashboardWidgetDocumentsInTrash, order=1
|
||||
widget=DashboardWidgetDocumentPagesTotal, order=1
|
||||
)
|
||||
dashboard_main.add_widget(
|
||||
widget=DashboardWidgetDocumentsTypesTotal, order=2
|
||||
widget=DashboardWidgetDocumentsInTrash, order=2
|
||||
)
|
||||
dashboard_main.add_widget(
|
||||
widget=DashboardWidgetDocumentsNewThisMonth, order=3
|
||||
widget=DashboardWidgetDocumentsTypesTotal, order=3
|
||||
)
|
||||
dashboard_main.add_widget(
|
||||
widget=DashboardWidgetDocumentsPagesNewThisMonth, order=4
|
||||
widget=DashboardWidgetDocumentsNewThisMonth, order=4
|
||||
)
|
||||
dashboard_main.add_widget(
|
||||
widget=DashboardWidgetDocumentsPagesNewThisMonth, order=5
|
||||
)
|
||||
|
||||
menu_documents.bind_links(
|
||||
|
||||
@@ -19,6 +19,28 @@ from .statistics import (
|
||||
)
|
||||
|
||||
|
||||
class DashboardWidgetDocumentPagesTotal(DashboardWidgetNumeric):
|
||||
icon_class = icon_dashboard_pages_per_month
|
||||
label = _('Total pages')
|
||||
link = reverse_lazy(
|
||||
'statistics:statistic_detail',
|
||||
args=('total-document-pages-at-each-month',)
|
||||
)
|
||||
|
||||
def render(self, request):
|
||||
AccessControlList = apps.get_model(
|
||||
app_label='acls', model_name='AccessControlList'
|
||||
)
|
||||
DocumentPage = apps.get_model(
|
||||
app_label='documents', model_name='DocumentPage'
|
||||
)
|
||||
self.count = AccessControlList.objects.filter_by_access(
|
||||
permission=permission_document_view, user=request.user,
|
||||
queryset=DocumentPage.objects.all()
|
||||
).count()
|
||||
return super(DashboardWidgetDocumentPagesTotal, self).render(request)
|
||||
|
||||
|
||||
class DashboardWidgetDocumentsTotal(DashboardWidgetNumeric):
|
||||
icon_class = icon_dashboard_total_document
|
||||
label = _('Total documents')
|
||||
|
||||
Reference in New Issue
Block a user