luci-app-opkg: allow presetting filter via query attribute
authorJo-Philipp Wich <jo@mein.io>
Thu, 22 Nov 2018 07:57:09 +0000 (08:57 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 22 Nov 2018 11:58:34 +0000 (12:58 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js
applications/luci-app-opkg/luasrc/view/opkg.htm

index c2fe2d9fa9712e5f77fb065fd3d1c46adf0ca5d2..274a982929c3158d8e82d4881857dad6f1013c58 100644 (file)
@@ -793,7 +793,7 @@ window.requestAnimationFrame(function() {
        var filter = document.querySelector('input[name="filter"]'),
            keyTimeout = null;
 
-       filter.value = '';
+       filter.value = filter.getAttribute('value');
        filter.addEventListener('keyup',
                function(ev) {
                        if (keyTimeout !== null)
index 76b3f99ae77ffb3df097d889b7da09bc0e7946ae..0d2a4e2920f8f4bacc31653145697f9a7a870fd6 100644 (file)
@@ -93,7 +93,7 @@
 
        <div>
                <label><%:Filter%>:</label>
-               <input type="text" name="filter" placeholder="<%:Type to filter…%>" /><!--
+               <input type="text" name="filter" placeholder="<%:Type to filter…%>"<%=attr("value", luci.http.formvalue("query") or "")%> /><!--
                --><button class="btn cbi-button" onclick="handleReset(event)"><%:Clear%></button>
        </div>