From 1fa1790f1432844fe79c544bb89990f5b4a4d2dc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jan 29 2019 13:30:06 +0000 Subject: Iterate through the blueprints to offer a link to their settings This allows third party plugins to offer a configuration page. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index 4d4a3b3..5bbf359 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -101,6 +101,18 @@ Delete Project {% endif %} + + {% for blueprint in main_app.iter_blueprints() %} + {% if blueprint.name not in [ + 'api_ns', 'ui_ns', 'internal_ns', 'theme'] %} + {{ blueprint.name }} + {% endif %} + {% endfor %} @@ -1198,6 +1210,32 @@ $('.remove-settings-field-row').click(function(e) { $(this).parent().parent().remove(); }); +$('.thirdparty_settings').click(function() { + $('.tab-pane fade active show').removeClass("active").removeClass("show"); + let name = $(this).attr("data-name"); + let target = $(this).attr("data-url"); + let _el = $('#' + name + '-tab'); + if (_el.length == 0) { + $.ajax({ + url: target , + type: 'GET', + dataType: 'html', + success: function(res) { + let _txt = '
' + + res + + '
'; + $("#nav-tabContent").append(_txt); + }, + }); + } else { + _el.show(); + } + return false; +}); + + {% if not repo.priorities %} $('#default_priorities').click(function(e) { let row = $('#priorities-list .blank-field'); diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 3f659dc..7dfb07f 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -1261,6 +1261,7 @@ def view_settings(repo, username=None, namespace=None): plugins=plugins, branchname=branchname, pagure_admin=pagure.utils.is_admin(), + main_app=flask.current_app )