From eed4c3f68d9819c34b988248e558e893548a1ead Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Wed, 15 Aug 2018 13:45:57 +0100
Subject: [PATCH] Move the base js so that we dont get conflicts with jquery on
 load

---
 opentech/apply/funds/blocks.py                           | 3 ++-
 .../templates/funds/applicationsubmission_form.html      | 9 +++------
 opentech/templates/base-apply.html                       | 4 ++--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/opentech/apply/funds/blocks.py b/opentech/apply/funds/blocks.py
index ccc4bb0db..614bf4918 100644
--- a/opentech/apply/funds/blocks.py
+++ b/opentech/apply/funds/blocks.py
@@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
 from addressfield.fields import AddressField
 from opentech.apply.categories.blocks import CategoryQuestionBlock
 from opentech.apply.stream_forms.blocks import FormFieldsBlock
-from opentech.apply.utils.blocks import MustIncludeFieldBlock, CustomFormFieldsBlock
+from opentech.apply.utils.blocks import MustIncludeFieldBlock, CustomFormFieldsBlock, RichTextFieldBlock
 
 
 class ApplicationMustIncludeFieldBlock(MustIncludeFieldBlock):
@@ -103,6 +103,7 @@ class DurationBlock(ApplicationMustIncludeFieldBlock):
 
 class ApplicationCustomFormFieldsBlock(CustomFormFieldsBlock, FormFieldsBlock):
     category = CategoryQuestionBlock(group=_('Custom'))
+    rich_text = RichTextFieldBlock(group=_('Fields'))
     required_blocks = ApplicationMustIncludeFieldBlock.__subclasses__()
 
 
diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_form.html b/opentech/apply/funds/templates/funds/applicationsubmission_form.html
index db69471fe..8cfff8a97 100644
--- a/opentech/apply/funds/templates/funds/applicationsubmission_form.html
+++ b/opentech/apply/funds/templates/funds/applicationsubmission_form.html
@@ -25,12 +25,13 @@
     <div>
         <form class="form" action="" method="post" enctype="multipart/form-data">
             {% csrf_token %}
+            {{ form.media }}
 
             {% for field in form %}
                 {% if field.field %}
-                {% include "funds/includes/field.html" %}
+                    {% include "funds/includes/field.html" %}
                 {% else %}
-                {{ field }}
+                    {{ field }}
                 {% endif %}
             {% endfor %}
             {% for button_name, button_value in buttons %}
@@ -47,7 +48,3 @@
 </div>
 
 {% endblock %}
-
-{% block extra_js %}
-    {{ form.media }}
-{% endblock %}
diff --git a/opentech/templates/base-apply.html b/opentech/templates/base-apply.html
index 5ebdb2b76..f44eb0c3f 100644
--- a/opentech/templates/base-apply.html
+++ b/opentech/templates/base-apply.html
@@ -29,6 +29,8 @@
         <link rel="stylesheet" type="text/css" href="{% static 'css/apply/main.css' %}">
         {# Hijack styling #}
         <link rel="stylesheet" type="text/css" href="{% static 'hijack/hijack-styles.css' %}" />
+
+        <script type="text/javascript" src="{% static 'js/main.js' %}"></script>
     </head>
 
     <body class="{% block body_class %}light-grey-bg template-{{ page.get_verbose_name|slugify }}{% endblock %}">
@@ -93,8 +95,6 @@
         </main>
 
         <footer class="footer"></footer>
-
-        <script type="text/javascript" src="{% static 'js/main.js' %}"></script>
         {% block extra_js %}{% endblock %}
     </body>
 </html>
-- 
GitLab