euscanwww: Watch/unwatch packages, categories, maintainers, overlays

Added a button for watch/unwatch and a dashboard with user selected
stuff only

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino
2012-07-10 16:15:06 +02:00
parent 02be58024a
commit fab19a6bfc
17 changed files with 507 additions and 59 deletions

View File

@ -56,6 +56,7 @@
<li><a href="{% url "accounts_herds" %}">Herds</a></li>
<li><a href="{% url "accounts_maintainers" %}">Maintainers</a></li>
<li><a href="{% url "accounts_packages" %}">Packages</a></li>
<li><a href="{% url "accounts_overlays" %}">Overlays</a></li>
</ul>
<li><a href="{% url "django.contrib.auth.views.logout" %}">Logout</a></li>
{% else %}

View File

@ -0,0 +1,18 @@
{% load url from future %}
<table id="table" class="display">
<thead>
<th>Overlay</th>
</thead>
<tbody>
{% for overlay in overlays %}
<tr>
<td>
<a href="{% url "overlay" overlay %}">
{{ overlay }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View File

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

View File

@ -16,7 +16,18 @@
{% endblock %}
{% block content %}
<h2>Category: {{ category }}</h2>
<h2>
Category: {{ category }}
{% if user.is_authenticated %}
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_category" category %}">
Watch
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_category" category %}">
Unwatch
</button>
{% endif %}
</h2>
{% packages packages %}
@ -38,11 +49,27 @@
<img src="{% url "chart_category" category 'packages-monthly' %}" />
</p>
<script type="text/javascript">
$(".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");
});
});
</script>
{% endblock %}
{% block menus %}
{{ block.super }}
<div class="menu">
<div class="menu rounded notfirst-menu">
<dl>
<dt>Versions</dt>
<dd><img src="{% url "chart_category" category 'versions-monthly-small' %}" /></dd>
@ -50,5 +77,4 @@
<dd><img src="{% url "chart_category" category 'packages-monthly-small' %}" /></dd>
</dl>
</div>
{% endblock %}

View File

@ -16,7 +16,18 @@
{% endblock %}
{% block content %}
<h2>Herd: {{ herd.herd }}</h2>
<h2>
Herd: {{ herd.herd }}
{% if user.is_authenticated %}
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_herd" herd.herd %}">
Watch
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_herd" herd.herd %}">
Unwatch
</button>
{% endif %}
</h2>
{% packages packages %}
<h3>Statistics</h2>
@ -36,11 +47,27 @@
<img src="{% url "chart_herd" herd.herd 'packages-monthly' %}" />
</p>
<script type="text/javascript">
$(".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");
});
});
</script>
{% endblock %}
{% block menus %}
{{ block.super }}
<div class="menu">
<div class="menu rounded notfirst-menu">
<dl>
<dt>Versions</dt>
<dd><img src="{% url "chart_herd" herd.herd 'versions-monthly-small' %}" /></dd>

View File

@ -18,7 +18,17 @@
{% endblock %}
{% block content %}
<h2>Maintainer: {{ maintainer.name }} &lt{{ maintainer.email }}&gt</h2>
<h2>
Maintainer: {{ maintainer.name }} &lt{{ maintainer.email }}&gt
{% if user.is_authenticated %}
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_maintainer" maintainer.id %}">
Watch
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_maintainer" maintainer.id %}">
Unwatch
</button>
{% endif %}
</h2>
{% packages packages %}
<h3>Statistics</h2>
@ -38,11 +48,28 @@
<img src="{% url "chart_maintainer" maintainer.id 'packages-weekly' %}" />
<img src="{% url "chart_maintainer" maintainer.id 'packages-monthly' %}" />
</p>
<script type="text/javascript">
$(".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");
});
});
</script>
{% endblock %}
{% block menus %}
{{ block.super }}
<div class="menu">
<div class="menu rounded notfirst-menu">
<dl>
<dt>Versions</dt>
<dd><img src="{% url "chart_maintainer" maintainer.id 'versions-monthly-small' %}" /></dd>
@ -52,4 +79,3 @@
</div>
{% endblock %}
5A

View File

@ -1,5 +1,6 @@
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load euscan %}
{% block title %}
@ -7,6 +8,35 @@
{% endblock %}
{% block content %}
<h2>Overlay: {{ overlay }}</h2>
<h2>
Overlay: {{ overlay }}
{% if user.is_authenticated %}
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_overlay" overlay %}">
Watch
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_overlay" overlay %}">
Unwatch
</button>
{% endif %}
</h2>
{% packages packages %}
<script type="text/javascript">
$(".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");
});
});
</script>
{% endblock %}

View File

@ -10,20 +10,6 @@
{% block content %}
<h2>Overlays</h2>
<table id="table" class="display">
<thead>
<th>Overlay</th>
</thead>
<tbody>
{% for overlay in overlays %}
<tr>
<td>
<a href="{% url "overlay" overlay.version__overlay %}">
{{ overlay.version__overlay }}
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% overlays_table overlays %}
{% endblock %}

View File

@ -39,10 +39,10 @@
Refresh
</button>
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_package" package.category package.name %}">
Add to favourites
Watch
</button>
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_package" package.category package.name %}">
Remove from favourites
Unwatch
</button>
{% endif %}
</h2>