diff --git a/.tx/config b/.tx/config index d1e3202680..e42af72919 100644 --- a/.tx/config +++ b/.tx/config @@ -49,6 +49,12 @@ source_lang = en source_file = mayan/apps/converter/locale/en/LC_MESSAGES/django.po type = PO +[mayan-edms.dashboards-2-0] +file_filter = mayan/apps/dashboards/locale//LC_MESSAGES/django.po +source_lang = en +source_file = mayan/apps/dashboards/locale/en/LC_MESSAGES/django.po +type = PO + [mayan-edms.django_gpg-2-0] file_filter = mayan/apps/django_gpg/locale//LC_MESSAGES/django.po source_lang = en diff --git a/HISTORY.rst b/HISTORY.rst index ef3972894e..74e3f54e1e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -194,6 +194,7 @@ the authenticaton app. - Moved the navigation templates from the appearance app to the navigation app. +- Moved the dashboard and dashboard widgets to their own app. 3.1.9 (2018-11-01) ================== diff --git a/contrib/scripts/process_messages.py b/contrib/scripts/process_messages.py index a63e87516c..41bb68d08c 100755 --- a/contrib/scripts/process_messages.py +++ b/contrib/scripts/process_messages.py @@ -10,13 +10,13 @@ import sh APP_LIST = ( 'acls', 'appearance', 'authentication', 'autoadmin', 'cabinets', - 'checkouts', 'common', 'converter', 'django_gpg', 'document_comments', - 'document_indexing', 'document_parsing', 'document_signatures', - 'document_states', 'documents', 'dynamic_search', 'events', - 'file_caching', 'linking', 'lock_manager', 'mayan_statistics', 'mailer', - 'metadata', 'mirroring', 'motd', 'navigation', 'ocr', 'permissions', - 'rest_api', 'smart_settings', 'sources', 'storage', 'tags', - 'task_manager', 'user_management' + 'checkouts', 'common', 'converter', 'dashboards', 'django_gpg', + 'document_comments', 'document_indexing', 'document_parsing', + 'document_signatures', 'document_states', 'documents', 'dynamic_search', + 'events', 'file_caching', 'linking', 'lock_manager', 'mayan_statistics', + 'mailer', 'metadata', 'mirroring', 'motd', 'navigation', 'ocr', + 'permissions', 'rest_api', 'smart_settings', 'sources', 'storage', + 'tags', 'task_manager', 'user_management' ) LANGUAGE_LIST = ( diff --git a/mayan/apps/appearance/templates/appearance/home.html b/mayan/apps/appearance/templates/appearance/home.html index 273cf9ea12..8598d2ba53 100644 --- a/mayan/apps/appearance/templates/appearance/home.html +++ b/mayan/apps/appearance/templates/appearance/home.html @@ -4,6 +4,7 @@ {% load static %} {% load common_tags %} +{% load dashboards_tags %} {% load navigation_tags %} {% block title %}{% trans 'Dashboard' %}{% endblock %} diff --git a/mayan/apps/checkouts/apps.py b/mayan/apps/checkouts/apps.py index ce28781f06..8d7d425970 100644 --- a/mayan/apps/checkouts/apps.py +++ b/mayan/apps/checkouts/apps.py @@ -12,7 +12,7 @@ from mayan.apps.acls import ModelPermission from mayan.apps.common import ( MayanAppConfig, menu_facet, menu_main, menu_sidebar ) -from mayan.apps.common.dashboards import dashboard_main +from mayan.apps.dashboards.dashboards import dashboard_main from mayan.apps.events import ModelEventType from mayan.celery import app diff --git a/mayan/apps/checkouts/dashboard_widgets.py b/mayan/apps/checkouts/dashboard_widgets.py index 5942ca27f4..53bcd6eb08 100644 --- a/mayan/apps/checkouts/dashboard_widgets.py +++ b/mayan/apps/checkouts/dashboard_widgets.py @@ -4,7 +4,7 @@ from django.apps import apps from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from mayan.apps.common.classes import DashboardWidgetNumeric +from mayan.apps.dashboards.classes import DashboardWidgetNumeric from mayan.apps.documents.permissions import permission_document_view from .icons import icon_dashboard_checkouts diff --git a/mayan/apps/common/classes.py b/mayan/apps/common/classes.py index 380e8d9a18..18db047f6f 100644 --- a/mayan/apps/common/classes.py +++ b/mayan/apps/common/classes.py @@ -53,95 +53,6 @@ class Collection(object): return self._model.objects.all() -class Dashboard(object): - _registry = {} - - @classmethod - def get(cls, name): - return cls._registry[name] - - def __init__(self, name, label): - self.name = name - self.label = label - self.widgets = {} - self.removed_widgets = [] - self.__class__._registry[name] = self - - def add_widget(self, widget, order=0): - self.widgets[widget] = {'widget': widget, 'order': order} - - def get_widgets(self): - """ - Returns a list of widgets sorted by their 'order'. - If two or more widgets have the same 'order', sort by label. - """ - return map( - lambda x: x['widget'], - filter( - lambda x: x['widget'] not in self.removed_widgets, - sorted( - self.widgets.values(), - key=lambda x: (x['order'], x['widget'].label) - ) - ) - ) - - def remove_widget(self, widget): - self.removed_widgets.append(widget) - - def render(self, request): - rendered_widgets = [widget().render(request=request) for widget in self.get_widgets()] - - return loader.render_to_string( - template_name='dashboard/dashboard.html', context={ - 'widgets': rendered_widgets - } - ) - - -class BaseDashboardWidget(object): - _registry = {} - context = {} - template_name = None - - @classmethod - def get(cls, name): - return cls._registry[name] - - @classmethod - def get_all(cls): - return cls._registry.items() - - @classmethod - def register(cls, klass): - cls._registry[klass.name] = klass - - def get_context(self): - return self.context - - def render(self, request): - if self.template_name: - return loader.render_to_string( - template_name=self.template_name, context=self.get_context(), - ) - - -class DashboardWidgetNumeric(BaseDashboardWidget): - count = 0 - icon_class = None - label = None - link = None - template_name = 'dashboard/numeric_widget.html' - - def get_context(self): - return { - 'count': self.count, - 'icon_class': self.icon_class, - 'label': self.label, - 'link': self.link, - } - - @python_2_unicode_compatible class ErrorLogNamespace(object): def __init__(self, name, label=None): diff --git a/mayan/apps/common/templatetags/common_tags.py b/mayan/apps/common/templatetags/common_tags.py index 3e14df762c..daaf3975c0 100644 --- a/mayan/apps/common/templatetags/common_tags.py +++ b/mayan/apps/common/templatetags/common_tags.py @@ -8,7 +8,7 @@ from django.utils.encoding import force_text import mayan -from ..classes import Collection, Dashboard +from ..classes import Collection from ..literals import MESSAGE_SQLITE_WARNING from ..utils import check_for_sqlite, resolve_attribute @@ -49,11 +49,6 @@ def project_information(attribute_name): return getattr(mayan, attribute_name) -@register.simple_tag(takes_context=True) -def render_dashboard(context, name): - return Dashboard.get(name=name).render(request=context.request) - - @register.simple_tag(takes_context=True) def render_subtemplate(context, template_name, template_context): """ diff --git a/mayan/apps/dashboards/__init__.py b/mayan/apps/dashboards/__init__.py new file mode 100644 index 0000000000..6ad44301d1 --- /dev/null +++ b/mayan/apps/dashboards/__init__.py @@ -0,0 +1,3 @@ +from __future__ import unicode_literals + +default_app_config = 'mayan.apps.dashboards.apps.DashboardsApp' diff --git a/mayan/apps/dashboards/apps.py b/mayan/apps/dashboards/apps.py new file mode 100644 index 0000000000..3e61507952 --- /dev/null +++ b/mayan/apps/dashboards/apps.py @@ -0,0 +1,15 @@ +from __future__ import unicode_literals + +from django.apps import apps +from django.utils.translation import ugettext_lazy as _ + +from mayan.apps.common import MayanAppConfig + + +class DashboardsApp(MayanAppConfig): + app_namespace = 'dashboards' + app_url = 'dashboards' + has_rest_api = False + has_tests = False + name = 'mayan.apps.dashboards' + verbose_name = _('Dashboards') diff --git a/mayan/apps/dashboards/classes.py b/mayan/apps/dashboards/classes.py new file mode 100644 index 0000000000..44be741d68 --- /dev/null +++ b/mayan/apps/dashboards/classes.py @@ -0,0 +1,98 @@ +from __future__ import unicode_literals + +from django.apps import apps +from django.db import models +from django.template import loader +from django.template.response import TemplateResponse +from django.urls import reverse +from django.utils.encoding import force_text, python_2_unicode_compatible +from django.utils.translation import ugettext + + +class Dashboard(object): + _registry = {} + + @classmethod + def get(cls, name): + return cls._registry[name] + + def __init__(self, name, label): + self.name = name + self.label = label + self.widgets = {} + self.removed_widgets = [] + self.__class__._registry[name] = self + + def add_widget(self, widget, order=0): + self.widgets[widget] = {'widget': widget, 'order': order} + + def get_widgets(self): + """ + Returns a list of widgets sorted by their 'order'. + If two or more widgets have the same 'order', sort by label. + """ + return map( + lambda x: x['widget'], + filter( + lambda x: x['widget'] not in self.removed_widgets, + sorted( + self.widgets.values(), + key=lambda x: (x['order'], x['widget'].label) + ) + ) + ) + + def remove_widget(self, widget): + self.removed_widgets.append(widget) + + def render(self, request): + rendered_widgets = [widget().render(request=request) for widget in self.get_widgets()] + + return loader.render_to_string( + template_name='dashboards/dashboard.html', context={ + 'widgets': rendered_widgets + } + ) + + +class BaseDashboardWidget(object): + _registry = {} + context = {} + template_name = None + + @classmethod + def get(cls, name): + return cls._registry[name] + + @classmethod + def get_all(cls): + return cls._registry.items() + + @classmethod + def register(cls, klass): + cls._registry[klass.name] = klass + + def get_context(self): + return self.context + + def render(self, request): + if self.template_name: + return loader.render_to_string( + template_name=self.template_name, context=self.get_context(), + ) + + +class DashboardWidgetNumeric(BaseDashboardWidget): + count = 0 + icon_class = None + label = None + link = None + template_name = 'dashboards/numeric_widget.html' + + def get_context(self): + return { + 'count': self.count, + 'icon_class': self.icon_class, + 'label': self.label, + 'link': self.link, + } diff --git a/mayan/apps/common/dashboards.py b/mayan/apps/dashboards/dashboards.py similarity index 100% rename from mayan/apps/common/dashboards.py rename to mayan/apps/dashboards/dashboards.py diff --git a/mayan/apps/dashboards/locale/ar/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/ar/LC_MESSAGES/django.po new file mode 100644 index 0000000000..1bace77615 --- /dev/null +++ b/mayan/apps/dashboards/locale/ar/LC_MESSAGES/django.po @@ -0,0 +1,32 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 " +"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/bg/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/bg/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/bg/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/bs_BA/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/bs_BA/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/bs_BA/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/da/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/da/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/da/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/de_DE/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/de_DE/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/de_DE/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/en/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/en/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/es/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/fa/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/fa/LC_MESSAGES/django.po new file mode 100644 index 0000000000..8a8edce01e --- /dev/null +++ b/mayan/apps/dashboards/locale/fa/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/fr/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 0000000000..9dd456560c --- /dev/null +++ b/mayan/apps/dashboards/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/hu/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/hu/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/hu/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/id/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/id/LC_MESSAGES/django.po new file mode 100644 index 0000000000..8a8edce01e --- /dev/null +++ b/mayan/apps/dashboards/locale/id/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/it/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/it/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/it/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/nl_NL/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/nl_NL/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/nl_NL/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/pl/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 0000000000..ead0d0b9c0 --- /dev/null +++ b/mayan/apps/dashboards/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n" +"%100<12 || n%100>=14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n" +"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/pt/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/pt/LC_MESSAGES/django.po new file mode 100644 index 0000000000..e36d6884d5 --- /dev/null +++ b/mayan/apps/dashboards/locale/pt/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/pt_BR/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/pt_BR/LC_MESSAGES/django.po new file mode 100644 index 0000000000..9dd456560c --- /dev/null +++ b/mayan/apps/dashboards/locale/pt_BR/LC_MESSAGES/django.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/ro_RO/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/ro_RO/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/ro_RO/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/ru/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 0000000000..2e9220eeee --- /dev/null +++ b/mayan/apps/dashboards/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" +"%100>=11 && n%100<=14)? 2 : 3);\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/sl_SI/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/sl_SI/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/sl_SI/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/tr_TR/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/tr_TR/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/tr_TR/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/vi_VN/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/vi_VN/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/vi_VN/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/locale/zh_CN/LC_MESSAGES/django.po b/mayan/apps/dashboards/locale/zh_CN/LC_MESSAGES/django.po new file mode 100644 index 0000000000..049c8763ba --- /dev/null +++ b/mayan/apps/dashboards/locale/zh_CN/LC_MESSAGES/django.po @@ -0,0 +1,30 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-16 00:31-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: apps.py:15 +msgid "Dashboards" +msgstr "" + +#: dashboards.py:7 +msgid "Main" +msgstr "" + +#: templates/dashboards/numeric_widget.html:27 +msgid "View details" +msgstr "" diff --git a/mayan/apps/dashboards/models.py b/mayan/apps/dashboards/models.py new file mode 100644 index 0000000000..1dfab76043 --- /dev/null +++ b/mayan/apps/dashboards/models.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models + +# Create your models here. diff --git a/mayan/apps/appearance/templates/dashboard/dashboard.html b/mayan/apps/dashboards/templates/dashboards/dashboard.html similarity index 100% rename from mayan/apps/appearance/templates/dashboard/dashboard.html rename to mayan/apps/dashboards/templates/dashboards/dashboard.html diff --git a/mayan/apps/appearance/templates/dashboard/numeric_widget.html b/mayan/apps/dashboards/templates/dashboards/numeric_widget.html similarity index 100% rename from mayan/apps/appearance/templates/dashboard/numeric_widget.html rename to mayan/apps/dashboards/templates/dashboards/numeric_widget.html diff --git a/mayan/apps/dashboards/templatetags/__init__.py b/mayan/apps/dashboards/templatetags/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mayan/apps/dashboards/templatetags/dashboards_tags.py b/mayan/apps/dashboards/templatetags/dashboards_tags.py new file mode 100644 index 0000000000..d3cab05e88 --- /dev/null +++ b/mayan/apps/dashboards/templatetags/dashboards_tags.py @@ -0,0 +1,12 @@ +from __future__ import unicode_literals + +from django.template import Context, Library + +from ..classes import Dashboard + +register = Library() + + +@register.simple_tag(takes_context=True) +def render_dashboard(context, name): + return Dashboard.get(name=name).render(request=context.request) diff --git a/mayan/apps/dashboards/views.py b/mayan/apps/dashboards/views.py new file mode 100644 index 0000000000..e784a0bd2c --- /dev/null +++ b/mayan/apps/dashboards/views.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.shortcuts import render + +# Create your views here. diff --git a/mayan/apps/documents/apps.py b/mayan/apps/documents/apps.py index 49b6e585c7..34bf7e17a0 100644 --- a/mayan/apps/documents/apps.py +++ b/mayan/apps/documents/apps.py @@ -18,7 +18,6 @@ from mayan.apps.common import ( menu_tools ) from mayan.apps.common.classes import ModelField, Template -from mayan.apps.common.dashboards import dashboard_main from mayan.apps.common.signals import post_initial_setup from mayan.apps.common.widgets import TwoStateWidget from mayan.apps.converter.links import link_transformation_list @@ -26,6 +25,7 @@ from mayan.apps.converter.permissions import ( permission_transformation_create, permission_transformation_delete, permission_transformation_edit, permission_transformation_view ) +from mayan.apps.dashboards.dashboards import dashboard_main from mayan.apps.events import ModelEventType from mayan.apps.events.links import ( link_events_for_object, link_object_event_types_user_subcriptions_list diff --git a/mayan/apps/documents/dashboard_widgets.py b/mayan/apps/documents/dashboard_widgets.py index 476bf861b7..e5a8b70e3b 100644 --- a/mayan/apps/documents/dashboard_widgets.py +++ b/mayan/apps/documents/dashboard_widgets.py @@ -4,7 +4,7 @@ from django.apps import apps from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from mayan.apps.common.classes import DashboardWidgetNumeric +from mayan.apps.dashboards.classes import DashboardWidgetNumeric from .icons import ( icon_dashboard_document_types, icon_dashboard_documents_in_trash, diff --git a/mayan/settings/base.py b/mayan/settings/base.py index 6d3034930e..e261dbb61d 100644 --- a/mayan/settings/base.py +++ b/mayan/settings/base.py @@ -88,6 +88,7 @@ INSTALLED_APPS = ( 'mayan.apps.autoadmin', 'mayan.apps.common', 'mayan.apps.converter', + 'mayan.apps.dashboards', 'mayan.apps.django_gpg', 'mayan.apps.dynamic_search', 'mayan.apps.events',