euscanwww: naive implementation of the refresh button
A refresh button lets launching a scan_upstream task for a package while navigating into euscanwww Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
		| @@ -24,7 +24,15 @@ | |||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
| {% block content %} | {% block content %} | ||||||
| <h2>{{ package.category }}/{{ package.name }}</h2> | <h2> | ||||||
|  |   {{ package.category }}/{{ package.name }} | ||||||
|  |  | ||||||
|  |   {% if user.is_superuser %} | ||||||
|  |     <button class="refresh-button" data-package="{{ package.category }}/{{ package.name }}"> | ||||||
|  |       Refresh | ||||||
|  |     </button> | ||||||
|  |   {% endif %} | ||||||
|  | </h2> | ||||||
| <dl> | <dl> | ||||||
|   {% if package.description %} |   {% if package.description %} | ||||||
|   <dt>Description</dt> |   <dt>Description</dt> | ||||||
| @@ -129,4 +137,14 @@ | |||||||
|   </dd> |   </dd> | ||||||
|   {% endif %} |   {% endif %} | ||||||
| </dl> | </dl> | ||||||
|  |  | ||||||
|  | <script type="text/javascript"> | ||||||
|  |   $(".refresh-button").click(function() { | ||||||
|  |     var url = "{% url "apply_task" "djeuscan.tasks.scan_upstream_task" %}"; | ||||||
|  |     $.post(url, {query: $(this).data("package")}, function() { | ||||||
|  |       alert("Submitted!"); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  | </script> | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user