From 39bc0ae8ce8fb59f1d5fc29a866ba02c6682e4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20H=C3=A1la?= Date: Wed, 20 Sep 2023 21:56:12 +0200 Subject: [PATCH] Remeber what tab was choosen on pdf/list --- backend/static/js/Options.js | 27 +++++++++++++++++++++++++++ pdf/templates/pdf/requests/list.html | 23 +++++++++++++++++------ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/backend/static/js/Options.js b/backend/static/js/Options.js index 30ccdf8..454355b 100644 --- a/backend/static/js/Options.js +++ b/backend/static/js/Options.js @@ -28,6 +28,33 @@ export class BooleanOption { } } +export class CheckboxOption { + constructor(checkbox, callable, defaultValue) { + this.checkbox = checkbox; + this.callable = callable; + this.defaultValue = defaultValue || false; + } + + get() { + return this.checkbox.filter(":checked").val() + } + + set(value) { + this.checkbox.filter("[value=" + value + "]").prop("checked", true) + } + + call(value) { + this.callable(value) + } + + selector() { + return this.checkbox + } + + default() { + return this.defaultValue + } +} export class Options { constructor(options) { this.options = options diff --git a/pdf/templates/pdf/requests/list.html b/pdf/templates/pdf/requests/list.html index f9070e0..6345e8b 100644 --- a/pdf/templates/pdf/requests/list.html +++ b/pdf/templates/pdf/requests/list.html @@ -1,6 +1,7 @@ {% extends "base/frame.html" %} {% load i18n %} {% load types %} +{% load static %} {% block title %} {% trans "PDF Requests" %} {% endblock %} {% block header %} {% trans "PDF Requests" %} {% endblock %} @@ -8,12 +9,14 @@ {% block extra_head %} + + {% endblock %} {% block framed_body %}
{% endblock %} \ No newline at end of file