aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/templates/wiki/create.html
blob: 5cd5e29242791f5daadf361058bbb117b0dc87cb (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
{% extends "wiki/base.html" %}
{% load wiki_tags i18n sekizai_tags static %}


{% block wiki_pagetitle %}{% trans "Add new article" %}{% endblock %}

{% block wiki_contents %}

  {% addtoblock "js" %}
    <script type="text/javascript" src="{% static "admin/js/urlify.js" %}"></script>
    <script type="text/javascript">
    {% if not create_form.slug.value %}
    //<![CDATA[
    (function($) {
      $(document).ready(function (){
        $("#id_title").keyup(function () {
          var e = $("#id_slug")[0];
          if(!e._changed) {
            slug = URLify(this.value, 50);
            e.value = slug;
          }
          });
      });
    })(jQuery);
    //]]>
    {% endif %}
    </script>
  {% endaddtoblock %}

  {% include "wiki/includes/editormedia.html" %}
  <h1 class="page-header">{% trans "Add new article" %}</h1>

  <form method="POST" class="form-horizontal">
    {% wiki_form create_form %}

    <div class="field is-horizontal is-grouped">
      <div class="control">
        <a href="{% url 'wiki:get' path=parent_urlpath.path %}" class="button is-light">
          <span class="icon">
            <i class="fa fa-arrow-left"></i>
          </span>
          <span>Go back</span>
        </a>
      </div>
      <div class="control">
        <button type="submit" name="save_changes" class="button is-primary">
          <span class="icon">
            <i class="fa fa-plus"></i>
          </span>
          <span>Create Article</span>
        </button>
      </div>
    </div>
  </form>

{% endblock %}