Merge branch 'featured_result'

This commit is contained in:
pw3t 2014-01-19 19:54:52 +01:00
commit d6b017efb5
5 changed files with 0 additions and 29 deletions

View File

@ -18,9 +18,3 @@ def response(resp):
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
'title': result['title']} for result in res[:int(number_of_results)]] 'title': result['title']} for result in res[:int(number_of_results)]]
if not len(res):
return results
for result in res[:int(number_of_results)]:
results.append({'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), 'title': result['title'], 'favicon':'wikipedia'})
return results

View File

@ -151,13 +151,6 @@ tr:hover td { background: #DDDDDD; }
#result_count { font-size: 0.8em; margin: 2px 0 2px 0; padding: 0 } #result_count { font-size: 0.8em; margin: 2px 0 2px 0; padding: 0 }
#fr { padding: 2px 6px;
display: inline-block;
background: #ECF0F1;
border-radius: 4px;
border: 1px solid #3498DB;;
width:55em;}
#suggestions { position: absolute; left: 54em; width: 12em; margin: 0 2px 5px 5px; padding: 0 2px 2px 2px; } #suggestions { position: absolute; left: 54em; width: 12em; margin: 0 2px 5px 5px; padding: 0 2px 2px 2px; }
#suggestions span { display: block; font-size: 0.8em; margin: 0 2px 10px 2px; padding: 0; } #suggestions span { display: block; font-size: 0.8em; margin: 0 2px 10px 2px; padding: 0; }
#suggestions form { display: block; } #suggestions form { display: block; }

View File

@ -1,10 +0,0 @@
<div id="fr">
{% for result in featured_results %}
{% if result['template'] %}
{% include 'result_templates/'+result['template'] %}
{% else %}
{% include 'result_templates/default.html' %}
{% endif %}
{% endfor %}
</div>

View File

@ -14,9 +14,6 @@
<div id ="result_count"> <div id ="result_count">
Number of results: {{ number_of_results }} Number of results: {{ number_of_results }}
</div> </div>
{% if featured_results %}
{% include 'result_templates/featured_results.html' %}
{% endif %}
{% for result in results %} {% for result in results %}
{% if result['template'] %} {% if result['template'] %}

View File

@ -138,9 +138,6 @@ def index():
for engine in result['engines']: for engine in result['engines']:
if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow', 'github']: if engine in ['wikipedia', 'youtube', 'vimeo', 'soundcloud', 'twitter', 'stackoverflow', 'github']:
result['favicon'] = engine result['favicon'] = engine
if engine in ['wikipedia', 'ddg definitions']:
featured_results.append(result)
results.remove(result)
if request_data.get('format') == 'json': if request_data.get('format') == 'json':
return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json') return Response(json.dumps({'query': query, 'results': results}), mimetype='application/json')