From 014551ac127b4f2d112dad9924b75ed10595a066 Mon Sep 17 00:00:00 2001
From: lada <179279+lada@users.noreply.github.com>
Date: Fri, 15 May 2020 11:51:29 +0200
Subject: [PATCH 1/4] Add possibility to filter translations by key
---
resources/views/index.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/resources/views/index.php b/resources/views/index.php
index 856f2b1f..f7b78fdf 100644
--- a/resources/views/index.php
+++ b/resources/views/index.php
@@ -50,12 +50,25 @@
}
});
+ var rowsById = {};
+ $('.table tbody tr').each(function() {
+ rowsById[$(this).attr('id')] = $(this);
+ });
+
+ $('#search-field').keyup(function() {
+ var searchKey = $(this).val().toUpperCase();
+ Object.keys(rowsById).forEach(function(key) {
+ rowsById[key].toggle(!searchKey || key.includes(searchKey));
+ });
+ });
+
$("a.delete-key").click(function(event){
event.preventDefault();
var row = $(this).closest('tr');
var url = $(this).attr('href');
var id = row.attr('id');
$.post( url, {id: id}, function(){
+ delete rowsById[id];
row.remove();
} );
});
@@ -227,7 +240,10 @@
- Total: = $numTranslations ?>, changed: = $numChanged ?>
+
+
Total: = $numTranslations ?>, changed: = $numChanged ?>
+
+
From cd941202890c34317a6a73f7c15a66127915cee2 Mon Sep 17 00:00:00 2001
From: lada <179279+lada@users.noreply.github.com>
Date: Fri, 15 May 2020 12:05:27 +0200
Subject: [PATCH 2/4] Make search case insensitive
---
resources/views/index.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/resources/views/index.php b/resources/views/index.php
index f7b78fdf..0cb24931 100644
--- a/resources/views/index.php
+++ b/resources/views/index.php
@@ -52,11 +52,12 @@
var rowsById = {};
$('.table tbody tr').each(function() {
- rowsById[$(this).attr('id')] = $(this);
+ var id = $(this).attr('id').toLowerCase();
+ rowsById[id] = $(this);
});
$('#search-field').keyup(function() {
- var searchKey = $(this).val().toUpperCase();
+ var searchKey = $(this).val().toLowerCase();
Object.keys(rowsById).forEach(function(key) {
rowsById[key].toggle(!searchKey || key.includes(searchKey));
});
From f82284fc80527805d76f3815aa1d2480ecc5d369 Mon Sep 17 00:00:00 2001
From: lada <179279+lada@users.noreply.github.com>
Date: Fri, 15 May 2020 12:32:49 +0200
Subject: [PATCH 3/4] Add some margin under the search field
---
resources/views/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/index.php b/resources/views/index.php
index 0cb24931..5271bb1d 100644
--- a/resources/views/index.php
+++ b/resources/views/index.php
@@ -243,7 +243,7 @@
From 9a5e1f7d5ab5135480dc2b8c17eff3fbe099a907 Mon Sep 17 00:00:00 2001
From: lada <179279+lada@users.noreply.github.com>
Date: Fri, 15 May 2020 12:49:31 +0200
Subject: [PATCH 4/4] Fix row index update after key removal
---
resources/views/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/resources/views/index.php b/resources/views/index.php
index 5271bb1d..c778a9f2 100644
--- a/resources/views/index.php
+++ b/resources/views/index.php
@@ -69,7 +69,7 @@
var url = $(this).attr('href');
var id = row.attr('id');
$.post( url, {id: id}, function(){
- delete rowsById[id];
+ delete rowsById[id.toLowerCase()];
row.remove();
} );
});