on master help sign in
Merge pull request #141 from Cqoicebordel/UX+Bugs+HTML

UX+bugs+html

commit44409cb61f5677981feac10c344ea07fe20f718f authorAdam Tauber <asciimoo@gmail.com> dateMon 8 Dec 2014, 23:48 (12 years ago) parent70981f825c743f
8 files changed+24−29
searx/templates/oscar/infobox.html+1−1 searx/templates/oscar/result_templates/default.html+3−3 searx/templates/oscar/result_templates/images.html+2−2 searx/templates/oscar/result_templates/map.html+2−2 searx/templates/oscar/result_templates/torrent.html+3−3 searx/templates/oscar/result_templates/videos.html+4−4 searx/templates/oscar/results.html+6−8 searx/webapp.py+3−6
searx/templates/oscar/infobox.html+1−1
@@ -3,7 +3,7 @@
33 <h4 class="panel-title">{{ infobox.infobox }}</h4>
44 </div>
55 <div class="panel-body">
6− {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" />{% endif %}
6+ {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" alt="{{ infobox.infobox }}" />{% endif %}
77 {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
88
99 {% if infobox.attributes %}
searx/templates/oscar/result_templates/default.html+3−3
@@ -1,9 +1,9 @@
11{% from 'oscar/macros.html' import icon %}
22
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
44
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
5+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
77
88{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
99
searx/templates/oscar/result_templates/images.html+2−2
@@ -1,5 +1,5 @@
11<a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
2− <img src="{{ result.img_src }}" alt="{{ result.title|e }}" class="img-thumbnail">
2+ <img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
33</a>
44
55<div class="modal fade" id="modal-{{ index }}" tabindex="-1" role="dialog" aria-hidden="true">
@@ -7,7 +7,7 @@
77 <div class="modal-content">
88 <div class="modal-header">
99 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
10− <h4 class="modal-title">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}{{ result.title|striptags }}</h4>
10+ <h4 class="modal-title">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}{{ result.title|striptags }}</h4>
1111 </div>
1212 <div class="modal-body">
1313 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
searx/templates/oscar/result_templates/map.html+2−2
@@ -1,8 +1,8 @@
11{% from 'oscar/macros.html' import icon %}
22
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
44
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
5+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
66
77<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
88
searx/templates/oscar/result_templates/torrent.html+3−3
@@ -1,9 +1,9 @@
11{% from 'oscar/macros.html' import icon %}
22
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
44
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
5+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
77
88<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
99<br/>
searx/templates/oscar/result_templates/videos.html+4−4
@@ -1,13 +1,13 @@
11{% from 'oscar/macros.html' import icon %}
22
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
44
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.publishedDate }}" pubdate>{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
5+{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6+<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
77
88<div class="container-fluid">
99 <div class="row">
10− <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" />
10+ <img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ result.thumbnail|safe }}" alt="{{ result.title|urlencode }} {{ result['favicon'] }}" />
1111 {% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
1212 </div>
1313</div>
searx/templates/oscar/results.html+6−8
@@ -51,6 +51,11 @@
5151 </div><!-- /#main_results -->
5252
5353 <div class="col-sm-4" id="sidebar_results">
54+ {% if infoboxes %}
55+ {% for infobox in infoboxes %}
56+ {% include 'oscar/infobox.html' %}
57+ {% endfor %}
58+ {% endif %}
5459
5560 {% if suggestions %}
5661 <div class="panel panel-default">
@@ -76,7 +81,7 @@
7681 <form role="form">
7782 <div class="form-group">
7883 <label for="search_url">{{ _('Search URL') }}</label>
79− <input type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}" readonly>
84+ <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly>
8085 </div>
8186 </form>
8287
@@ -94,13 +99,6 @@
9499 <div class="clearfix"></div>
95100 </div>
96101 </div>
97−
98− {% if infoboxes %}
99− {% for infobox in infoboxes %}
100− {% include 'oscar/infobox.html' %}
101− {% endfor %}
102− {% endif %}
103−
104102 </div><!-- /#sidebar_results -->
105103 </div>
106104{% endblock %}
searx/webapp.py+3−6
@@ -294,10 +294,9 @@ def index():
294294
295295 # TODO, check if timezone is calculated right
296296 if 'publishedDate' in result:
297− if result['publishedDate'].replace(tzinfo=None)\
298− >= datetime.now() - timedelta(days=1):
299− timedifference = datetime.now() - result['publishedDate']\
300− .replace(tzinfo=None)
297+ result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z')
298+ if result['publishedDate'].replace(tzinfo=None) >= datetime.now() - timedelta(days=1):
299+ timedifference = datetime.now() - result['publishedDate'].replace(tzinfo=None)
301300 minutes = int((timedifference.seconds / 60) % 60)
302301 hours = int(timedifference.seconds / 60 / 60)
303302 if hours == 0:
@@ -305,8 +304,6 @@ def index():
305304 else:
306305 result['publishedDate'] = gettext(u'{hours} hour(s), {minutes} minute(s) ago').format(hours=hours, minutes=minutes) # noqa
307306 else:
308− result['pubdate'] = result['publishedDate']\
309− .strftime('%a, %d %b %Y %H:%M:%S %z')
310307 result['publishedDate'] = format_date(result['publishedDate'])
311308
312309 if search.request_data.get('format') == 'json':