mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
settings UI integration
This commit is contained in:
parent
682ee87267
commit
771c453c40
22
InvenTree/part/templatetags/plugin_extras.py
Normal file
22
InvenTree/part/templatetags/plugin_extras.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
""" This module provides template tags for handeling plugins
|
||||||
|
"""
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.conf import settings as djangosettings
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag()
|
||||||
|
def plugin_list(*args, **kwargs):
|
||||||
|
""" Return a list of all installed integration plugins """
|
||||||
|
return djangosettings.INTEGRATION_PLUGIN_LIST
|
||||||
|
|
||||||
|
@register.simple_tag()
|
||||||
|
def plugin_settings(plugin, *args, **kwargs):
|
||||||
|
""" Return a list of all settings for a plugin """
|
||||||
|
return djangosettings.INTEGRATION_PLUGIN_SETTING.get(plugin)
|
@ -1,4 +1,5 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load plugin_extras %}
|
||||||
|
|
||||||
<ul class='list-group'>
|
<ul class='list-group'>
|
||||||
|
|
||||||
@ -116,6 +117,22 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li class='list-group-item'>
|
||||||
|
<strong>{% trans "Plugin Settings" %}</strong>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% plugin_list as pl_list %}
|
||||||
|
{% for plugin_key, plugin in pl_list.items %}
|
||||||
|
{% if plugin.has_settings %}
|
||||||
|
<li class='list-group-item' title='{{ plugin.plugin_name }}'>
|
||||||
|
<a href='#' class='nav-toggle' id='select-plugin-{{plugin_key}}'>
|
||||||
|
{{ plugin.plugin_name}}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
25
InvenTree/templates/InvenTree/settings/plugin_settings.html
Normal file
25
InvenTree/templates/InvenTree/settings/plugin_settings.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% extends "panel.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% load inventree_extras %}
|
||||||
|
{% load plugin_extras %}
|
||||||
|
|
||||||
|
{% block label %}plugin-{{plugin_key}}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block heading %}
|
||||||
|
{% blocktrans with name=plugin.plugin_name %}Plugin Settings for {{name}}{% endblocktrans %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% plugin_settings plugin_key as plugin_settings %}
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed'>
|
||||||
|
{% include "InvenTree/settings/header.html" %}
|
||||||
|
<tbody>
|
||||||
|
{% for setting in plugin_settings %}
|
||||||
|
{% include "InvenTree/settings/setting.html" with key=setting%}
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
@ -3,6 +3,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
|
{% load plugin_extras %}
|
||||||
|
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
{% inventree_title %} | {% trans "Settings" %}
|
{% inventree_title %} | {% trans "Settings" %}
|
||||||
@ -34,6 +35,13 @@
|
|||||||
{% include "InvenTree/settings/po.html" %}
|
{% include "InvenTree/settings/po.html" %}
|
||||||
{% include "InvenTree/settings/so.html" %}
|
{% include "InvenTree/settings/so.html" %}
|
||||||
|
|
||||||
|
{% plugin_list as pl_list %}
|
||||||
|
{% for plugin_key, plugin in pl_list.items %}
|
||||||
|
{% if plugin.has_settings %}
|
||||||
|
{% include "InvenTree/settings/plugin_settings.html" %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user