Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Change the search parameter
Browse files Browse the repository at this point in the history
So that the Contracts Finder searches don't get mixed in with the main site
search.
  • Loading branch information
morty committed Dec 2, 2015
1 parent 04261cc commit c609dec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion contractfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def contract(notice_id):
@app.route('/search/', endpoint='search', methods=['GET', 'POST'])
def search():
errors = []
query = request.args.get('q', '')
query = request.args.get('query', '') or request.args.get('q', '')
page = request.args.get('page', 1, type=int)

sort_by = request.args.get('sort_by')
Expand Down
5 changes: 3 additions & 2 deletions templates/contracts.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ <h1>Search Results</h1>
<div class="four wide column">
<div id="search-menu" class="ui vertical menu">
<form method="GET" action="{{url_for('search')}}">
{% set querystring = request.args.get('query') or request.args.get('q') %}
<div class="item">
<div class="header">Keywords</div>
<div class="ui input">
<input type="text" name="q" value="{{request.args.q}}">
<input type="text" name="query" value="{{querystring}}">
</div>
</div>
<div class="item">
<div class="header">Sort By</div>
{% if request.args.get('q') %}
{% if querystring %}
{% set default_sort = 'relevance' %}
{% else %}
{% set default_sort = 'pub_date_desc' %}
Expand Down
17 changes: 9 additions & 8 deletions templates/front.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<form action="{{url_for('search')}}" id="search-form">
<div class="ui action left icon input">
<i class="search icon"></i>
{% if request.args.get('q') %}
<input name="q" type="text" value="{{request.args.get('q')}}">
{% set querystring = request.args.get('query') or request.args.get('q') %}
{% if querystring %}
<input name="query" type="text" value="{{querystring}}">
{% else %}
<input name="q" type="text" placeholder="Enter keywords here">
<input name="query" type="text" placeholder="Enter keywords here">
{% endif %}
<button class="ui green button">Search Contracts</button>
</div>
Expand All @@ -32,31 +33,31 @@ <h2>WELCOME TO THE CONTRACTS FINDER ARCHIVE</h2>
<h2>Suggested Searches</h2>

<div class="ui horizontal list massive">
<a class="item" href="{{url_for('search')}}?q=construction">
<a class="item" href="{{url_for('search')}}?query=construction">
<i class="black building outline icon"></i>
<div class="content">
Construction
</div>
</a>
<a class="item" href="{{url_for('search')}}?q=cleaning">
<a class="item" href="{{url_for('search')}}?query=cleaning">
<i class="black home icon"></i>
<div class="content">
Cleaning
</div>
</a>
<a class="item" href="{{url_for('search')}}?q=security">
<a class="item" href="{{url_for('search')}}?query=security">
<i class="black lock icon"></i>
<div class="content">
Security
</div>
</a>
<a class="item" href="{{url_for('search')}}?q=research">
<a class="item" href="{{url_for('search')}}?query=research">
<i class="black lab icon"></i>
<div class="content">
Research
</div>
</a>
<a class="item" href="{{url_for('search')}}?q=training">
<a class="item" href="{{url_for('search')}}?query=training">
<i class="black student icon"></i>
<div class="content">
Training
Expand Down

0 comments on commit c609dec

Please sign in to comment.