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:
@ -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>
|
||||
|
Reference in New Issue
Block a user