Have images saved to correct place, when edited in the cave or entrance view. etc

This commit is contained in:
Martin Green 2023-07-05 13:18:02 +01:00
parent 7268eb4f30
commit c4095eb336
3 changed files with 6 additions and 1 deletions

View File

@ -417,6 +417,7 @@ def edit_cave(request, path="", slug=None):
"cave": cave, "cave": cave,
"message": message, "message": message,
"caveAndEntranceFormSet": ceFormSet, "caveAndEntranceFormSet": ceFormSet,
"path": path + "/",
}, },
) )
@ -502,6 +503,7 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
"cave": cave, "cave": cave,
"entletter": entletter, "entletter": entletter,
"entlettereditable": entlettereditable, "entlettereditable": entlettereditable,
"path": path + "/",
}, },
) )

View File

@ -47,7 +47,7 @@ def image_selector(request, path):
if (page_path_base / (f"{name_base}.htm")).is_file(): if (page_path_base / (f"{name_base}.htm")).is_file():
page_url = reverse("expopage", args=[f"{base}l/{name_base}.htm"]) page_url = reverse("expopage", args=[f"{base}l/{name_base}.htm"])
else: else:
page_url = reverse("expopage", args=[f"{base}/l/{name_base}.html"]) page_url = reverse("expopage", args=[f"{base}l/{name_base}.html"])
thumbnails.append({"thumbnail_url": thumbnail_url, "page_url": page_url}) thumbnails.append({"thumbnail_url": thumbnail_url, "page_url": page_url})

View File

@ -173,11 +173,14 @@
function add_image_popup(editor) { function add_image_popup(editor) {
$('.add-image-popup').addClass('active'); $('.add-image-popup').addClass('active');
window.current_editor = editor; window.current_editor = editor;
var path = ""; //Can we get rid of this variable?
/*
{% if not path %} {% if not path %}
var path = $("#id_url").val(); var path = $("#id_url").val();
{% else %} {% else %}
var path = ""; var path = "";
{% endif %} {% endif %}
*/
$('#image_popup_content').load("{% url 'image_selector' path %}" + path, function() { $('#image_popup_content').load("{% url 'image_selector' path %}" + path, function() {
$('.thumbnail').click(function(){ $('.thumbnail').click(function(){
$(".add-image-popup").removeClass("active"); $(".add-image-popup").removeClass("active");