blob: d579dc6d7859b1d714005abdca421f2b13c4b51d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
{% extends "euscan/_datatable.html" %}
{% load url from future %}
{% load djeuscan_helpers %}
{% block title %}
{{ block.super }} - World Scan
{% endblock %}
{% block content %}
<h2>
World scan:
{% if user.is_authenticated %}
<span class="pull-right">
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_world" %}">
<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_world" %}">
<img src="{{ STATIC_URL}}/img/unwatch-icon.png" alt="Unwatch" />
</button>
</span>
{% endif %}
</h2>
{% packages packages %}
<script type="text/javascript">
$(document).ready(function () {
var packages = [{{packages_ids|join:","}}];
$(".favourite-button").click(function() {
$.post($(this).data("url"), {packages: packages}, function() {
$(".unfavourite-button").removeClass("hide");
$(".favourite-button").addClass("hide");
});
});
$(".unfavourite-button").click(function() {
$.post($(this).data("url"), {packages: packages}, function() {
$(".favourite-button").removeClass("hide");
$(".unfavourite-button").addClass("hide");
});
});
});
</script>
{% endblock %}
|