[FIX] HELPDESK: Fixed faq answers not showing when searching faq and changed the modal

This commit is contained in:
Horilla
2024-05-29 14:21:33 +05:30
parent b4a49605da
commit d16a898371
8 changed files with 33 additions and 22 deletions

View File

@@ -22,7 +22,7 @@
hx-encoding="multipart/form-data"
>
{{form.as_p}}
<div class="oh-modal__dialog-footer">
<div class="d-flex flex-row-reverse">
<input
type="submit"
value='{% trans "Save" %}'

View File

@@ -27,9 +27,10 @@
<li class="oh-dropdown__item">
<a
hx-get="{% url 'faq-category-update' category.id %}"
hx-target="#faqCategoryCreate"
hx-target="#objectCreateModalTarget"
data-toggle="oh-modal-toggle"
data-target="#faqCategoryCreate"
data-target="#objectCreateModal"
role="button"
class="oh-dropdown__link"
>{% trans "Edit" %}</a
>

View File

@@ -74,9 +74,9 @@
<button
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#faqCategoryCreate"
data-target="#objectCreateModal"
hx-get="{% url 'faq-category-create' %}"
hx-target="#faqCategoryCreate"
hx-target="#objectCreateModalTarget"
>
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}

View File

@@ -22,7 +22,7 @@
hx-encoding="multipart/form-data"
>
{{form.as_p}}
<div class="oh-modal__dialog-footer">
<div class="d-flex flex-row-reverse">
<input
type="submit"
value='{% trans "Save" %}'

View File

@@ -5,9 +5,9 @@
<ul class="oh-faq__items">
{% for faq in faqs %}
<li class="oh-faq__item">
<div class="oh-faq__item-header">
<div class="oh-faq__item-header__left">
<span class="oh-faq__item-title"> {{faq.question}} </span>
<div class="oh-faq__item-header icon-inner" onclick="show_answer(this)">
<div class="oh-faq__item-header__left icon-inner">
<span class="oh-faq__item-title icon-inner"> {{faq.question}} </span>
<ul class="oh-faq__tags">
{% for tag in faq.tags.all %}
<li class="oh-faq__tag text-light" style="background:{{tag.color}};">{{tag|capfirst}}</li>
@@ -20,9 +20,9 @@
class="oh-btn oh-btn--sq oh-btn--transparent"
title="{% trans 'Edit' %}"
data-toggle="oh-modal-toggle"
data-target="#faqCreate"
data-target="#objectCreateModal"
hx-get="{% url 'faq-update' faq.id %}"
hx-target="#faqCreate"
hx-target="#objectCreateModalTarget"
onclick='event.stopPropagation()'
>
<ion-icon name="create-outline"></ion-icon>

View File

@@ -120,12 +120,20 @@
return $(this).val();
}).get();
// Check if 'create_new_tag' exists in the list
if (selectedValues.includes('create_new_tag')) {
$("#addTagModal").addClass("oh-modal--show");
}
}
function show_answer(element){
if ($(element).parent(".oh-faq__item--show").length !=0){
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
} else {
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
$(element).parent('.oh-faq__item').addClass("oh-faq__item--show");
}
}
$("#addTagForm").on('submit', function(){
event.preventDefault();
$.ajax({

View File

@@ -89,9 +89,9 @@
<button
class="oh-btn oh-btn--secondary oh-btn--shadow"
data-toggle="oh-modal-toggle"
data-target="#faqCreate"
data-target="#objectCreateModal"
hx-get="{% url 'faq-create' cat_id %}"
hx-target="#faqCreate"
hx-target="#objectCreateModalTarget"
>
<ion-icon name="add-outline" class="me-1"></ion-icon>
{% trans "Create" %}

View File

@@ -91,6 +91,15 @@
$("#suggestion_box").hide();
}
function show_answer(element){
if ($(element).parent(".oh-faq__item--show").length !=0){
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
} else {
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
$(element).parent('.oh-faq__item').addClass("oh-faq__item--show");
}
}
$(document).ready(function () {
var autocompleteSuggestions = $('.oh-autocomplete-suggestions');
@@ -128,14 +137,7 @@
});
$(document).ready(function(){
$(".oh-faq__item-header").on("click", function(){
if ($(this).parent(".oh-faq__item--show").length !=0){
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
} else {
$(".oh-faq__item--show").removeClass("oh-faq__item--show");
$(this).parent('.oh-faq__item').addClass("oh-faq__item--show");
}
})
});
</script>
{% endblock %}