summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-01-02 14:24:32 +0100
committerYorhel <git@yorhel.nl>2020-01-02 14:24:32 +0100
commite54f08dd75563be788b9dc16e17165e1c8c81542 (patch)
treedab47ccee837a86be13b14809976fdb088e42b07
parent3d22bada02f2d10a2bde03813cca2445b3d36132 (diff)
ulist: Hide "Multi-select" when JS is disabled + auto-submit on label filter selection
-rw-r--r--elm/UList/labelfilters.js5
-rw-r--r--lib/VNWeb/User/Lists.pm8
2 files changed, 10 insertions, 3 deletions
diff --git a/elm/UList/labelfilters.js b/elm/UList/labelfilters.js
index 6a91a82d..dfec97c6 100644
--- a/elm/UList/labelfilters.js
+++ b/elm/UList/labelfilters.js
@@ -1,12 +1,17 @@
var p = document.querySelectorAll('.labelfilters')[0];
if(p) {
var multi = document.getElementById('form_l_multi');
+ multi.parentNode.classList.remove('hidden');
var l = document.querySelectorAll('.labelfilters input[name=l]');
l.forEach(function(el) {
el.addEventListener('click', function() {
if(multi.checked)
return true;
l.forEach(function(el2) { el2.checked = el2 == el });
+ var n=el;
+ while(n && n.nodeName.toLowerCase() != 'form')
+ n=n.parentNode;
+ n.submit();
});
});
}
diff --git a/lib/VNWeb/User/Lists.pm b/lib/VNWeb/User/Lists.pm
index 8da7fbdb..e9a33bec 100644
--- a/lib/VNWeb/User/Lists.pm
+++ b/lib/VNWeb/User/Lists.pm
@@ -317,9 +317,11 @@ sub filters_ {
span_ class => 'linkradio', sub {
join_ sub { em_ ' / ' }, \&lblfilt_, grep $_->{id} < 10, @$filtlabels;
- em_ ' || ';
- input_ type => 'checkbox', name => 'mul', value => 1, id => 'form_l_multi', tabindex => 10, $opt->{mul} ? (checked => 'checked') : ();
- label_ for => 'form_l_multi', 'Multi-select';
+ span_ class => 'hidden', sub {
+ em_ ' || ';
+ input_ type => 'checkbox', name => 'mul', value => 1, id => 'form_l_multi', tabindex => 10, $opt->{mul} ? (checked => 'checked') : ();
+ label_ for => 'form_l_multi', 'Multi-select';
+ };
debug_ $filtlabels;
};
my @cust = grep $_->{id} >= 10, @$filtlabels;