Commit 6d49c8f0 authored by Daniel J. Ramirez's avatar Daniel J. Ramirez

Improved result templates.

parent 5389bc28
......@@ -657,13 +657,34 @@ nav #eelo_links > * {
margin-top: 8px;
margin-bottom: 6px;
}
.result .result-content p {
.result .result-content p,
.result .result-content pre {
margin-top: 8px;
margin-bottom: 8px;
}
.result.result-torrent .extra-info > :not(:last-child) {
margin-right: 16px;
}
.result.result-videos {
position: relative;
}
.result.result-videos .result-content {
display: flex;
margin: 0px;
}
.result.result-videos .result-content .result_header {
margin-top: 0;
}
.result.result-videos .result-content > .thumbnail {
flex: 1;
}
.result.result-videos .result-content > :not(.thumbnail) {
flex: 3;
padding-left: 16px;
}
.result.result-videos .result-content .thumbnail > img {
width: 100%;
}
.result .external-link {
font-size: 14px;
color: #39a441;
......@@ -671,8 +692,18 @@ nav #eelo_links > * {
.result .extra-info {
color: rgba(0, 0, 0, 0.4);
}
.result .code-block {
background-color: rgba(0, 0, 0, 0.03);
padding: 0 16px;
border-radius: 8px;
border: 1px solid rgba(0, 0, 0, 0.2);
}
.result .code-block pre {
white-space: pre-wrap;
}
.result.result-default,
.result.result-torrent {
.result.result-torrent,
.result.result-videos {
margin-bottom: 32px;
}
.result.result-images {
......@@ -751,6 +782,18 @@ nav #eelo_links > * {
width: 100%;
margin-top: 16px;
}
.infobox table tr {
vertical-align: baseline;
}
.infobox table tr td {
padding: 0;
padding-bottom: 8px;
}
.infobox table tr > .label {
text-align: right;
color: rgba(0, 0, 0, 0.4);
padding-right: 16px;
}
#image_result_mini_gallery_header {
display: flex;
align-items: center;
......@@ -845,3 +888,9 @@ nav #eelo_links > * {
margin-bottom: 8px;
}
}
.highlight .lineno,
.highlighttable .lineno {
margin-right: 16px;
color: rgba(0, 0, 0, 0.4);
display: none;
}
This diff is collapsed.
.highlight, .highlighttable {
.lineno {
margin-right: @spacing_large;
color: @text-muted-color;
display: none;
}
.kd {}
.kt {}
.nf {}
.o {}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
@corner-radius: 8px;
@dim-color-superlighter: rgba(0, 0, 0, 0.03);
@dim-color-lighter: rgba(0, 0, 0, 0.1);
@dim-color-light: rgba(0, 0, 0, 0.2);
@dim-color-normal: rgba(0, 0, 0, 0.4);
......
......@@ -7,4 +7,5 @@
@import "search.less";
@import "results.less";
@import "preferences.less";
\ No newline at end of file
@import "preferences.less";
@import "code.less";
\ No newline at end of file
......@@ -26,7 +26,7 @@
margin-top: @spacing_medium;
margin-bottom: @spacing_small;
p {
p, pre {
margin-top: @spacing_medium;
margin-bottom: @spacing_medium;
}
......@@ -35,6 +35,22 @@
&.result-torrent {
.extra-info > :not(:last-child) { margin-right: @spacing_large; }
}
&.result-videos {
position: relative;
.result-content {
display: flex;
margin: 0px;
.result_header { margin-top: 0; }
& > .thumbnail { flex: 1; }
& > :not(.thumbnail) {
flex: 3;
padding-left: @spacing_large;
}
.thumbnail > img { width: 100%; }
}
}
.external-link {
font-size: @fontsize_small;
......@@ -44,9 +60,21 @@
.extra-info {
color: @text-muted-color;
}
.code-block {
background-color: @dim-color-superlighter;
padding: 0 @spacing_large;
border-radius: @corner-radius;
border: 1px solid @dim-color-light;
pre {
white-space: pre-wrap;
}
}
}
.result.result-default, .result.result-torrent {
.result.result-default, .result.result-torrent, .result.result-videos {
margin-bottom: @spacing_xx-large;
}
.result.result-images {
......@@ -142,6 +170,24 @@
.footer {
}
table tr {
vertical-align: baseline;
td {
padding: 0;
padding-bottom: @spacing_medium;
}
& > .label {
text-align: right;
color: @text-muted-color;
padding-right: @spacing_large;
}
& > .value {
}
}
}
#image_result_mini_gallery_header {
......
{% extends "eelo/base.html" %}
{% block title %}{{ _('about') }} - {% endblock %}
{% block content %}
{% include '__common__/about.html' %}
<div class="container">
{% include '__common__/about.html' %}
</div>
{% endblock %}
......@@ -18,7 +18,7 @@
<span id="show_less_categories_" class="hidden">{{_("Less")}}</span>
<div id="more_categories">
{% for category in categories %}
{% if not (category in ["general", "images"] or category in selected_categories) %}
{% if not (category in ["general", "images", "map"] or category in selected_categories) %}
{{ category_widget(category) }}
{% endif %}
{% endfor %}
......
......@@ -21,14 +21,14 @@
</div>
{% if infobox.attributes %}
<table class="table table-striped infobox_part">
<table>
{% for attribute in infobox.attributes %}
<tr>
<td><bdi>{{ attribute.label }}</bdi></td>
<td class="label"><bdi>{{ attribute.label }}</bdi></td>
{% if attribute.image %}
<td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
<td class="value"><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
{% else %}
<td><bdi>{{ attribute.value }}</bdi></td>
<td class="value"><bdi>{{ attribute.value }}</bdi></td>
{% endif %}
</tr>
{% endfor %}
......
{% from 'eelo/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% call result_sub_header(result) %}
{% if result.repository %}<a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a>{% endif %}
{% endcall %}
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
<div class="result-content">
{% if result.content %}{{ result.content|safe }}{% endif %}
{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
<div dir="ltr">
{{ result.codelines|code_highlighter(result.code_language)|safe }}
<div dir="ltr" class="code-block">
{{ result.codelines|code_highlighter(result.code_language)|safe }}
</div>
</div>
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }}
{% endif %}
{{ result_footer(result) }}
\ No newline at end of file
{% from 'eelo/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% call result_sub_header(result) %}
{% endcall %}
{% if result.embedded %}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
{% endif %}
{% if result.embedded %}
<div id="result-media-{{ index }}" class="collapse">
{{ result.embedded|safe }}
</div>
{% endif %}
{% if result.img_src %}
<div class="container-fluid">
<div class="row">
<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif %}
</div>
<div class="result-content">
<span>
{% if result.content %}{{ result.content|safe }}{% endif %}
</span>
</div>
{% else %}
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
{% endif %}
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }}
{% endif %}
......@@ -38,8 +38,5 @@
<p>{% if result.content %}{{ result.content|safe }}{% endif %}</p>
</div>
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }}
{% endif %}
{% from 'eelo/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% if result.embedded %}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
{% endif %}
{% if result.embedded %}
<div id="result-video-{{ index }}" class="collapse">
{{ result.embedded|safe }}
</div>
{% endif %}
<div class="container-fluid">
<div class="row">
<a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" alt="{{ result.title|striptags }} {{ result.engine }}" /></a>
{% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
</div>
</div>
{% if rtl %}
{{ result_footer_rtl(result) }}
{% else %}
{{ result_footer(result) }}
{% endif %}
<div class="result-content">
<a class="thumbnail" href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>
<img src="{{ image_proxify(result.thumbnail) }}" alt="{{ result.title|striptags }} {{ result.engine }}" />
</a>
<span>
{{ result_header(result, favicons) }}
{% call result_sub_header(result) -%}
{{result.engine}}
{%- endcall %}
</span>
</div>
\ No newline at end of file
......@@ -40,9 +40,11 @@
{% else %}
{% macro put_results(results_slice) -%}
{% macro put_results(results_slice, no_image=False) -%}
{%- for result in results_slice %}
{% set template = result.template|replace('.html', '') if result['template'] else None %}
{% if no_image and template == "images" and not image_gallery %}
{% else %}
<div class="result {% if template %}result-{{ template }}{% else %} result-default {% endif %}">
{% if template in ["torrent"] %}
<small class="result-template">{{template}}</small>
......@@ -55,12 +57,13 @@
{% include 'eelo/result_templates/default.html' %}
{% endif %}
</div>
{% endif %}
{%- endfor %}
{%- endmacro %}
<div id="results" {% if image_gallery %} class="image-gallery" {% endif %}>
{{ put_results(results[:3]) }}
{{ put_results(results[:3], True) }}
{% if image_results %}
<div id="image_result_mini_gallery_header">
......@@ -72,7 +75,7 @@
</div>
{% endif %}
{{ put_results(results[4:]) }}
{{ put_results(results[4:], True) }}
</div>
......
{% extends "eelo/base.html" %}
{% block title %}{{ _('stats') }} - {% endblock %}
{% block content %}
<div class="container-fluid">
<div class="container">
<h1>{{ _('Engine stats') }}</h1>
<div class="row">
{% for stat_name,stat_category in stats %}
......
......@@ -480,7 +480,18 @@ def index():
# search
searchData = None
try:
# we dont want users to select multiple categories, this simplifies the experience.
if request.form.get("categories"):
request.form["categories"] = "general"
if request.form.get("category"):
for k, v in request.form.items():
if k.startswith("category_"):
request.form.pop(k, None)
request.form["category_images"] = u"off"
request.form["category_" + request.form['category']] = u"On"
searchData = search(request)
except Exception as e:
# log exception
logger.exception('search error')
......@@ -491,7 +502,7 @@ def index():
else:
return index_error(), 500
# serarch 5 images and 5 videos
# serrch 5 images and 5 videos
images = []
videos = []
if searchData.categories == ['general'] and searchData.pageno == 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment