euscan-ng/euscanwww/djeuscan/templates/euscan/package.html
2012-07-20 17:10:12 +02:00

242 lines
7.5 KiB
HTML

{% extends "euscan/_datatable.html" %}
{% load sub %}
{% load djeuscan_helpers %}
{% load url from future %}
{% block meta %}
{{ block.super }}
<link rel="alternate" type="application/atom+xml" title="{{ package }} Feed"
href="{% url "package_feed" package.category package.name %}" />
{% endblock %}
{% block menu_feed %}
{{ block.super }}
<li>
<img src="{{ STATIC_URL }}/img/feed.png" alt="feed" />
<a title="{{ package }} Feed" href="{% url "package_feed" package.category package.name %}">
{{ package }}
</a>
</li>
{% endblock %}
{% block title %}
{{ block.super }} - {{ package.category }}/{{ package.name }}
{% endblock %}
{% block content %}
{% if thanks_for_reporting %}
<div class="alert alert-success">
<strong>Thanks!</strong> Your report has been sent to admins
</div>
{% endif %}
<h2>
{{ package.category }}/{{ package.name }}
{% if user.is_authenticated %}
<span class="pull-right">
<button class="btn refresh-button {% if refreshed %}hide{% endif %}" data-category="{{ package.category }}" data-package="{{ package.name }}">
<img src="{{ STATIC_URL}}/img/refresh-active.png" alt="Refresh" >
</button>
<button class="btn refresh-button-disabled disabled {% if not refreshed %}hide{% endif %}">
<img src="{{ STATIC_URL}}/img/refresh-inactive.png" alt="Refresh" >
</button>
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_package" package.category package.name %}">
<img src="{{ STATIC_URL}}/img/watch-icon.png" alt="Watch" >
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_package" package.category package.name %}">
<img src="{{ STATIC_URL}}/img/unwatch-icon.png" alt="Unwatch" >
</button>
</span>
{% endif %}
</h2>
<dl>
{% if package.description %}
<dt>Description</dt>
<dd>{{ package.description }}</dd>
{% endif %}
{% if package.homepage %}
<dt>Homepage</dt>
<dd>
{% for homepage in package.homepages %}
<a href="{{ homepage }}">{{ homepage }}</a><br />
{% endfor %}
</dd>
{% endif %}
{% if package.herds.all %}
<dt>Herds</dt>
<dd>
{% for herd in package.herds.all %}
<a href="{% url "herd" herd.herd %}">
{{ herd.herd }}
</a>
&lt;{{ herd.email }}&gt;
{% endfor %}
</dd>
{% endif %}
{% if package.maintainers.all %}
<dt>Maintainers</dt>
<dd>
{% for maintainer in package.maintainers.all %}
{% if maintainer.name != maintainer.email %}
<a href="{% url "maintainer" maintainer.id %}">
{{ maintainer.name }}
</a>
&lt;{{ maintainer.email }}&gt;
{% else %}
<a href="{% url "maintainer" maintainer.id %}">
{{ maintainer.email }}
</a>
{% endif %}
{% endfor %}
</dd>
{% endif %}
{% if packaged %}
<dt>Packaged Versions</dt>
<dd>
<ul>
{% for version in packaged %}
<li id="{{ version.version }}-{{version.revision }}:{{ version.slot }}-[{{ version.overlay }}]">
{% if version.overlay == "gentoo" %}
<img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="In Gentoo" />
{% else %}
<img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="In Overlays" />
{% endif %}
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version.version }}-{{ version.revision }} :{{ version.slot }} [{{ version.overlay }}]
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
{% if upstream %}
<dt>Upstream versions</dt>
<dd>
<ul>
{% for version in upstream %}
<li>
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version.version }} - {{ version.urls }}
</li>
{% endfor %}
</ul>
</dd>
{% endif %}
<dt>Version history</dt>
<dd>
<ul class="log">
{% for version in vlog %}
{% if version.action == version.VERSION_ADDED %}
<li class="added">
{% else %}
<li class="removed">
{% endif %}
{% if version.overlay == "gentoo" %}
<img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="In Gentoo" />
{% elif version.overlay %}
<img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="In Overlays" />
{% else %}
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
{% endif %}
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version }} - {{ version.datetime }}
</li>
{% endfor %}
</ul>
</dt>
{% if log %}
<dt>euscan log</dt>
<dd>
<p>Date: {{ log.datetime }}
<pre class="log">
{{ log.result|ansi_to_html|safe }}
</pre>
</dd>
{% endif %}
</dl>
<hr/>
<h3 class="report-problems-toggle cursor-pointer">Report problems</h3>
<div class="report-problems hide">
<form action="." method="post" class="form-horizontal">
<div class="control-group {% if problem_form.version.errors %}error{% endif %}">
<label class="control-label" for="version">{{ problem_form.version.label }}</label>
<div class="controls">
{{ problem_form.version }}
<span class="help-inline">{{ problem_form.version.errors.as_text }}</span>
</div>
</div>
<div class="control-group {% if problem_form.subject.errors %}error{% endif %}">
<label class="control-label" for="subject">{{ problem_form.subject.label }}</label>
<div class="controls">
{{ problem_form.subject }}
<span class="help-inline">{{ problem_form.subject.errors.as_text }}</span>
</div>
</div>
<div class="control-group {% if problem_form.message.errors %}error{% endif %}">
<label class="control-label" for="message">{{ problem_form.message.label }}</label>
<div class="controls">
{{ problem_form.message }}
<span class="help-inline">{{ problem_form.message.errors.as_text }}</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<input class="btn" type="submit" value="Submit" />
</div>
</div>
</form>
</div>
<script type="text/javascript">
$(document).ready(function () {
$(".refresh-button").click(function() {
var url = "{% url "refresh_package" "XXX" "YYY" %}";
$.post(url.replace("XXX", $(this).data("category")).replace("YYY", $(this).data("package")),
function() {
$(".refresh-button").addClass("hide");
$(".refresh-button-disabled").removeClass("hide");
});
});
$(".favourite-button").click(function() {
$.post($(this).data("url"), function() {
$(".unfavourite-button").removeClass("hide");
$(".favourite-button").addClass("hide");
});
});
$(".unfavourite-button").click(function() {
$.post($(this).data("url"), function() {
$(".favourite-button").removeClass("hide");
$(".unfavourite-button").addClass("hide");
});
});
$(".report-problems-toggle").click(function () {
$(".report-problems").toggle("slow");
});
});
</script>
{% endblock %}