Complete prefixing template tags with app names
Additionally remove unused template tags. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django import forms
|
||||
|
||||
|
||||
class MultiItemForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
actions = kwargs.pop('actions', [])
|
||||
if actions:
|
||||
actions.insert(0, ['', '---'])
|
||||
|
||||
super(MultiItemForm, self).__init__(*args, **kwargs)
|
||||
|
||||
self.fields['action'].choices = actions
|
||||
|
||||
action = forms.ChoiceField(
|
||||
label='', required=False, widget=forms.widgets.Select(
|
||||
attrs={'class': 'select-auto-submit'}
|
||||
)
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
{% load common_tags %}
|
||||
{% load navigation_tags %}
|
||||
|
||||
{% if link|get_type == "<class 'mayan.apps.navigation.classes.Menu'>" %}
|
||||
{% if link|common_get_type == "<class 'mayan.apps.navigation.classes.Menu'>" %}
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">
|
||||
{% if link.icon_class %}{{ link.icon_class.render }}{% endif %}
|
||||
|
||||
@@ -2,52 +2,11 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.template import Library
|
||||
|
||||
from ..classes import Link, Menu, SourceColumn
|
||||
from ..forms import MultiItemForm
|
||||
from ..classes import Menu, SourceColumn
|
||||
|
||||
register = Library()
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def get_link(name):
|
||||
return Link.get(name)
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def get_menu(name):
|
||||
return Menu.get(name)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def get_menu_links(context, name, source=None, sort_results=None):
|
||||
return Menu.get(name).resolve(context=context, source=source, sort_results=sort_results)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def get_menus_links(context, names, source=None, sort_results=None):
|
||||
result = []
|
||||
|
||||
for name in names.split(','):
|
||||
for links in Menu.get(name=name).resolve(context=context, sort_results=sort_results):
|
||||
if links:
|
||||
result.append(links)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def get_multi_item_links_form(context, object_list):
|
||||
actions = []
|
||||
for link_set in Menu.get('multi item').resolve(context=context, source=object_list[0], sort_results=True):
|
||||
for link in link_set['links']:
|
||||
if hasattr(link, 'url'):
|
||||
actions.append((link.url, link.text))
|
||||
|
||||
form = MultiItemForm(actions=actions)
|
||||
context.update({'multi_item_form': form, 'multi_item_actions': actions})
|
||||
return ''
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def navigation_get_sort_field_querystring(context, column):
|
||||
return column.get_sort_field_querystring(context=context)
|
||||
@@ -108,12 +67,6 @@ def navigation_resolve_menus(context, names, source=None, sort_results=None):
|
||||
return result
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def resolve_link(context, link):
|
||||
# This can be used to resolve links or menus too
|
||||
return link.resolve(context=context)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def navigation_source_column_resolve(context, column):
|
||||
if column:
|
||||
|
||||
Reference in New Issue
Block a user