From bb7cccda4375311cf27176ddacc418e04fc680eb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Oct 12 2017 12:37:48 +0000 Subject: Show the heads of the branches on the commit list This backports to pagure-dist-git a change that has been made to pagure itself on: https://pagure.io/pagure/pull-request/2675 Signed-off-by: Pierre-Yves Chibon --- diff --git a/template/commits.html b/template/commits.html index 83aae2a..77c0dfe 100644 --- a/template/commits.html +++ b/template/commits.html @@ -188,6 +188,36 @@ $('#diff_commits_link').click(function(){ $('#diff_commits').toggle(); }); + $.ajax({ + url: '{{ url_for("internal_ns.get_branches_head") }}' , + type: 'POST', + data: { + repo: "{{ repo.name }}", + repouser: "{{ repo.user.user if repo.is_fork else '' }}", + namespace: "{{ repo.namespace if repo.namespace else '' }}", + csrf_token: "{{ form.csrf_token.current_token }}", + }, + dataType: 'json', + success: function(res) { + for (var _c in res.heads) { + for (var i=0; i < res.heads[_c].length; i++){ + var _url = '{{ url_for('.view_commits', + repo=repo.name, + branchname='---', + username=username, + namespace=repo.namespace) }}'; + var _b = res.heads[_c][i]; + var html = '' + +'' + + ' ' + + _b + ' '; + var el = $('#c_' + _c); + el.parent().before(html); + } + } + }, + }); }); {% if config.get('RESULTSDB_URL') %} var _base_url = '{{ config.get("RESULTSDB_URL").rstrip("/") }}/api/v2.0/';