From aa953ae659b3e4207039e66c10bd2bae593bed48 Mon Sep 17 00:00:00 2001 From: Michal Konečný Date: Jul 31 2020 15:47:14 +0000 Subject: Add orphan button to project page Signed-off-by: Michal Konečný --- diff --git a/pagure/themes/srcfpo/templates/repo_info.html b/pagure/themes/srcfpo/templates/repo_info.html index e2ad050..9c3c96c 100644 --- a/pagure/themes/srcfpo/templates/repo_info.html +++ b/pagure/themes/srcfpo/templates/repo_info.html @@ -105,7 +105,7 @@ {% endif %} {% if not repo.is_fork %}
Created {{repo.date_created|humanize}}
-
+
{% if repo.user.user != 'orphan' %} Maintained by + {% if g.authenticated and repo.user.user == g.fas_user.username %} + + {% endif %} + {% if g.authenticated and repo.user.user == "orphan" %}
@@ -331,6 +346,7 @@ success: function(res) { $("#point_of_contact").html("{{ g.fas_user.username }}"); $("#take-orphan-section").hide(); + $("#orphan-section").show(); }, error: function(res) { if (res.responseJSON.errors) { @@ -365,6 +381,28 @@ }); {% endif %} + {% if g.authenticated and repo.user.user == g.fas_user.username %} + $("#orphan-button").click(function(){ + + $.ajax({ + url: "{{ url_for('distgit_ns.orphan_endpoint', repo=repo.name, namespace=repo.namespace) }}", + type: 'POST', + dataType: 'json', + success: function(res) { + $("#point_of_contact_div").html("Package is currently unmaintained"); + $("#orphan-section").hide(); + $("#take-orphan-section").show(); + }, + error: function(res) { + if (res.responseJSON.errors) { + alert('Unable to orphan the package: ' + res.responseJSON.errors); + } else { + alert('Unable to orphan the package: ' + res.responseJSON.error); + } + } + }); + }); + {% endif %} }); {% endif %}