Password protection of admin pages, publish-switch and small fixes

This commit is contained in:
2017-05-24 12:09:02 +02:00
parent 149a5d4b24
commit c3b0ce9537
8 changed files with 67 additions and 30 deletions

View File

@@ -40,6 +40,9 @@
{% macro delete_button(type, title, id) -%}
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#deletemodal" data-type="{{type}}" data-id="{{id}}" data-title="{{title}}"><span class="glyphicon glyphicon-remove"></button>
{%- endmacro %}
{% macro glyphicon(icon) -%}
<span class="glyphicon glyphicon-{{icon}}"></span>
{%- endmacro %}
{% block content %}
<div class="modal fade" id="deletemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"><!-- Delete modal -->
@@ -73,6 +76,11 @@
{% for page in pages recursive %}
<div class="list-group-item">
/{{ page.permalink }} - {{ page.title }}
{% if page.published %}
<span class="glyphicon glyphicon-eye-open"></span>
{% else %}
<span class="glyphicon glyphicon-eye-close"></span>
{% endif %}
<a href="{{url_for('admin_page', id=page.id)}}" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></a>
{% if page.endpoint %}
{% else %}
@@ -145,17 +153,17 @@
<script>
$('#deletemodal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var type = button.data('type')
var id = button.data('id')
var title = button.data('title')
, type = button.data('type')
, id = button.data('id')
, title = button.data('title')
var modal = $(this)
if(type == 'page') {
var message = 'Vill du verkligen ta bort sidan - ' + title + '?'
var href = '/admin/delpage/' + id
, href = '/admin/delpage/' + id
} else {
var message = 'Vill du verkligen ta bort bilden - ' + title + '?'
var href = '/admin/delphoto/' + id
, href = '/admin/delphoto/' + id
}
modal.find('.modal-body p').text(message)
modal.find('.modal-footer a').attr('href', href)