Files
digest_app/templates/module_cms/privacy_policy_edit.html
2024-04-08 00:33:02 +05:30

70 lines
2.7 KiB
HTML

{% extends 'base_structure/layout/base_template.html' %}
{% load static %}
{% block stylesheet %}
<!-- include required css cdn link through html here -->
{% include "cdn_through_html/quill_cdn_css.html" %}
{{form.media}}
{% endblock %}
{% block content %}
<div class="row layout-top-spacing">
<div class="col-lg-12">
<div class="row mb-2">
<div class="col">
<a href="{% url 'module_cms:privacy_policy'%}" style="height: fit-content;width: fit-content;display: inline-block;">
<h3 class="card-title m-2 d-flex align-items-center gap-2" style="width: fit-content;"><span class="fw-bold material-symbols-outlined">
arrow_back
</span><span>{{operation}} Privacy Policy</span></h3>
</a>
</div>
</div>
<div class="row layout-spacing">
<div class="col-lg-12">
<div class="statbox widget box box-shadow">
<div class="widget-content widget-content-area">
<form method="POST" id="privacy_policy_form">
{% csrf_token %}
{% include 'base_structure/includes/dynamic_template_form.html' with form=form %}
<div id="privacy_policy_error" class="text-danger"></div>
<div class="mt-4 mb-0">
<div class="d-grid"><button class="btn btn-primary btn-block" type="submit">Submit</button></div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock content %}
{% block javascript %}
<!-- include required css cdn link through html here -->
{% include "cdn_through_html/quill_cdn_js.html" %}
<script>
$(document).ready(function() {
// Initialize form submission event handler
$("#privacy_policy_form").submit(function(event) {
console.log("function called")
// Check if the Quill editor has any content
var quillContent = $("#quill-id_privacy_policy .ql-editor").html().trim();
if (quillContent === '<p><br></p>') {
// If Quill editor content is empty, prevent form submission and display an error message
event.preventDefault();
$("#privacy_policy_error").text("Please enter some text.").show();
} else {
// If Quill editor content is not empty, allow form submission
$("#privacy_policy_error").hide();
}
});
});
</script>
{% endblock %}