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)

View File

@@ -14,6 +14,8 @@
{{ wtf.form_field(form.title, form_type="horizontal") }}
{{ wtf.form_field(form.parent, form_type="horizontal") }}
<div class="form-group">
<label class="control-label col-lg-2" for="description">Beskrivning</label>
<div class="col-lg-10">
@@ -22,6 +24,7 @@
</div>
{{ wtf.form_field(form.endpoint, form_type="horizontal") }}
{{ wtf.form_field(form.published, form_type="horizontal") }}
<div class="form-group">
<label class="control-label col-lg-2" for="thumbnail">Bild</label>

View File

@@ -44,14 +44,14 @@
<div class="col-md-6 col-sm-12"> <!-- Content -->
<div class="panel panel-default">
<div class="panel-body">
<div class="panel-title"> <h2>{{ page.title }}</h2> </div>
<!-- <div class="panel-title"> <h2>{{ page.title }}</h2> </div> -->
{{ page.description | markdown }}
</div>
{% if page.endpoint %}
<div class="panel-footer">
{% if page.endpoint %}
<a href="mailto:order@designbyloven.se" class="btn btn-default"><span class="glyphicon glyphicon-envelope"></span>&nbsp;Beställ</a>
{% endif %}
</div>
{% endif %}
</div>
</div> <!-- Content -->
</div> <!-- Content row -->
@@ -75,6 +75,7 @@
{% else %}
<div class="row"> <!-- Subsection list !-->
{% for c in page.children %}
{% if c.published %}
<div class="col-xs-6 col-md-3">
<div class="thumbnail">
<div class="caption" style="padding: 0;">
@@ -83,6 +84,7 @@
<a href="{{ c.permalink }}"><img src="{{ c.thumbnail.thumbnail }}" class="img-responsive"></a>
</div>
</div>
{% endif %}
{% endfor %}
</div> <!-- Subsection list -->
{% endif %}