article_form.html 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{% extends "base.html" %}
{% load static %}
{% load crispy_forms_tags %}
{% load crispy_forms_field %}


{% block content-banner %}
{% endblock %}

{% block content %}
<div class="row">
<div class="col-md-12 white-bg">
  <div class="well">

  <form class="" action="#" method="post">

    <div class="d-flex justify-content-start align-items-baseline mb-4">
      <p class="lead">
        <a class="btn btn-outline-primary" href="{{request.META.HTTP_REFERER}}"><i class="fa fa-chevron-left" aria-hidden="true"></i> Go back</a>
cynddl's avatar
cynddl committed
20 21 22 23 24
        {% if object.status == 'PUBLISHED' %}
        <span class="ml-2"><strong>Article ID #{{object.id}} published on {{ object.published_at|date:"DATETIME_FORMAT" }}</strong></span>
        {% else %}
        <span class="ml-2"><strong>Article ID #{{object.id}}</strong></span>
        {% endif %}
25 26 27

        <a class="btn btn-outline-primary" href="?fetch_content">Fetch content</a>
        <a class="btn btn-outline-primary" href="?fetch_image">Fetch image</a>
28 29 30 31
      </p>
      <div class="ml-auto">
        <span>Save and&nbsp;</span>
        <span class="btn-group" role="group" aria-label="Actions">
cynddl's avatar
cynddl committed
32 33 34 35 36 37
          {% if object.status == 'PUBLISHED' %}
          <input type="submit" class="btn btn-outline-danger" name="view" value="View">
          {% else %}
          <input type="submit" class="btn btn-outline-primary" name="preview" value="Preview">
          <input type="submit" class="btn btn-outline-warning" name="publish" value="Publish">
          {% endif %}
38 39 40 41 42 43 44 45
        </span>
      </div>
    </div>

    {% crispy form %}
  </form>
</div>
</div>
cynddl's avatar
cynddl committed
46 47 48 49 50 51 52 53

<script type="text/javascript">
  $('[name=tags]').select2({
    tags: true,
    tokenSeparators: [',', ' '],
    theme: "bootstrap"
  });
  $('.select2-container').width("auto");
54 55 56 57 58 59 60 61 62 63

  var simplemde = new SimpleMDE({
    element: $("#id_extracts")[0],
    toolbar: ["bold", "italic", "strikethrough", "|", "heading", "quote", "link", "|", "side-by-side", "preview", "guide"],
    spellChecker: false,
    blockStyles: {
      bold: "**",
      italic: "_"
    },
  });
cynddl's avatar
cynddl committed
64
</script>
65
{{ form.media }}
66
{% endblock %}