mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
mixin_enabled check for templates
This commit is contained in:
parent
1c781d9bf0
commit
3b2cb43ece
@ -19,3 +19,9 @@ def plugin_list(*args, **kwargs):
|
||||
def plugin_settings(plugin, *args, **kwargs):
|
||||
""" Return a list of all settings for a plugin """
|
||||
return djangosettings.INTEGRATION_PLUGIN_SETTING.get(plugin)
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
def mixin_enabled(plugin, key, *args, **kwargs):
|
||||
""" Return if the mixin is existant and configured in the plugin """
|
||||
return plugin.mixin_enabled(key)
|
||||
|
@ -25,12 +25,15 @@
|
||||
<tbody>
|
||||
{% plugin_list as pl_list %}
|
||||
{% for plugin_key, plugin in pl_list.items %}
|
||||
{% mixin_enabled plugin 'urls' as urls %}
|
||||
{% mixin_enabled plugin 'settings' as settings %}
|
||||
|
||||
<tr>
|
||||
<td>{{plugin_key}} - {{ plugin.plugin_name}}
|
||||
{% if plugin.has_urls %}
|
||||
{% if urls %}
|
||||
<span class='badge'><a class='nav-toggle text-success' id='select-plugin-{{plugin_key}}'>{% trans 'Has urls' %}</a></span>
|
||||
{% endif %}
|
||||
{% if plugin.has_settings %}
|
||||
{% if settings %}
|
||||
<span class='badge'><a class='nav-toggle text-success' id='select-plugin-{{plugin_key}}'>{% trans 'Has settings' %}</a></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
|
@ -7,10 +7,14 @@
|
||||
|
||||
|
||||
{% block heading %}
|
||||
{% blocktrans with name=plugin.plugin_name %}Plugin Settings for {{name}}{% endblocktrans %}
|
||||
{% blocktrans with name=plugin.plugin_name %}Plugin details for {{name}}{% endblocktrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% mixin_enabled plugin 'settings' as settings %}
|
||||
{% if settings %}
|
||||
<h4>{% trans "Settings" %}</h4>
|
||||
{% plugin_settings plugin_key as plugin_settings %}
|
||||
|
||||
<table class='table table-striped table-condensed'>
|
||||
@ -21,8 +25,10 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{% if plugin.has_urls %}
|
||||
{% mixin_enabled plugin 'urls' as urls %}
|
||||
{% if urls %}
|
||||
<h4>{% trans "URLs" %}</h4>
|
||||
{% define plugin.base_url as base %}
|
||||
<p>{% blocktrans %}The Base-URL for this plugin is <a href="/{{ base }}" target="_blank"><strong>{{ base }}</strong></a>.{% endblocktrans %}</p>
|
||||
|
Loading…
Reference in New Issue
Block a user