{% extends 'djaken/base.html' %}
{% load i18n static %}

{% block extrastyle %}
{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "djaken/css/view_note.css" %}" />
{% endblock %}

{% block title %}{{note.title}} | {{ site_title|default:_('Djaken') }}{% endblock %}

{% block content %}
    <div class="controls">
        <table class="outer">
            <tr>
                <td>
                    <table class="inner">
                        <tr>
                            <td class="control_button">
                                <a class="edit_button" title="{% trans 'Edit note' %}" href="{% url 'djaken:edit_note' note.pk %}"></a>
                            </td>
                            <td class="control_buttons">
                               {% if note.relevant %}
                                   <a title="{% trans 'Set as irrelevant' %}" href="{% url 'djaken:view_note_toggle_relevant' note.pk %}" class="toggle-control toggle-on"></a>
                               {% else %}
                                   <a title="{% trans 'Set as relevant' %}" href="{% url 'djaken:view_note_toggle_relevant' note.pk %}" class="toggle-control"></a>
                               {% endif %}
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <div class="note_content">
        {{ note_content_html|safe }}
    </div>
    <div class="footer">
        {% if note.is_encrypted %}
            <p class="encryption_icon"></p>
        {% endif %}
        {% if note.relevant %}
            <p class="note_relevant">
                {% trans 'Relevant' %}
            </p>
        {% endif %}
        {% if not note.relevant %}
            <p class="note_not_relevant">
                {% trans 'Not Relevant' %}
            </p>
        {% endif %}
        <p>
            {% trans 'Modified on' %}
            <time datetime="{{note.modified|date:"c"}}">
                {{note.modified|date}}
            </time>
        </p>
        <p>
            {% trans 'Created on' %}
            <time datetime="{{note.created|date:"c"}}">
                {{note.created|date}}
            </time>
        </p>
    </div>
    <script type="text/javascript">
        window.onload = function() {
            history.replaceState("", "", "/view_note/{{note.id}}");
        }
        var links = document.links;
        for (var i = 0, linksLength = links.length; i < linksLength; i++) {
             if (links[i].hostname != window.location.hostname) {
                 links[i].target = '_blank';
             } 
        }
    </script>
{% endblock %}
