public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Max Magorsch" <arzano@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/
Date: Sun,  7 Jun 2020 20:39:57 +0000 (UTC)	[thread overview]
Message-ID: <1591562387.0c18044a46251aeefb66a8145f75d964ccbe691c.arzano@gentoo> (raw)

commit:     0c18044a46251aeefb66a8145f75d964ccbe691c
Author:     Max Magorsch <arzano <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  7 20:39:47 2020 +0000
Commit:     Max Magorsch <arzano <AT> gentoo <DOT> org>
CommitDate: Sun Jun  7 20:39:47 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=0c18044a

Add filters

Signed-off-by: Max Magorsch <arzano <AT> gentoo.org>

 html/stats.jinja2 | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 98d8474..482a2cf 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -8,6 +8,13 @@
     <link href="https://www.gentoo.org/assets/css/leaflet.css" rel="stylesheet" media="screen">
     <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/>
     <link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
+    <style>
+        .filter-button, .filter-button:hover {
+            color: #495057;
+            background-color: #fff;
+            border: 1px solid #ced4da;
+        }
+    </style>
   </head>
 
   <body>
@@ -345,6 +352,7 @@
         ],
         "initComplete": function( settings, json ) {
             setTimeout(function(){
+                $('#table_id_length').prepend("<button onclick='addFilters();' class='btn btn-outline-secondary filter-button btn-sm mr-4'>Toggle Filters</button>");
                 table.buttons().container().prependTo($('#table_id_length'));
                 $('#table_id_length').prepend("<span class='mr-1'> Show </span>");
                 document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4";
@@ -353,6 +361,29 @@
       });
     } );
 
+    function addFilters(){
+
+        if($("#filterRow").length) {
+            $("#filterRow").remove();
+        }else{
+            $('#table_id thead tr').clone(true).appendTo('#table_id thead');
+            $('#table_id thead tr:eq(1)').attr("id", "filterRow");
+            $('#table_id thead tr:eq(1) th').each(function (i) {
+                var title = $(this).text();
+                $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+                $('input', this).on('keyup change', function () {
+                    if (table.column(i).search() !== this.value) {
+                        table
+                            .column(i)
+                            .search(this.value)
+                            .draw();
+                    }
+                });
+            });
+        }
+    }
+
   </script>
 
   </body>


             reply	other threads:[~2020-06-07 20:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 20:39 Max Magorsch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-14 21:51 [gentoo-commits] proj/gentoo-mirrorstats:master commit in: html/ Robin H. Johnson
2024-09-14 21:49 Robin H. Johnson
2020-06-07 21:55 Max Magorsch
2020-06-07 20:17 Max Magorsch
2020-06-07 19:54 Max Magorsch
2020-06-07 19:54 Max Magorsch
2020-05-07 20:44 Max Magorsch
2020-05-07 20:25 Max Magorsch
2020-05-07 18:18 Robin H. Johnson
2020-05-07 18:18 Robin H. Johnson
2020-05-06 23:46 Max Magorsch
2020-05-03 23:08 Max Magorsch
2020-05-03 22:54 Max Magorsch
2020-05-03 22:54 Max Magorsch
2020-05-03 22:47 Max Magorsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1591562387.0c18044a46251aeefb66a8145f75d964ccbe691c.arzano@gentoo \
    --to=arzano@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox