{% extends "base.html" %}
{% load static %}

{% block content %}
  <main id="categories--page" class="main"></main>
{% endblock %}

{% block scripts %}
  <script id="categories-data">
    [
      {% for category in categories %}
        {% if not forloop.first %}, {% endif %}
        {
          "pk": {{ category.pk }},
          "name": "{{ category.name }}",
          "created": "{{ category.created }}",
          "rules" : [
            {% for rule in category.rules.all %}
              {% if not forloop.first %}, {% endif %}
              {
                "pk": {{ rule.pk }},
                "name": "{{ rule.name }}",
                "favicon": "{{ rule.favicon|default:'' }}",
                "created": "{{ rule.created }}"
              }
            {% endfor %}
          ]
        }
      {% endfor %}
    ]
  </script>

  {{ categories_update_url|json_script:"updateUrl" }}
  {{ categories_create_url|json_script:"createUrl" }}
  {{ sidebar_links|json_script:"Links" }}

  {{ block.super }}
{% endblock %}
