From a3c1b0873dfeb5b75482be24ad94bf63fb3a6fbb Mon Sep 17 00:00:00 2001
From: Roberto Rosario
- http://mayan.readthedocs.org/ -
- -- https://gitlab.com/mayan-edms/mayan-edms/ -
- -- https://gitlab.com/mayan-edms/mayan-edms/issues + {% project_website %}
diff --git a/mayan/apps/appearance/templates/navigation/generic_link_instance.html b/mayan/apps/appearance/templates/navigation/generic_link_instance.html index f35dbd6e98..4ff963a37a 100644 --- a/mayan/apps/appearance/templates/navigation/generic_link_instance.html +++ b/mayan/apps/appearance/templates/navigation/generic_link_instance.html @@ -2,8 +2,8 @@
{% else %} {% if link.disabled %} - {% if link.icon %} {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} + {% if link.icon %} {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} {% else %} - {% if link.icon %} {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} + {% if link.icon %} {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} {% endif %} {% endif %} diff --git a/mayan/apps/common/apps.py b/mayan/apps/common/apps.py index 8b1a51ba33..09caf48444 100644 --- a/mayan/apps/common/apps.py +++ b/mayan/apps/common/apps.py @@ -13,17 +13,19 @@ from django.db.models.signals import post_save from django.utils.translation import ugettext_lazy as _ from mayan.celery import app +from navigation.classes import Separator from .handlers import ( user_locale_profile_session_config, user_locale_profile_create ) from .links import ( - link_about, link_current_user_details, link_current_user_edit, - link_current_user_locale_profile_edit, link_filters, link_license, - link_packages_licenses, link_setup, link_tools + link_about, link_code, link_current_user_details, link_current_user_edit, + link_current_user_locale_profile_edit, link_documentation, link_filters, + link_forum, link_license, link_packages_licenses, link_setup, link_support, + link_tools ) from .literals import DELETE_STALE_UPLOADS_INTERVAL -from .menus import menu_facet, menu_main, menu_tools, menu_user +from .menus import menu_about, menu_facet, menu_main, menu_tools, menu_user from .licenses import * # NOQA from .settings import setting_auto_logging from .tasks import task_delete_stale_uploads # NOQA - Force task registration @@ -106,7 +108,6 @@ class CommonApp(MayanAppConfig): }, } ) - from navigation.classes import Separator menu_user.bind_links( links=( link_current_user_details, link_current_user_edit, @@ -115,14 +116,14 @@ class CommonApp(MayanAppConfig): ) ) - menu_facet.bind_links( - links=(link_about, link_license, link_packages_licenses), - sources=( - 'common:about_view', 'common:license_view', - 'common:packages_licenses_view' + menu_about.bind_links( + links=( + link_about, link_support, link_documentation, link_forum, + link_code, link_license, link_packages_licenses, ) ) - menu_main.bind_links(links=(link_about,), position=99) + + menu_main.bind_links(links=(menu_about,), position=99) menu_tools.bind_links( links=(link_filters,) diff --git a/mayan/apps/common/links.py b/mayan/apps/common/links.py index 4359092c2a..35c48647e6 100644 --- a/mayan/apps/common/links.py +++ b/mayan/apps/common/links.py @@ -6,7 +6,7 @@ from navigation import Link link_about = Link( - icon='fa fa-question', text=_('About'), view='common:about_view' + icon='fa fa-info', text=_('About this'), view='common:about_view' ) link_current_user_details = Link( icon='fa fa-user', text=_('User details'), @@ -23,20 +23,36 @@ link_current_user_locale_profile_edit = Link( icon='fa fa-globe', text=_('Edit locale profile'), view='common:current_user_locale_profile_edit' ) +link_code = Link( + icon='fa fa-code-fork', tags='new_window', text=_('Source code'), + url='https://gitlab.com/mayan-edms/mayan-edms' +) +link_documentation = Link( + icon='fa fa-book', tags='new_window', text=_('Documentation'), + url='https://mayan.readthedocs.io/en/stable/' +) link_filters = Link( icon='fa fa-filter', text=_('Data filters'), view='common:filter_selection' ) +link_forum = Link( + icon='fa fa-life-ring', tags='new_window', text=_('Forum'), + url='https://groups.google.com/forum/#!forum/mayan-edms' +) link_license = Link( - icon='fa fa-book', text=_('License'), view='common:license_view' + icon='fa fa-certificate', text=_('License'), view='common:license_view' ) link_packages_licenses = Link( - icon='fa fa-book', text=_('Other packages licenses'), + icon='fa fa-certificate', text=_('Other packages licenses'), view='common:packages_licenses_view' ) link_setup = Link( icon='fa fa-gear', text=_('Setup'), view='common:setup_list' ) +link_support = Link( + icon='fa fa-phone', tags='new_window', text=_('Support'), + url='http://www.mayan-edms.com/providers/' +) link_tools = Link( icon='fa fa-wrench', text=_('Tools'), view='common:tools_list' ) diff --git a/mayan/apps/common/menus.py b/mayan/apps/common/menus.py index 3ebeb82b95..1b725d26ac 100644 --- a/mayan/apps/common/menus.py +++ b/mayan/apps/common/menus.py @@ -1,12 +1,15 @@ from __future__ import unicode_literals +from django.utils.translation import ugettext_lazy as _ + from navigation import Menu __all__ = ( - 'menu_facet', 'menu_object', 'menu_main', 'menu_multi_item', + 'menu_about', 'menu_facet', 'menu_object', 'menu_main', 'menu_multi_item', 'menu_secondary', 'menu_setup', 'menu_sidebar', 'menu_tools', 'menu_user' ) +menu_about = Menu(icon='fa fa-info', label=_('About'), name='about menu') menu_facet = Menu(name='object facet') menu_object = Menu(name='object menu') menu_main = Menu(name='main menu') diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index f6ef5bad04..6c065ca5f2 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -236,10 +236,11 @@ class Menu(object): class Link(object): - def __init__(self, text, view, args=None, condition=None, + def __init__(self, text, view=None, args=None, condition=None, conditional_disable=None, description=None, icon=None, keep_query=False, kwargs=None, permissions=None, - permissions_related=None, remove_from_query=None, tags=None): + permissions_related=None, remove_from_query=None, tags=None, + url=None): self.args = args or [] self.condition = condition @@ -254,6 +255,7 @@ class Link(object): self.tags = tags self.text = text self.view = view + self.url = url def resolve(self, context, resolved_object=None): AccessControlList = apps.get_model( @@ -299,40 +301,42 @@ class Link(object): resolved_link = ResolvedLink(current_view=current_view, link=self) - view_name = Variable('"{}"'.format(self.view)) - if isinstance(self.args, list) or isinstance(self.args, tuple): - # TODO: Don't check for instance check for iterable in try/except - # block. This update required changing all 'args' argument in - # links.py files to be iterables and not just strings. - args = [Variable(arg) for arg in self.args] - else: - args = [Variable(self.args)] + if self.view: + view_name = Variable('"{}"'.format(self.view)) + if isinstance(self.args, list) or isinstance(self.args, tuple): + # TODO: Don't check for instance check for iterable in try/except + # block. This update required changing all 'args' argument in + # links.py files to be iterables and not just strings. + args = [Variable(arg) for arg in self.args] + else: + args = [Variable(self.args)] - # If we were passed an instance of the view context object we are - # resolving, inject it into the context. This help resolve links for - # object lists. - if resolved_object: - context['resolved_object'] = resolved_object + # If we were passed an instance of the view context object we are + # resolving, inject it into the context. This help resolve links for + # object lists. + if resolved_object: + context['resolved_object'] = resolved_object - try: - kwargs = self.kwargs(context) - except TypeError: - # Is not a callable - kwargs = self.kwargs + try: + kwargs = self.kwargs(context) + except TypeError: + # Is not a callable + kwargs = self.kwargs - kwargs = {key: Variable(value) for key, value in kwargs.iteritems()} + kwargs = {key: Variable(value) for key, value in kwargs.iteritems()} - # Use Django's exact {% url %} code to resolve the link - node = URLNode( - view_name=view_name, args=args, kwargs=kwargs, asvar=None - ) - - try: - resolved_link.url = node.render(context) - except Exception as exception: - logger.error( - 'Error resolving link "%s" URL; %s', self.text, exception + # Use Django's exact {% url %} code to resolve the link + node = URLNode( + view_name=view_name, args=args, kwargs=kwargs, asvar=None ) + try: + resolved_link.url = node.render(context) + except Exception as exception: + logger.error( + 'Error resolving link "%s" URL; %s', self.text, exception + ) + elif self.url: + resolved_link.url = self.url # This is for links that should be displayed but that are not clickable if self.conditional_disable: