diff --git a/progit/app.py b/progit/app.py index 4eeac35..0f68f27 100644 --- a/progit/app.py +++ b/progit/app.py @@ -667,3 +667,19 @@ def merge_request_pull(repo, requestid, username=None): SESSION.commit() return flask.redirect(flask.url_for('view_repo', repo=repo.name)) + + +def view_forks(repo, username=None): + """ Return the list of forks of a project. + """ + + repo = progit.lib.get_project(SESSION, repo, user=username) + + if not repo: + flask.abort(404, 'Project not found') + + return flask.render_template( + 'forks.html', + select='forks', + repo=repo, + ) diff --git a/progit/templates/forks.html b/progit/templates/forks.html new file mode 100644 index 0000000..f6be9c6 --- /dev/null +++ b/progit/templates/forks.html @@ -0,0 +1,29 @@ +{% extends "repo_master.html" %} + +{% block title %}Home{% endblock %} +{%block tag %}home{% endblock %} + + +{% block repo %} + +

Forks

+ +
+ {% if repo.forks %} + + {% else %} +

+ This project has not been forked. +

+ {% endif %} +
+ +{% endblock %} diff --git a/progit/templates/repo_master.html b/progit/templates/repo_master.html index 13d0cee..fbb150c 100644 --- a/progit/templates/repo_master.html +++ b/progit/templates/repo_master.html @@ -69,6 +69,17 @@ {% endif %} Pull-requests + {% if repo.forks %} +
  • + {% if '/fork/' in request.url %} + + {% else %} + + {% endif %} + Forks +
  • + {% endif %}