diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 5f815d889a..2e28ddf077 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -118,6 +118,7 @@ translated_javascript_urls = [ url(r'^part.js', DynamicJsView.as_view(template_name='js/translated/part.js'), name='part.js'), url(r'^report.js', DynamicJsView.as_view(template_name='js/translated/report.js'), name='report.js'), url(r'^stock.js', DynamicJsView.as_view(template_name='js/translated/stock.js'), name='stock.js'), + url(r'^plugin.js', DynamicJsView.as_view(template_name='js/translated/plugin.js'), name='plugin.js'), url(r'^tables.js', DynamicJsView.as_view(template_name='js/translated/tables.js'), name='tables.js'), url(r'^table_filters.js', DynamicJsView.as_view(template_name='js/translated/table_filters.js'), name='table_filters.js'), ] diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index 923c1e5910..920d0b7804 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -28,8 +28,11 @@

{% trans "Plugin list" %} +
{% url 'admin:plugin_pluginconfig_changelist' as url %} {% include "admin_button.html" with url=url %} + +

diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html index 8b625c2eff..91202e7c21 100644 --- a/InvenTree/templates/InvenTree/settings/settings.html +++ b/InvenTree/templates/InvenTree/settings/settings.html @@ -322,6 +322,10 @@ $("#import-part").click(function() { launchModalForm("{% url 'api-part-import' %}?reset", {}); }); +$("#install-plugin").click(function() { + installPlugin(); +}); + enableSidebar('settings'); {% endblock %} diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 262a749bfa..b052f68e45 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -177,6 +177,7 @@ + diff --git a/InvenTree/templates/js/translated/plugin.js b/InvenTree/templates/js/translated/plugin.js new file mode 100644 index 0000000000..2f57631424 --- /dev/null +++ b/InvenTree/templates/js/translated/plugin.js @@ -0,0 +1,26 @@ +{% load i18n %} +{% load inventree_extras %} + +/* globals + constructForm, +*/ + +/* exported + installPlugin, +*/ + +function installPlugin() { + constructForm(`/api/plugin/install/`, { + method: 'POST', + title: '{% trans "Install Plugin" %}', + fields: { + url: {}, + packagename: {}, + confirm: {}, + }, + onSuccess: function(data) { + msg = '{% trans "The Plugin was installed" %}'; + showMessage(msg, {style: 'success', details: data.result, timeout: 30000}); + } + }); +} \ No newline at end of file