{% extends "home_base.html" %}

{% load seahub_tags i18n %}
{% load url from future %}

{% block sub_title %}{% trans "Personal Wiki" %} - {% endblock %}

{% block cur_personal_wiki %}tab-cur{% endblock %}

{% block right_panel %}
<div class="wiki-top w100 ovhd">
    <ul class="wiki-nav fleft">
        <li class="item"><a href="{% url 'personal_wiki' %}" class="link">{% trans "Home" %}</a></li>
        <li class="item cur-item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li>
        <li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li>
    </ul>
    <button id="page-create" class="op-btn">{% trans "New Page" %}</button>
</div>

<ul id="wiki-pages">
    {% for page_slug, page in pages.items %}
    <li><a href="{% url 'personal_wiki' page_slug %}">{{ page }}</a></li>
    {% endfor %}
</ul>

<form id="page-create-form" action="{% url 'personal_wiki_page_new' %}" method="post" class="hide">{% csrf_token %}
    <h3>{% trans "New Page"%}</h3>
    <label>{% trans "Name"%}</label><br/>
    <input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}"/><br />
    <p class="error hide"></p>
    <input type="submit" id="page-create-submit" value="{% trans "Submit"%}" class="submit" />
</form>
{% endblock %}

{% block extra_script %}{{block.super}}
<script type="text/javascript">
$('#page-create').click(function() {
    $('#page-create-form').modal({appendTo: '#main', autoResize: true});
})
</script>
{% endblock %}
