Skip to content

Commit

Permalink
Fix image not showing up when changed on forum creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bburgess19 committed Dec 5, 2023
1 parent 274991b commit 6deb1b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
15 changes: 14 additions & 1 deletion src/templates/forum/board_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
https://github.com/ellmetha/django-machina/blob/main/machina/templates/machina/board_base.html-->
{% extends 'machina/board_base.html' %}

{% load i18n %}
{% load static i18n %}
{% load forum_permission_tags %}

{% block title %}
{{ MACHINA_FORUM_NAME|default:"Forum" }}
{% block sub_title %}
{% endblock sub_title %}
{% endblock title %}
{% block css %}
{{ block.super }}
<link rel="stylesheet"
href="{% static 'css/machina.board_theme.vendor.min.css' %}" />
<link rel="stylesheet"
href="{% static 'css/machina.board_theme.min.css' %}" />
<link rel="stylesheet" href="{% static 'machina/custom-styling.css' %}" />
{% endblock css %}
{% block body %}
<div class="my-5 container" id="main_container">
<div class="row">
Expand Down
12 changes: 6 additions & 6 deletions src/templates/forum/forum_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
const files = e.target.files;
const [file] = files;
var trashButton = document.getElementById("trash-button");
var imgPreview = document.getElementById("img-preview");

// Remove the previous image if one is already loaded
if (trashButton) {
trashButton.click();
}

if (file) {
// Replace the previous image if one is already loaded
if (trashButton && imgPreview) {
imgPreview.src = URL.createObjectURL(file);
return;
} else if (file) {
trashButton = document.createElement('button');
const trashImg = document.createElement('i');
const imgPreview = document.createElement('img');
Expand Down

0 comments on commit 6deb1b7

Please sign in to comment.