From 5b0b3803d2b3c7ef16606ba1852ec784779d39a8 Mon Sep 17 00:00:00 2001 From: EmperorProbus Date: Mon, 6 Jan 2025 16:10:01 +0100 Subject: [PATCH] =?UTF-8?q?Domy=C5=9Blna=20warto=C5=9B=C4=87=20komponentu?= =?UTF-8?q?=20CourseFilter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Komponent CourseFilter na odpowiedniej stronie ma teraz ustawioną wartość domyślną, aby na początku pokazywał jedynie kursy w ofercie i poddane pod głosowanie. Jednocześnie możliwość zachowania stanu filtrów przy odświeżaniu strony została zachowana. --- .../proposal/assets/components/CourseFilter.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/zapisy/apps/offer/proposal/assets/components/CourseFilter.vue b/zapisy/apps/offer/proposal/assets/components/CourseFilter.vue index d719d1e4a6..ac23006c68 100644 --- a/zapisy/apps/offer/proposal/assets/components/CourseFilter.vue +++ b/zapisy/apps/offer/proposal/assets/components/CourseFilter.vue @@ -64,6 +64,21 @@ export default Vue.extend({ { value: "IN_VOTE", label: "poddany pod głosowanie" }, { value: "WITHDRAWN", label: "wycofany z oferty" }, ]; + + // Property "manual" signifies that from this point on + // changes in filters are supposed to persist through page refreshes. + const url = new URL(window.location.href); + if (!url.searchParams.has("manual")) { + // Delete previous parameters + const keys = url.searchParams.keys(); + for (const key of keys) { + url.searchParams.delete(key); + } + // Set the default parameters + url.searchParams.set("status", "IN_OFFER,IN_VOTE"); + url.searchParams.append("manual", "1"); + } + window.history.replaceState(null, "", url.toString()); }, mounted: function () { // Extract filterable properties names from the template.