{% extends 'desktop.html' %}

{% block title %} {% if request.page.html_title %}{{ request.page.html_title }} {% else %}{{request.page_site.title}} {{request.page.title}}{% endif %} {% endblock %}
{% block content %}
{% if history %}
	<div class="row" id="history">
		<div class="col-md-12">
			<form>
				<input type="hidden" name="history" value="1">
				Version:<select name="version" onChange="submit();">
					{% for version_option in history %}
						<option value="{{version_option.pk}}" {% ifequal version.pk version_option.pk %} selected {% endifequal %} >{{version_option.saved}}</option>
					{% endfor %}
				</select>
				<input type="submit" value="View">
	
				{% if version %}
					{% if perms.page.change_page %}<a href="?history=1&revert=1&version={{version.pk}}&next=/{{page.slug}}">Revert to {{version.saved}} Version as shown below.</a>{% endif %} &nbsp;
				{% endif %}
			</form>
		<div>	
	</div>
	
{% endif %}
<div class="row">
    <div class="col-md-12">
    {% if object %}
        {% if user_page_edit %}
            <a class="btn btn-warning" href="{% url 'page_edit' object.slug %}" > Edit Page</a>
        {% endif %}
        {{object.content|safe}}
    {% else %}
                Sorry that page was not found.
                {% if user_page_add %}
                    <a href="{% url 'page_add' %}?slug={{slug}}" > Add Now</a>
                {% endif %}
    {% endif %}
    </div>
</div>


{% endblock %}