pagure-new/pagure/templates/repo_master.html

307 lines
11 KiB
HTML

{% extends "master.html" %}
{% block title %}{{
repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}
{% block content %}
<div class="repo-header p-t-1">
<div class="container">
<header>
<h2 class="repo-name m-b-0">
<a href="{{ url_for('view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace)}}">
{% if repo.is_fork -%}
<span class="oi" data-glyph="fork"></span>
{{ repo.user.user }}/{{
repo.namespace + '/' if repo.namespace
}}{{ repo.name}}
{%- else -%}
{{ repo.namespace + '/' if repo.namespace }}{{ repo.name }}
{%- endif -%}
</a>
{% if authenticated %}
<div class="pull-xs-right">
{% if repo.settings.get('issue_tracker', True)
and config.get('ENABLE_TICKETS', True)%}
<a href="{{ url_for('new_issue',
repo=repo.name,
username=username,
namespace=repo.namespace) }}"
class="btn btn-success btn-sm">New Issue</a>
{% endif %}
<div class="btn-group">
{% if not repo.is_fork %}
<form method="POST" name="fork_project" id="fork_project"
action="{{ url_for(
'.fork_project',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
{{ forkbuttonform.csrf_token }}
</form>
<button class="btn btn-sm btn-secondary"
onclick="$('#fork_project').submit();">
<span class="oi" data-glyph="fork"></span> Fork</button>
{% endif %}
<button title="{%-
if is_watching(
repo.name,
repo.user.user if repo.is_fork else None,
repo.namespace
)%}You are watching this project{%
else %}You are not watching this project{%
endif -%}"
type="button" class="btn btn-sm dropdown-toggle
{%-
if is_watching(
repo.name,
repo.user.user if repo.is_fork else None,
repo.namespace
)%} btn-primary{%
else %} btn-secondary{%
endif -%}"
data-toggle="dropdown" id="watch-button">
<span class="oi" data-glyph="eye"></span>
</button>
<div class="dropdown-menu dropdown-menu-right watch-menu">
<form method="POST" id="watch_project" name="watch_project"
action="{{ url_for('.watch_repo',
repo=repo.name,
user=repo.user.user if repo.is_fork else None,
namespace=repo.namespace,
watch=0) }}">
{%- if is_watching(
repo.name,
repo.user.user if repo.is_fork else None,
repo.namespace)
%}
<a class="dropdown-item" id="unwatch_button">Stop watching {{
repo.name }}</a>
{% else %}
<a class="dropdown-item" id="watch_button">Watch {{
repo.name }}</a>
{% endif -%}
{{ forkbuttonform.csrf_token }}
</form>
</div>
{% endif %}
</h2>
{% if repo.is_fork and repo.parent %}
<div class="m-t-0">
Forked from
<a href="{{ url_for(
'view_repo',
repo=repo.parent.name,
username=repo.parent.user.user if repo.parent.is_fork else None,
namespace=repo.parent.namespace)}}">
{{ repo.parent.namespace + '/' if repo.parent.namespace }}{{ repo.parent.fullname }}
</a>
</div>
{% elif repo.is_fork and not repo.parent %}
<div class="m-t-0">
Fork from a deleted repository
</div>
{% endif %}
<div class="projectinfo m-t-1 m-b-1">
{% if repo.description %}{{ repo.description | safe }}{% else %}-{% endif -%}
{%- if repo.url %} &nbsp;| &nbsp;<a class="inline" href="{{ repo.url }}">{{ repo.url }}</a>{% endif %}
</div>
</header>
<ul class="nav nav-tabs nav-small">
<li class="nav-item">
<a {%
if select == 'overview' %}class="nav-link active" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="home"></span>
<span class="hidden-sm-down">Overview</span>
</a>
</li>
{% if config['DOC_APP_URL'] and repo and repo.settings.get('project_documentation', True) %}
<li class="nav-item" >
<a {%
if select == 'docs' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_docs',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="book"></span>
<span class="hidden-sm-down">Docs</span>
</a>
</li>
{% endif %}
<li class="nav-item{%
if g.repo_obj and g.repo_obj.is_empty %} disabled{% endif %}">
<a {%
if select == 'commits' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_commits',
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branchname) }}">
<span class="oi hidden-md-up" data-glyph="spreadsheet">
</span><span class="hidden-sm-down">Commits</span>
</a>
</li>
<li class="nav-item{%
if g.repo_obj and g.repo_obj.is_empty %} disabled{% endif %}">
<a {%
if select == 'tree' %}class="active nav-link" {%
else %}class="nav-link"{%
endif %} href="{{ url_for(
'.view_tree',
repo=repo.name,
username=username,
namespace=repo.namespace,
identifier=branchname) }}">
<span class="oi hidden-md-up" data-glyph="file"></span>
<span class="hidden-sm-down">Files</span>
</a>
</li>
<li class="nav-item">
<a {%
if select == 'tags' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_tags',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="box"></span>
<span class="hidden-sm-down">Releases</span>
</a>
</li>
{% if config.get('ENABLE_TICKETS', True) and repo
and repo.settings.get('issue_tracker', True) %}
<li class="nav-item">
<a {%
if select == 'issues' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_issues',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="warning"></span>
<span class="hidden-sm-down">Issues&nbsp;</span>
<span class="label label-default label-pill hidden-sm-down">
{{ repo.open_tickets if g.repo_admin else repo.open_tickets_public }}
</span>
</a>
</li>
{% endif %}
{% if repo and repo.settings.get('pull_requests', True) %}
<li class="nav-item">
<a {%
if select == 'requests' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.request_pulls',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="task"></span>
<span class="hidden-sm-down">Pull Requests&nbsp;</span>
<span class="label label-default label-pill hidden-sm-down">
{{ repo.open_requests }}
</span>
</a>
</li>
{% endif %}
{% if repo and repo.forks %}
<li class="nav-item">
<a {%
if select == 'forks' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_forks',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi hidden-md-up" data-glyph="fork"></span>
<span class="hidden-sm-down">Forks&nbsp;</span>
<span class="hidden-sm-down label label-default label-pill">
{{ repo.forks |length }}
</span>
</a>
</li>
{% endif %}
{% if authenticated %}
{% if g.repo_admin %}
<li class="nav-item pull-xs-right">
<a title="Settings" {%
if select == 'settings' %}class="active nav-link" {%
else %}class="nav-link" {%
endif %}href="{{ url_for(
'.view_settings',
repo=repo.name,
username=username,
namespace=repo.namespace) }}">
<span class="oi" data-glyph="cog"></span>
<span class="hidden-sm-down">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(
'.view_repo',
repo=repo.name,
username=username,
namespace=repo.namespace,
filename=filename)
}}" target="_blank" title="Open to a new tab" rel="noopener noreferrer">
<span class="oi" data-glyph="external-link"></span>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
<div class="container p-t-3">
{% block repo %}
{% endblock %}
</div>
{% endblock %}
{% block jscripts %}
{{ super() }}
<script type="text/javascript">
$(document).ready(function() {
$(".watch-menu a").click(function(){
var selectedValue = $(this).attr('id');
var action = $("#watch_project").attr('action');
if (selectedValue != "unwatch_button") {
action = action.replace('/settings/0', '/settings/1');
$('#watch_project').attr('action', action);
}
$('#watch_project').submit();
});
});
</script>
{% endblock %}