Skip to content
Snippets Groups Projects
Commit 26f29497 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix oer search difficulty level filter, fixes #2429

Closes #2429

Merge request studip/studip!3514
parent 0feb5a50
No related branches found
No related tags found
1 merge request!8UI und UX Anpassungen für #3263
......@@ -20,28 +20,28 @@
-
<span>{{ difficulty[1] }}</span>
<a href="#"
@click.prevent="clearDifficulty"
@click.prevent="clearDifficulty()"
class="erasefilter"
title="<?= _('Filter des Niveaus entfernen') ?>">
<studip-icon shape="decline" role="clickable" :size="16" class="text-bottom"></studip-icon>
<studip-icon shape="decline" class="text-bottom"></studip-icon>
</a>
</span>
<input type="text"
name="search"
@focus="showFilterPanel"
@keyup="sync_search_text"
@keydown.enter.prevent="search">
@focus="showFilterPanel()"
@keyup="sync_search_text()"
@keydown.enter.prevent="search()">
<button v-if="difficulty[0] != 1 || difficulty[1] != 12 || (category != null) || (searchtext.length > 0)"
class="erase"
type="button"
title="<?= _('Suchformular zurücksetzen') ?>"
@click="clearAllFilters">
@click="clearAllFilters()">
<studip-icon shape="decline" role="clickable"></studip-icon>
</button>
<button @click="triggerFilterPanel"
<button @click="triggerFilterPanel()"
type="button"
title="<?= _('Suchfilter einstellen') ?>"
:class="activeFilterPanel ? 'active' : ''">
......
......@@ -66,7 +66,7 @@ const OER = {
clearAllFilters: function (keep_results) {
this.clearCategory();
this.clearDifficulty();
if (this.searchtext != '') {
if (this.searchtext.length !== 0) {
this.searchtext = '';
}
$(".oer_search input[name=search]").val('');
......@@ -75,10 +75,9 @@ const OER = {
}
},
clearDifficulty: function () {
if ((this.difficulty[0] != 1) && (this.difficulty[1] != 12)) {
this.difficulty = [1, 12];
}
jQuery("#difficulty_slider").slider("values", this.difficulty);
this.difficulty[0] = 1;
this.difficulty[1] = 12;
jQuery('#difficulty_slider').slider('values', this.difficulty);
},
clearCategory: function () {
if (this.category != null) {
......@@ -201,7 +200,7 @@ const OER = {
}
}
},
mounted: function () {
mounted() {
this.results = $(this.$el).data('searchresults');
if (this.results !== false) {
$("#new_ones").hide();
......@@ -209,8 +208,14 @@ const OER = {
if ($(this.$el).data('filteredcategory')) {
this.category = $(this.$el).data('filteredcategory');
}
document.addEventListener('click', (event) => {
if (event.closest('.searchform') === null) {
this.hideFilterPanel();
}
})
},
updated: function () {
updated() {
this.$nextTick(function () {
if (!jQuery("#difficulty_slider.ui-slider").length) { //to prevent an endless loop
let v = this;
......@@ -228,14 +233,6 @@ const OER = {
}
});
});
jQuery(document).on("click", function (evnt) {
if (!jQuery(evnt.target).is(".searchform *") && STUDIP.OER.Search) {
STUDIP.OER.Search.hideFilterPanel();
}
});
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment