{% extends "master.html" %}
{% macro print_ssh_url(repo, git_url_ssh, current_user) %}
{% if not user_can_clone_ssh(current_user) %}
<a href="{{ url_for('ui_ns.user_settings') + '#nav-ssh-tab' }}">
You need to upload SSH key to be able to clone over SSH
</a>
{% elif repo.read_only %}
The permissions on this repository are being updated.
Cloning over SSH is disabled.
{% else %}
<div class="form-group">
<div class="input-group input-group-sm">
<div class="input-group-addon">SSH</div>
<input class="form-control bg-white" type="text" value="{{
git_url_ssh }}{{ repo.fullname }}.git" readonly>
</div>
</div>
{% endif %}
{% endmacro %}
{% block title %}{{
repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}
{% block content %}
<div class="repo-header pt-3">
<div class="container">
<div class="row mb-3">
<div class="col-6">
<div class="row">
<div class="col-auto pr-0">
<h3>
{% if repo.is_fork -%}
<i class="fa fa-code-fork text-muted"></i>
{%- else -%}
<i class="fa fa-calendar-o fa-rotate-270 text-muted"></i>
{%- endif -%}
</h3>
</div>
<div class="col-auto pl-2">
<h3 class="mb-0">
{% if repo.is_fork -%}
<a href="{{ url_for(
'ui_ns.view_user', username=repo.user.user)
}}">{{ repo.user.user }}</a><span class="mt-1 text-muted"> / </span>
{%- endif -%}
{%- if repo.namespace -%}
<a href="{{ url_for(
'ui_ns.view_projects', namespace=repo.namespace, pattern='*')
}}">{{ repo.namespace }}</a> /
{%- endif -%}<a href="{{ url_for('ui_ns.view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace)
}}"><strong>{{ repo.name }}</strong></a>
{% if repo.private %}
<span class="fa fa-lock text-danger fa-fw" title="Private project"></span>
{% endif %}
</h3>
{% if repo.is_fork and repo.parent %}
<span class="text-muted">
Forked from
<a href="{{ url_for(
'ui_ns.view_repo',
repo=repo.parent.name,
username=repo.parent.user.user if repo.parent.is_fork else None,
namespace=repo.parent.namespace)}}">
{{ repo.parent.fullname }}
</a>
{{repo.date_created|humanize}}
</span>
{% elif repo.is_fork and not repo.parent %}
<span class="text-muted">
Forked from a deleted repository {{repo.date_created|humanize}}
</span>
{% endif %}
</div>
</div>
</div>
<div class="col-6 text-right">
<div class="btn-group">
{% if g.authenticated %}
{% if repo.settings.get('issue_tracker', True)
and config.get('ENABLE_TICKETS', True)
and not repo.settings.get('issue_tracker_read_only', False) %}
<a href="{{ url_for('ui_ns.new_issue',
repo=repo.name,
username=username,
namespace=repo.namespace) }}"
class="btn btn-outline-primary btn-sm">
<i class="fa fa-exclamation-circle fa-fw"></i> New issue</a>
{% endif %}
{% if g.authenticated %}
<div class="btn-group">
<a href="#" class="btn btn-outline-primary btn-sm dropdown-toggle"
type="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fa fa-arrow-circle-down fa-fw"></i> Open PR
</a>
<div class="dropdown-menu dropdown-menu-right" id="PR-dropdown">
<a class="dropdown-item" id="spinnergif">
<small><img
src="{{ url_for('static', filename='images/spinner.gif') }}" />
</small>
</a>
<a class="dropdown-item"
href="{{ url_for('ui_ns.new_request_pull',
repo=repo.name,
username=username,
namespace=repo.namespace,
branch_to=head or 'master',
branch_from=branchname or 'master') }}">
New Pull Request
</a>
<a class="dropdown-item" href="{{ url_for(
'ui_ns.new_remote_request_pull',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
New Remote Pull Request
</a>
</div>
</div>
{%endif%}
<div class="btn-group">
{% if g.repo_forked %}
{% if g.fas_user.username == username %}
<a href="{{ url_for(
'ui_ns.view_repo',
repo=repo.name,
namespace=repo.namespace) }}" class="btn btn-sm btn-outline-primary">
<i class="fa fa-code-fork fa-fw"></i> View Upstream
</a>
{% else %}
<a href="{{ url_for(
'ui_ns.view_repo',
repo=repo.name,
username=g.fas_user.username,
namespace=repo.namespace) }}" class="btn btn-sm btn-outline-primary">
<i class="fa fa-code-fork fa-fw"></i> View fork
</a>
{% endif %}
{% else %}
<form method="POST" name="fork_project" id="fork_project"
action="{{ url_for(
'ui_ns.fork_project',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
{{ g.forkbuttonform.csrf_token }}
</form>
<button class="btn btn-sm btn-outline-primary"
onclick="$('#fork_project').submit();">
<i class="fa fa-code-fork fa-fw"></i> Fork</button>
{% endif %}
</div>
{% endif %}
<div class="btn-group">
<a href="#" type="button"
class="btn btn-sm dropdown-toggle btn-outline-primary"
data-toggle="dropdown" id="watch-button">
<i class="fa fa-clone fa-fw"></i>
<span>Clone</span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<div class="m-3" style="width:300px;">
<h5><strong>Source Code</strong></h5>
<div>
{% if g.authenticated and g.repo_committer %}
{{ print_ssh_url(repo, git_url_ssh, g.fas_user.username) }}
{% endif %}
<div class="form-group">
<div class="input-group input-group-sm">
<div class="input-group-addon">GIT</div>
<input class="form-control bg-white" type="text" value="{{
config.get('GIT_URL_GIT') }}{{ repo.fullname }}.git" readonly>
</div>
</div>
<div>
{% if config['DOC_APP_URL']
and repo
and repo.settings.get('project_documentation', True) %}
<h5><strong>Documentation</strong></h5>
{% if g.authenticated and g.repo_committer %}
{{ print_ssh_url(repo, git_url_ssh + "docs/", g.fas_user.username) }}
{% endif %}
<div class="form-group">
<div class="input-group input-group-sm">
<div class="input-group-addon">GIT</div>
<input class="form-control bg-white" type="text" value="{{
config.get('GIT_URL_GIT') }}docs/{{ repo.fullname }}.git" readonly>
</div>
</div>
{% endif %}
{% if g.authenticated and g.repo_committer %}
{% if config.get('ENABLE_TICKETS', True)
and repo.settings.get('issue_tracker', True) %}
<h5><strong>Issues</strong></h5>
{{ print_ssh_url(repo, git_url_ssh + "tickets/", g.fas_user.username) }}
{% endif %}
<h5><strong>Pull Requests</strong></h5>
{{ print_ssh_url(repo, git_url_ssh + "requests/", g.fas_user.username) }}
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ul class="nav nav-tabs nav-small">
<li class="nav-item mr-2 text-dark">
<a {%
if select == 'overview' or select == 'commits' or select == 'tree' or select == 'tags' or select == 'branches'%}class="nav-link active" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'ui_ns.view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-code fa-fw text-muted"></i>
<span class="d-none d-md-inline">Source</span>
</a>
</li>
{% if config['DOC_APP_URL'] and repo and repo.settings.get('project_documentation', True) %}
<li class="nav-item mr-2 text-dark" >
<a {%
if select == 'docs' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'ui_ns.view_docs',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-book fa-fw text-muted"></i>
<span class="d-none d-md-inline">Docs</span>
</a>
</li>
{% endif %}
{% if config.get('ENABLE_TICKETS', True) and repo
and repo.settings.get('issue_tracker', True) %}
<li class="nav-item mr-2 text-dark">
<a {%
if select == 'issues' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href={% if not repo.settings.get(
'roadmap_on_issues_page', False) %}"{{ url_for(
'ui_ns.view_issues',
repo=repo.name,
username=username,
namespace=repo.namespace) }}"{% else %}"{{ url_for(
'ui_ns.view_roadmap',
repo=repo.name,
username=username,
namespace=repo.namespace) }}"{% endif %}>
<i class="fa fa-fw text-muted fa-exclamation-circle"></i>
<span class="d-none d-md-inline">Issues </span>
<span class="badge badge-secondary py-0 d-none d-md-inline">
{{ repo.open_tickets if g.repo_committer else repo.open_tickets_public }}
</span>
</a>
</li>
{% endif %}
{% if repo and repo.settings.get('pull_requests', True) %}
<li class="nav-item mr-2 text-dark">
<a {%
if select == 'requests' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'ui_ns.request_pulls',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-fw text-muted fa-arrow-circle-down"></i>
<span class="d-none d-md-inline">Pull Requests </span>
<span class="badge badge-secondary py-0 d-none d-md-inline">
{{ repo.open_requests }}
</span>
</a>
</li>
{% endif %}
{% if repo.milestones %}
<li class="nav-item mr-2 text-dark">
<a {%
if select == 'roadmap' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %} href="{{ url_for(
'ui_ns.view_roadmap',
repo=repo.name,
username=username,
namespace=repo.namespace) }}"
class="btn btn-outline-dark btn-sm">
<i class="fa fa-fw text-muted fa-map-signs"></i>
<span class="d-none d-md-inline">Roadmap </span>
</a>
</li>
{% endif %}
<li class="nav-item mr-2 text-dark">
<a {%
if select == 'stats' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'ui_ns.view_stats',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-line-chart fa-fw text-muted"></i>
<span class="d-none d-md-inline">Stats</span>
</a>
</li>
{% if g.authenticated %}
{% if g.repo_admin %}
<li class="nav-item mr-2 text-dark">
<a title="Settings" {%
if select == 'settings' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'ui_ns.view_settings',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-cogs fa-fw text-muted"></i>
<span class="d-none d-md-inline">Settings</span>
</a>
</li>
{% endif %}
{% endif %}
{% if endpoint == 'view_docs' %}
<li class="nav-item pull-xs-right">
<a class="nav-link" href="{{ config['DOC_APP_URL'] + url_for(
'ui_ns.view_repo',
repo=repo.namespace + '.' + repo.name if repo.namespace else repo.name,
username=username,
filename=filename)
}}" target="_blank" title="Open to a new tab" rel="noopener noreferrer">
<span class="fa fa-external-link"></span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
<div class="container pt-5 repo-body-container">
{% if repo.read_only %}
<div class="container pt-2">
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<span class="oi red-icon" data-glyph="file"
title="Read Only"></span>
The permissions on this repository are being updated. This may take a while.
During this time, you or some of the project's contributors may not be able
to push to this repository.
</div>
</div>
{% endif %}
{% if g.authenticated and repo.settings.get('pull_request_access_only') %}
<div class="container pt-2">
<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="info" aria-label="Close">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<span class="oi blue-icon" data-glyph="file" title="PR Only"></span>
This project does not support direct push to its git repo, all changes
must be done via pull-requests from forks.
</div>
</div>
{% endif %}
{% block repo %}
{% endblock %}
</div>
{% endblock %}
{% block jscripts %}
{{ super() }}
<script type="text/javascript"
src="{{ url_for('static',
filename='vendor/lazyload/lazyload.min.js') }}">
</script>
<script type="text/javascript">
window.addEventListener("load", function(event) {
lazyload();
});
</script>
<script>
{% if g.authenticated and not g.repo_obj.is_empty %}
{% if g.repo_committer %}
$(function() {
$.ajax({
url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' ,
type: 'POST',
data: {
repo: "{{ repo.name }}",
namespace: "{{ repo.namespace if repo.namespace }}",
repouser: "",
csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
},
dataType: 'json',
error: function(res) {
console.log(res);
},
success: function(res) {
if (res.code == 'OK'){
var first_item = true;
for (branch in res.message.new_branch){
if (first_item){
$("#PR-dropdown").prepend("<div class='dropdown-divider'></div>")
first_item = false;
}
var url = "{{ url_for(
'ui_ns.new_request_pull',
repo=repo.name,
username=repo.user.user if repo.is_fork else None,
namespace=repo.namespace,
branch_to='',
branch_from='') }}";
url = url.slice(0, -2) + res.message.new_branch[branch]['target_branch'] + '..' + branch;
html = '<a class="dropdown-item" href="' + url + '">'
+ '<span class="badge badge-light badge-pill border border-secondary font-size-1">'
+ ' <i class="fa fa-calendar-o fa-rotate-270 fa-fw"></i> '
+ '{{ repo.name }}'
+ '</span> '
+ '<span class="badge badge-secondary border border-secondary badge-pill font-size-1">'
+ '<span class="fa fa-random fa-fw"> </span> '
+ branch
+ '</span></a> ';
$("#PR-dropdown").prepend(html);
}
}
}
});
});
{% endif %}
$(function() {
$.ajax({
url: '{{ url_for("internal_ns.get_pull_request_ready_branch") }}' ,
type: 'POST',
data: {
namespace: "{{ repo.namespace if repo.namespace }}",
repo: "{{ repo.name }}",
repouser: "{{ g.fas_user.username }}",
csrf_token: "{{ g.confirmationform.csrf_token.current_token }}",
},
dataType: 'json',
error: function(res) {
$('#spinnergif').hide()
console.log(res);
},
success: function(res) {
$('#spinnergif').hide()
console.log("done");
if (res.code == 'OK'){
var first_item = true;
for (branch in res.message.new_branch){
if (first_item){
$("#PR-dropdown").prepend("<div class='dropdown-divider'></div>");
first_item = false;
}
var url = "{{ url_for(
'ui_ns.new_request_pull',
repo=repo.name,
username=g.fas_user.username,
namespace=repo.namespace,
branch_to='',
branch_from='') }}";
url = url.slice(0, -2) + res.message.new_branch[branch]['target_branch'] + '..' + branch;
html = '<a class="dropdown-item" \
href="' + url + '"><span class="badge badge-light badge-pill border border-secondary font-size-1">'
+ '<i class="fa fa-code-fork fa-fw"></i>'
+'{{ g.fas_user.username }}/{{ repo.name }}</span> '
+'<span class="badge badge-secondary border border-secondary badge-pill font-size-1">'
+'<i class="fa fa-random"></i> '
+ branch + '</span></a> ';
$("#PR-dropdown").prepend(html);
}
}
}
});
});
{% endif %}
</script>
{% endblock %}
{% block overviewtabs %}
<nav class="nav nav-tabs nav-sidetabs flex-column">
<a class=
"nav-link nowrap
{%if select == 'overview' %} active{% endif %}"
href="{{ url_for(
'ui_ns.view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-home text-muted fa-fw"></i> <span class="d-none d-md-inline">Overview</span>
</a>
<a class=
"nav-link nowrap
{%if g.repo_obj and g.repo_obj.is_empty %} disabled{% endif %}
{%if select == 'tree' %} active{% endif %}"
href="{{ url_for(
'ui_ns.view_tree',
repo=repo.name,
username=username,
namespace=repo.namespace,
identifier=branchname,
branchname=branchname) }}">
<i class="fa fa-file-code-o text-muted fa-fw"></i> Files
</a>
<a class=
"nav-link nowrap
{%if g.repo_obj and g.repo_obj.is_empty %} disabled{% endif %}
{%if select == 'commits' %} active{% endif %}"
href="{{ url_for(
'ui_ns.view_commits',
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branchname) }}">
<i class="fa fa-list-alt text-muted fa-fw" data-glyph="spreadsheet"></i> Commits
</a>
<a class=
"nav-link nowrap
{%if select == 'branches' %} active{% endif %}"
href="{{ url_for(
'ui_ns.view_branches',
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branchname) }}">
<i class="fa fa-random text-muted fa-fw"></i> Branches
</a>
<a class=
"nav-link nowrap
{%if select == 'tags' %} active{% endif %}"
href="{{ url_for(
'ui_ns.view_tags',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<i class="fa fa-archive text-muted fa-fw"></i> Releases
</a>
</nav>
{% endblock %}