{% extends "base.html" %}

{% block title %} | Category: {{ category.name }}{% endblock %}
{% block bodydata %} {% if category.symbol %}data-symbol="{{ category.symbol.url }}"{% endif %}{% endblock %}



{% block main %}
        <div class="page-header">
            <div class="container">
                <div class="row">
                    <div class="col-sm-6">
                        <h1 class="smaller"><a href="{% url 'admin:project_overview' category.project.id %}">{{category.project.name}}</a></h1>
                        <a href="{% url 'admin:project_overview' category.project.id %}"><span class="glyphicon glyphicon-arrow-left"></span> Project home page</a>
                    </div>
                    <ul class="header-nav">
                        <li class="active"><a href="{% url 'admin:category_list' category.project.id %}">Categories <span class="badge">{{ category.project.categories.count }}</span></a></li>
                        <li><a href="{% url 'admin:usergroup_list' category.project.id %}">User groups <span class="badge">{{ category.project.usergroups.count }}</span></a></li>
                    </ul>
                </div>

            </div>
        </div>

        <div class="container">
            {% include 'snippets/messages.html' %}

            <div class="row">
                <div class="col-sm-4">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h6 class="item-info">Category</h6>
                            <h3>{{ category.name }}</h3>
                            {% if category.description %}<p>{{ category.description|linebreaksbr }}</p>{% endif %}
                        </div>
                        <div class="list-group">
                            <a href="{% url 'admin:category_overview' category.project.id category.id %}" class="list-group-item">Fields</a>
                            <a href="{% url 'admin:category_display' category.project.id category.id %}" class="list-group-item active">Display</a>
                            <a href="{% url 'admin:category_settings' category.project.id category.id %}" class="list-group-item">Settings</a>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <h3 class="header">Display</h3>
                    <form role="form" method="POST" action="{% url 'admin:category_display' category.project.id category.id %}" enctype="multipart/form-data" novalidate>
                        {% csrf_token %}
                        <input type="hidden" name="clear-symbol" id="clear-symbol" value="false">
                        <div class="form-group">
                            <label for="colour" class="control-label">Colour</label>
                            <div class="input-group" id="colour">
                                <input type="text" name="colour" value="{{ category.colour }}" class="form-control">
                                <span class="input-group-addon"><i></i></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="symbol" class="control-label">Symbol</label>
                            <input type="file" name="symbol" id="symbol">
                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-primary">Save</button>
                            <button type="reset" class="btn btn-primary btn-link">Reset</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
{% endblock %}

{% block libraries %}
            <script src="/static/js/admin.ui.forms.validate.js"></script>

            <!-- Colour picker -->
            <link rel="stylesheet" href="/static/lib/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css">
            <script src="/static/lib/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js"></script>
            <script src="/static/js/admin.ui.category.display.js"></script>

            <link rel="stylesheet" href="/static/lib/file-upload/css/fileinput.min.css">
            <script src="/static/lib/file-upload/js/fileinput.min.js"></script>
{% endblock %}
