aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/wiki/edit.html
blob: 622e98eb138705862d9cec58a6e1d8880cbc1dbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{% extends "wiki/article.html" %}
{% load wiki_tags i18n sekizai_tags static %}


{% block wiki_pagetitle %}
  Edit: {{ article.current_revision.title }}
{% endblock %}

{% block wiki_contents_tab %}

  {% if not user.is_authenticated %}
    <p class="alert alert-warning">
      {% trans "<strong>Warning:</strong> You are not logged in. Your IP address will be logged." %}
      <a href="{% url 'wiki:login' %}?next={% url 'wiki:edit' article_id=article.id path=urlpath.path %}">{% trans "Click here to log in" %} &raquo;</a>
    </p>
  {% endif %}

  <div class="columns">

    <div class="column is-two-thirds">
      <form method="POST" class="form-horizontal" id="article_edit_form">
        {% with edit_form as form %}
          {% include "wiki/includes/editor.html" %}
        {% endwith %}

        <button class="button is-light" type="submit" name="preview" value="1" id="id_preview"
                formaction="{% url 'wiki:preview' path=urlpath.path article_id=article.id %}"
                formtarget="previewWindow"
        >
          <span class="icon">
            <i class="fas fa-eye"></i>
          </span>
          <span>Preview</span>
        </button>
        <button class="button is-primary" type="submit" name="save" value="1" id="id_save">
          <span class="icon">
            <i class="fas fa-save"></i>
          </span>
          <span>Save Changes</span>
        </button>

        <div class="is-pulled-right">
          {% if user.is_authenticated and urlpath.path %}
            <a href="{% url 'wiki:move' path=urlpath.path article_id=article.id %}" class="button is-warning ">
              <span class="icon">
                <i class="fas fa-random"></i>
              </span>
              <span>Move Article</span>
            </a>
          {% endif %}
          {% if article|can_delete:user %}
            <a href="{% url 'wiki:delete' path=urlpath.path article_id=article.id %}" class="button is-danger">
              <span class="icon">
                <i class="fas fa-trash"></i>
              </span>
              <span>Delete Article</span>
            </a>
          {% endif %}
        </div>

        <br />
        <br />

      </form>
    </div>

    <div class="column is-one-third" id="wiki-edit-sidebar">
      {% include "wiki/includes/editor_sidebar.html" %}
    </div>

  </div>

  <div style="clear: both"></div>

  <div class="modal" id="previewModal">
    <div class="modal-background"></div>
    <div class="modal-card" style="height: 80%; width: 80%;">
      <div class="modal-card-head">
        <p class="modal-card-title">Article Preview</p>
      </div>
      <div class="modal-card-body" style="padding: 0; overflow: hidden;">
        <iframe name="previewWindow" frameborder="0" style="width: 100%; height: 100%;"></iframe>
      </div>
      <div class="modal-card-foot">
        <button class="button is-light" aria-label="close">
          <span class="icon">
            <i class="fas fa-arrow-left"></i>
          </span>
          <span>Back</span>
        </button>
        <a class="button is-primary" id="id_preview_save_changes">
          <span class="icon">
            <i class="fas fa-save"></i>
          </span>
          <span>Save Changes</span>
        </a>
      </div>
    </div>
  </div>

  <script src="{% static "js/wiki/modal.js" %}" type="text/javascript"></script>
  <script src="{% static "js/wiki/edit.js" %}" type="text/javascript"></script>
  <script type="text/javascript">
    $(document).ready(function() {
      $("#id_revision").val('{{ article.current_revision.id }}');
    });
  </script>
{% endblock %}