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

@ -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>