euscanwww: Watched herds/maintainers/categories panel

* Refactored templates and templatetags
* Added unfavourite views
* Added button to favourite/unfavourite package
* Panel for showing favourited objects

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino
2012-06-14 10:03:49 +02:00
parent 11c234f7f7
commit 34d3bd714d
26 changed files with 344 additions and 209 deletions

View File

@ -45,7 +45,7 @@
<ul class="submenu">
<li><a href="{% url "accounts_categories" %}">Categories</a></li>
<li><a href="{% url "accounts_herds" %}">Herds</a></li>
<li><a href="{% url "accounts_maintainers" %}">Maintainer profiles</a></li>
<li><a href="{% url "accounts_maintainers" %}">Maintainers</a></li>
<li><a href="{% url "accounts_packages" %}">Packages</a></li>
</ul>
<li><a href="{% url "django.contrib.auth.views.logout" %}">Logout</a></li>

View File

@ -0,0 +1,32 @@
{% load url from future %}
{% load euscan %}
<table id="table" class="display">
<thead>
<th>Category</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for category in categories %}
<tr>
<td>
<a href="{% url "category" category.category %}">{{ category.category }}</a>
{% package_bar category %}
</td>
{% package_cols category %}
{% if extras %}
<td>
<img src="{% url "chart_category" category.category 'packages-monthly-small' %}" />
<img src="{% url "chart_category" category.category 'versions-monthly-small' %}" />
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,34 @@
{% load url from future %}
{% load euscan %}
<table id="table" class="display">
<thead>
<th>Herd</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for herd in herds %}
<tr>
<td>
<a href="{% url "herd" herd.herds__herd %}">
{{ herd.herds__herd }}
</a>
{% package_bar herd %}
</td>
{% package_cols herd %}
{% if extras %}
<td>
<img src="{% url "chart_herd" herd.herds__herd 'packages-monthly-small' %}" />
<img src="{% url "chart_herd" herd.herds__herd 'versions-monthly-small' %}" />
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,40 @@
{% load url from future %}
{% load euscan %}
<table id="table" class="display">
<thead>
<th>Maintainer</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for maintainer in maintainers %}
<tr>
<td>
<a href="{% url "maintainer" maintainer.maintainers__id %}">
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
{{ maintainer.maintainers__name }} &lt;{{ maintainer.maintainers__email }}&gt;
{% else %}
{{ maintainer.maintainers__name }}
{% endif %}
</a>
{% package_bar maintainer %}
</td>
{% package_cols maintainer %}
{% if extras %}
<td>
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'packages-monthly-small' %}" />
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'versions-monthly-small' %}" />
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>

View File

@ -1,4 +1,4 @@
{% load packages %}
{% load euscan %}
{% load mul %}
{% load sub %}
{% load div %}

View File

@ -1,4 +1,4 @@
{% load packages %}
{% load euscan %}
{% load sub %}
{% load div %}
{% load mul %}

View File

@ -1,11 +1,15 @@
{% extends "_base.html" %}
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load euscan %}
{% block title %}
{{ block.super }} - My categories
{{ block.super }} - Watched categories
{% endblock %}
{% block content %}
<h2>Welcome {{ user }}</h2>
<h2>Watched categories</h2>
{% categories_table categories %}
{% endblock %}

View File

@ -1,11 +1,14 @@
{% extends "_base.html" %}
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load euscan %}
{% block title %}
{{ block.super }} - My herds
{{ block.super }} - Watched herds
{% endblock %}
{% block content %}
<h2>Welcome {{ user }}</h2>
<h2>Watched herds</h2>
{% herds_table herds %}
{% endblock %}

View File

@ -1,11 +1,14 @@
{% extends "_base.html" %}
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load euscan %}
{% block title %}
{{ block.super }} - My maintainer profiles
{{ block.super }} - Watched maintainers
{% endblock %}
{% block content %}
<h2>Welcome {{ user }}</h2>
<h2>Watched maintainers</h2>
{% maintainers_table maintainers %}
{% endblock %}

View File

@ -1,15 +1,15 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load packages %}
{% load euscan %}
{% block title %}
{{ block.super }} - My packages
{{ block.super }} - Watched packages
{% endblock %}
{% block content %}
<h2>My Packages</h2>
<h2>Watched packages</h2>
{% packages packages %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}
@ -10,33 +10,6 @@
{% block content %}
<h2>Categories</h2>
<table id="table" class="display">
<thead>
<th>Category</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for category in categories %}
<tr>
<td>
<a href="{% url "category" category.category %}">{{ category.category }}</a>
{% package_bar category %}
</td>
{% package_cols category %}
{% if request.GET.extras %}
<td>
<img src="{% url "chart_category" category.category 'packages-monthly-small' %}" />
<img src="{% url "chart_category" category.category 'versions-monthly-small' %}" />
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% categories_table categories request.GET.extras %}
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}
@ -9,35 +9,7 @@
{% block content %}
<h2>Herds</h2>
<table id="table" class="display">
<thead>
<th>Herd</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for herd in herds %}
<tr>
<td>
<a href="{% url "herd" herd.herds__herd %}">
{{ herd.herds__herd }}
</a>
{% package_bar herd %}
</td>
{% package_cols herd %}
{% if request.GET.extras %}
<td>
<img src="{% url "chart_herd" herd.herds__herd 'packages-monthly-small' %}" />
<img src="{% url "chart_herd" herd.herds__herd 'versions-monthly-small' %}" />
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% herds_table herds request.GET.extras %}
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}
@ -9,41 +9,7 @@
{% block content %}
<h2>Maintainers</h2>
<table id="table" class="display">
<thead>
<th>Maintainer</th>
<th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ STATIC_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}
</thead>
<tbody>
{% for maintainer in maintainers %}
<tr>
<td>
<a href="{% url "maintainer" maintainer.maintainers__id %}">
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
{{ maintainer.maintainers__name }} &lt;{{ maintainer.maintainers__email }}&gt;
{% else %}
{{ maintainer.maintainers__name }}
{% endif %}
</a>
{% package_bar maintainer %}
</td>
{% package_cols maintainer %}
{% if request.GET.extras %}
<td>
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'packages-monthly-small' %}" />
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'versions-monthly-small' %}" />
</td>
{% endif %}
{% maintainers_table maintainers request.GET.extras %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% block title %}
{{ block.super }} - Overlay: {{ overlay }}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% load url from future %}
{% block title %}

View File

@ -31,9 +31,12 @@
<button class="refresh-button" data-package="{{ package.category }}/{{ package.name }}">
Refresh
</button>
<button class="favourite-button" data-url="{% url "favourite_package" package.category package.name %}">
<button class="favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_package" package.category package.name %}">
Add to favourites
</button>
<button class="unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_package" package.category package.name %}">
Remove from favourites
</button>
{% endif %}
</h2>
<dl>
@ -151,7 +154,15 @@
$(".favourite-button").click(function() {
$.post($(this).data("url"), function() {
alert("Favourited!");
$(".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");
});
});
</script>

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load packages %}
{% load euscan %}
{% block title %}
{{ block.super }} - World Scan