Add links to the documentation, support page, forum and source in
the about menu. Make the about menu a nested menu.
This commit is contained in:
@@ -69,19 +69,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<i class="fa fa-link"></i><a href="{% project_website %}"> {% project_website %}</a>
|
<i class="fa fa-home"></i><a href="{% project_website %}"> {% project_website %}</a>
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="text-center">
|
|
||||||
<i class="fa fa-book"></i> <a href="http://readthedocs.org/docs/mayan/en/latest/"> http://mayan.readthedocs.org/</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="text-center">
|
|
||||||
<i class="fa fa-wrench"></i> <a href="https://gitlab.com/mayan-edms/mayan-edms/"> https://gitlab.com/mayan-edms/mayan-edms/</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="text-center">
|
|
||||||
<i class="fa fa-bug"></i> <a href="https://gitlab.com/mayan-edms/mayan-edms/issues"> https://gitlab.com/mayan-edms/mayan-edms/issues</a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if link.disabled %}
|
{% if link.disabled %}
|
||||||
<a class="{% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" disabled='disabled' style="cursor: default;" href="#">{% if link.icon %}<i class="hidden-xs hidden-sm {{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
<a class="{% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %}" disabled='disabled' style="cursor: default;" href="#">{% if link.icon %}<i class="hidden-xs hidden-sm {{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="{% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" href="{{ link.url }}">{% if link.icon %}<i class="hidden-xs hidden-sm {{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
<a class="{% if link_classes %}{{ link_classes }} {% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %}" href="{{ link.url }}">{% if link.icon %}<i class="hidden-xs hidden-sm {{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
+12
-11
@@ -13,17 +13,19 @@ from django.db.models.signals import post_save
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from mayan.celery import app
|
from mayan.celery import app
|
||||||
|
from navigation.classes import Separator
|
||||||
|
|
||||||
from .handlers import (
|
from .handlers import (
|
||||||
user_locale_profile_session_config, user_locale_profile_create
|
user_locale_profile_session_config, user_locale_profile_create
|
||||||
)
|
)
|
||||||
from .links import (
|
from .links import (
|
||||||
link_about, link_current_user_details, link_current_user_edit,
|
link_about, link_code, link_current_user_details, link_current_user_edit,
|
||||||
link_current_user_locale_profile_edit, link_filters, link_license,
|
link_current_user_locale_profile_edit, link_documentation, link_filters,
|
||||||
link_packages_licenses, link_setup, link_tools
|
link_forum, link_license, link_packages_licenses, link_setup, link_support,
|
||||||
|
link_tools
|
||||||
)
|
)
|
||||||
from .literals import DELETE_STALE_UPLOADS_INTERVAL
|
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 .licenses import * # NOQA
|
||||||
from .settings import setting_auto_logging
|
from .settings import setting_auto_logging
|
||||||
from .tasks import task_delete_stale_uploads # NOQA - Force task registration
|
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(
|
menu_user.bind_links(
|
||||||
links=(
|
links=(
|
||||||
link_current_user_details, link_current_user_edit,
|
link_current_user_details, link_current_user_edit,
|
||||||
@@ -115,14 +116,14 @@ class CommonApp(MayanAppConfig):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
menu_facet.bind_links(
|
menu_about.bind_links(
|
||||||
links=(link_about, link_license, link_packages_licenses),
|
links=(
|
||||||
sources=(
|
link_about, link_support, link_documentation, link_forum,
|
||||||
'common:about_view', 'common:license_view',
|
link_code, link_license, link_packages_licenses,
|
||||||
'common:packages_licenses_view'
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
menu_main.bind_links(links=(link_about,), position=99)
|
|
||||||
|
menu_main.bind_links(links=(menu_about,), position=99)
|
||||||
|
|
||||||
menu_tools.bind_links(
|
menu_tools.bind_links(
|
||||||
links=(link_filters,)
|
links=(link_filters,)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from navigation import Link
|
|||||||
|
|
||||||
|
|
||||||
link_about = 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(
|
link_current_user_details = Link(
|
||||||
icon='fa fa-user', text=_('User details'),
|
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'),
|
icon='fa fa-globe', text=_('Edit locale profile'),
|
||||||
view='common:current_user_locale_profile_edit'
|
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(
|
link_filters = Link(
|
||||||
icon='fa fa-filter', text=_('Data filters'),
|
icon='fa fa-filter', text=_('Data filters'),
|
||||||
view='common:filter_selection'
|
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(
|
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(
|
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'
|
view='common:packages_licenses_view'
|
||||||
)
|
)
|
||||||
link_setup = Link(
|
link_setup = Link(
|
||||||
icon='fa fa-gear', text=_('Setup'), view='common:setup_list'
|
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(
|
link_tools = Link(
|
||||||
icon='fa fa-wrench', text=_('Tools'), view='common:tools_list'
|
icon='fa fa-wrench', text=_('Tools'), view='common:tools_list'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from navigation import Menu
|
from navigation import Menu
|
||||||
|
|
||||||
__all__ = (
|
__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_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_facet = Menu(name='object facet')
|
||||||
menu_object = Menu(name='object menu')
|
menu_object = Menu(name='object menu')
|
||||||
menu_main = Menu(name='main menu')
|
menu_main = Menu(name='main menu')
|
||||||
|
|||||||
@@ -236,10 +236,11 @@ class Menu(object):
|
|||||||
|
|
||||||
|
|
||||||
class Link(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,
|
conditional_disable=None, description=None, icon=None,
|
||||||
keep_query=False, kwargs=None, permissions=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.args = args or []
|
||||||
self.condition = condition
|
self.condition = condition
|
||||||
@@ -254,6 +255,7 @@ class Link(object):
|
|||||||
self.tags = tags
|
self.tags = tags
|
||||||
self.text = text
|
self.text = text
|
||||||
self.view = view
|
self.view = view
|
||||||
|
self.url = url
|
||||||
|
|
||||||
def resolve(self, context, resolved_object=None):
|
def resolve(self, context, resolved_object=None):
|
||||||
AccessControlList = apps.get_model(
|
AccessControlList = apps.get_model(
|
||||||
@@ -299,40 +301,42 @@ class Link(object):
|
|||||||
|
|
||||||
resolved_link = ResolvedLink(current_view=current_view, link=self)
|
resolved_link = ResolvedLink(current_view=current_view, link=self)
|
||||||
|
|
||||||
view_name = Variable('"{}"'.format(self.view))
|
if self.view:
|
||||||
if isinstance(self.args, list) or isinstance(self.args, tuple):
|
view_name = Variable('"{}"'.format(self.view))
|
||||||
# TODO: Don't check for instance check for iterable in try/except
|
if isinstance(self.args, list) or isinstance(self.args, tuple):
|
||||||
# block. This update required changing all 'args' argument in
|
# TODO: Don't check for instance check for iterable in try/except
|
||||||
# links.py files to be iterables and not just strings.
|
# block. This update required changing all 'args' argument in
|
||||||
args = [Variable(arg) for arg in self.args]
|
# links.py files to be iterables and not just strings.
|
||||||
else:
|
args = [Variable(arg) for arg in self.args]
|
||||||
args = [Variable(self.args)]
|
else:
|
||||||
|
args = [Variable(self.args)]
|
||||||
|
|
||||||
# If we were passed an instance of the view context object we are
|
# If we were passed an instance of the view context object we are
|
||||||
# resolving, inject it into the context. This help resolve links for
|
# resolving, inject it into the context. This help resolve links for
|
||||||
# object lists.
|
# object lists.
|
||||||
if resolved_object:
|
if resolved_object:
|
||||||
context['resolved_object'] = resolved_object
|
context['resolved_object'] = resolved_object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = self.kwargs(context)
|
kwargs = self.kwargs(context)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Is not a callable
|
# Is not a callable
|
||||||
kwargs = self.kwargs
|
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
|
# Use Django's exact {% url %} code to resolve the link
|
||||||
node = URLNode(
|
node = URLNode(
|
||||||
view_name=view_name, args=args, kwargs=kwargs, asvar=None
|
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
|
|
||||||
)
|
)
|
||||||
|
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
|
# This is for links that should be displayed but that are not clickable
|
||||||
if self.conditional_disable:
|
if self.conditional_disable:
|
||||||
|
|||||||
Reference in New Issue
Block a user