Skip to content

Commit 07664d2

Browse files
committed
- issue2550648 - keyword boolean search multiple issues
Fix issue where saving the keyword boolean search would remove the link to open the editor. Note that re-opening the editor starts with a blank operation. It does not inherit the existing expression.
1 parent a763a13 commit 07664d2

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Fixed:
103103
if the given property is unset for an element of the list. Crash
104104
fixed. New feature NoneFirst added to method to make unset values
105105
sort at start or end of sorted list. (John Rouillard)
106+
- issue2550648 - keyword boolean search. Issue has multiple problems.
107+
Fix issue where saving the keyword boolean search would remove the
108+
link to open the editor.
106109

107110
Features:
108111
- issue2550522 - Add 'filter' command to command-line

roundup/cgi/KeywordsExpr.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This module is free software, you may redistribute it
22
# and/or modify under the same terms as Python.
33

4-
WINDOW_CONTENT = r'''\
4+
WINDOW_CONTENT = r'''
55
<h3>Keyword Expression Editor:</h3>
66
<hr/>
77
<div id="content"></div>
@@ -220,16 +220,39 @@
220220
return out;
221221
}
222222
223-
function main_content() {
223+
function main_display() {
224+
var out = '';
225+
out += '<span id="display_%(prop)s">' + parse(current).infix() + '<\/span>';
226+
return out;
227+
}
228+
229+
function main_input() {
224230
var out = '';
225231
out += '<input type="hidden" name="%(prop)s" value="' + current + '"\/>';
226-
out += parse(current).infix();
227232
return out;
228233
}
229234
230235
function modify_main() {
231-
main = window.opener.document.getElementById("keywords_%(prop)s");
232-
main.innerHTML = main_content();
236+
/* if display form of expression exists, overwrite */
237+
display = window.opener.document.getElementById('display_%(prop)s');
238+
if ( display ) {
239+
display.outerHTML = main_display();
240+
}
241+
242+
/* overwrite select if present, otherwise overwrite the hidden input */
243+
input = window.opener.document.querySelector('select[name="%(prop)s"]');
244+
if (! input) {
245+
input = window.opener.document.querySelector('input[name="%(prop)s"]');
246+
}
247+
248+
/* if display exists, only update hidden input. If display doesn't
249+
exist, inject both hidden input and display. */
250+
if ( display ) {
251+
content = main_input();
252+
} else {
253+
content = main_input() + main_display();
254+
}
255+
input.outerHTML = content;
233256
}
234257
235258
function set_content() {

0 commit comments

Comments
 (0)