aboutsummaryrefslogtreecommitdiff
blob: f4f123c7eba04501bc17618d7f5ad75edba1b090 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{% extends "euscan/_datatable.html" %}

{% load djeuscan_helpers %}
{% load url from future %}

{% block title %}
{{ block.super }} - Category: {{ category }}
{% endblock %}

{% block menu_feed %}
{{ block.super }}
<li>
  <img src="{{ STATIC_URL }}/img/feed.png" alt="feed" />
  <a title="{{ category }} Feed" href="{% url "category_feed" category %}">{{ category }}</a>
</li>
{% endblock %}

{% block content %}
<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 %}

<h3>Statistics</h2>
<h4>Current statistics</h4>
<p>
  <img src="{% url "chart_category" category 'pie-versions' %}" />
  <img src="{% url "chart_category" category 'pie-packages' %}" />
</p>

<h4>All Time</h4>
<p>
  <img src="{% url "chart_category" category 'versions-weekly' %}" />
  <img src="{% url "chart_category" category 'versions-monthly' %}" />
</p>

<p>
  <img src="{% url "chart_category" category 'packages-weekly' %}" />
  <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 rounded notfirst-menu">
  <dl>
    <dt>Versions</dt>
    <dd><img src="{% url "chart_category" category 'versions-monthly-small' %}" /></dd>
    <dt>Packages</dt>
    <dd><img src="{% url "chart_category" category 'packages-monthly-small' %}" /></dd>
  </dl>
</div>
{% endblock %}