From 82fe3504936987ca4d44f21e4c7b0c6aeb256761 Mon Sep 17 00:00:00 2001
From: Martin Green <martin.speleo@gmail.com>
Date: Mon, 27 Jun 2022 00:34:08 +0100
Subject: [PATCH] Added HTMLarea widget to the edit entrance form

---
 core/forms.py               | 30 ++++++++++++++++++++----------
 templates/editentrance.html |  4 ++--
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/core/forms.py b/core/forms.py
index 19a3b1b..f3df10a 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -68,18 +68,28 @@ class EntranceForm(ModelForm):
     the other fields are present on the form, but use the default presentaiton style
     '''
     name = forms.CharField(required = False, widget=forms.TextInput(attrs={'size': '45'}))
-    entrance_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':9}))
+    entrance_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
     explorers = forms.CharField(required = False, widget=forms.TextInput(attrs={'size': '45'}))
     #explorers = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10}))
-    map_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':3}))
-    location_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':3}))
-    approach = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':3}))
-    underground_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':3}))
-    photo = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':2}))
-    marking_comment = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':2}))
-    findability_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':2}))
-    other_description = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':2}))
-    bearings = forms.CharField(required = False, widget=forms.Textarea(attrs={'rows':2}))
+    map_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    location_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    approach = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    underground_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    photo = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    marking_comment = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    findability_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    other_description = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
+    bearings = forms.CharField(required = False, widget=HTMLarea(
+                                           attrs={"height":"80%", "rows":20, 'placeholder': "Enter page content (using HTML)"}))
     other_station = forms.CharField(required=False) 
     tag_station = forms.CharField(required=False) 
     exact_station = forms.CharField(required=False) 
diff --git a/templates/editentrance.html b/templates/editentrance.html
index 48a6ba5..83273ff 100644
--- a/templates/editentrance.html
+++ b/templates/editentrance.html
@@ -2,11 +2,11 @@
 
 {% block title %}Edit Entrance{% endblock %}
 {% block extraheaders %}
-
-<!--<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>-->
+{% include 'html_editor_scripts_css.html' %}
 {% endblock %}
 {% block content %}
 <h1>Edit Entrance - at cave {{cave.official_name|safe}} - {{cave.kataster_number}}</h1>
+{% include 'html_editor_pop_ups.html' %}
 <h2>{{message}}</h2>
 <p>{{entletter}}
 <form action="" method="post">{% csrf_token %}