Skip to content

Commit 8e89796

Browse files
authored
Merge pull request #2004 from roland-ruedenauer/fix-search-template-issues
Pass variable 'subitem_target' instead of 'item_name' into search templates.
2 parents 861610e + 657258e commit 8e89796

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/moin/apps/frontend/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def search():
548548
history=history,
549549
whoosh_query=q,
550550
flaskg=flaskg,
551-
item_name=item_name,
551+
subitem_target=item_name,
552552
is_ticket=is_ticket,
553553
)
554554
else:
@@ -560,12 +560,12 @@ def search():
560560
history=history,
561561
whoosh_query=q,
562562
flaskg=flaskg,
563-
item_name=item_name,
563+
subitem_target=item_name,
564564
medium_search_form=search_form,
565565
)
566566
flaskg.clock.stop("search render")
567567
else:
568-
html = render_template("search.html", query=query, medium_search_form=search_form, item_name=item_name)
568+
html = render_template("search.html", query=query, medium_search_form=search_form, subitem_target=item_name)
569569
return html
570570

571571

src/moin/templates/blog/utils.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h1><a href="{{ url_for('frontend.show_item', item_name=entry_item.name) }}"
6161
{{ forms.render_errors(form) }}
6262
<br>
6363
<input type="checkbox" id="moin-blog-search-this"
64-
onclick="$('#moin-searchform').attr('action', this.checked ? '{{ url_for('frontend.search', item_name=blog_name) }}' : '{{ url_for('frontend.search') }}' );">
64+
onclick="$('#moin-searchform').attr('action', this.checked ? '{{ url_for('frontend.search', q='>'~blog_name) }}' : '{{ url_for('frontend.search') }}' );">
6565
{{ _("only this blog") }}
6666
{{ gen.form.close() }}
6767
{% endmacro %}

src/moin/templates/search.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
{%- block content %}
2121
<h1>{{ _("Search") }}</h1>
22-
{%- if item_name %}
23-
<h2>Search "{{ item_name }}" Subitems and Transclusions</h2>
22+
{%- if subitem_target %}
23+
<h2>Search "{{ subitem_target }}" Subitems and Transclusions</h2>
2424
{%- endif %}
25-
{{ gen.form.open(medium_search_form, id='moin-long-searchform', method='get', action=url_for('frontend.search', item_name=item_name)) }}
25+
{{ gen.form.open(medium_search_form, id='moin-long-searchform', method='get', action=url_for('frontend.search')) }}
2626
<p>
2727
{{ forms.render(medium_search_form['q']) }}
2828
</p>

src/moin/themes/basic/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{% set user_actions, item_navigation, item_actions = theme_supp.get_local_panel(fqname) %}
1515
{% set current_url = request.url %}
1616
{% set current_path = request.path %}
17-
{% set current_url_showview = url_for_item(endpoint='frontend.show_item', item_name=item_name) %}
17+
{% set current_url_showview = url_for_item(item_name) if item_name else '' %}
1818
{% set login_url = theme_supp.login_url() %}
1919

2020
{# Helper macro to generate the local panel #}

0 commit comments

Comments
 (0)