Bug 28675: (bug 27942 follow-up) Fix QOTD - add new quote

Bug 27942 has been written for master on top of bug 27251, and the code
differ a lot from what we have in <= 20.11.

This patch is quite ugly but it works, and is certainly the less painful
solution to fix stable branches.
Feel free to provide an alternative patch.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit 7f9fbeb579)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Jonathan Druart 2021-07-09 10:34:31 +02:00 committed by Victor Grousset/tuxayo
parent f7e574b98d
commit 5116982636
1 changed files with 11 additions and 2 deletions

View File

@ -74,6 +74,9 @@
<script>
var oTable; /* oTable needs to be global */
var sEmptyTable = _("No quotes available. Please use the 'Add quote' button to add a quote."); /* override the default message in datatables.inc */
var quoteSource = '<input id="quoteSource" type="text" style="height:14px; width:99%" onkeydown="fnClickAddQuote(event,this.parentNode.parentNode)"/>';
var quoteText = '<input id="quoteText" type="text" style="height:14px; width:99%" onkeydown="fnClickAddQuote(event,this.parentNode.parentNode)"/>';
$(document).ready(function() {
/* NOTE: This is an ajax-source datatable and *not* a server-side sourced datatable. */
/* See the datatable docs if you don't understand this difference. */
@ -89,12 +92,18 @@
{
"sWidth": "11%",
"render": function(data, type, row, meta){
if ( data == quoteSource ) {
return data;
}
return escape_str(data);
}
},
{
"sWidth": "75%",
"render": function(data, type, row, meta){
if ( data == quoteText ) {
return data;
}
return escape_str(data);
}
},
@ -200,8 +209,8 @@
var aRow = oTable.fnAddData(
[
'NA', // this is hackish to fool the datatable sort routine into placing this row at the end of the list...
'<input id="quoteSource" type="text" style="height:14px; width:99%" onkeydown="fnClickAddQuote(event,this.parentNode.parentNode)"/>',
'<input id="quoteText" type="text" style="height:14px; width:99%" onkeydown="fnClickAddQuote(event,this.parentNode.parentNode)"/>',
quoteSource,
quoteText,
'0000-00-00 00:00:00',
],
false