Przeglądaj źródła

oscar template: add infobox

Thomas Pointhuber 10 lat temu
rodzic
commit
c36c935b03

+ 2
- 0
searx/static/oscar/css/oscar.min.css Wyświetl plik

@@ -11,5 +11,7 @@ input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none}
11 11
 .suggestion_item{margin:2px 5px}
12 12
 .result_download{margin-right:5px}
13 13
 #pagination{margin-top:30px;padding-bottom:50px}
14
+.infobox .infobox_part{margin-bottom:20px}
15
+.infobox .infobox_part:last-child{margin-bottom:0}
14 16
 .search_categories{margin:10px 0;text-transform:capitalize}
15 17
 .cursor-text{cursor:text !important}

+ 9
- 0
searx/static/oscar/less/oscar/infobox.less Wyświetl plik

@@ -0,0 +1,9 @@
1
+.infobox {
2
+    .infobox_part {
3
+        margin-bottom: 20px;
4
+    }
5
+    
6
+    .infobox_part:last-child {
7
+        margin-bottom: 0;
8
+    }
9
+}

+ 2
- 0
searx/static/oscar/less/oscar/oscar.less Wyświetl plik

@@ -4,6 +4,8 @@
4 4
 
5 5
 @import "results.less";
6 6
 
7
+@import "infobox.less";
8
+
7 9
 @import "search.less";
8 10
 
9 11
 @import "cursor.less";

+ 28
- 0
searx/templates/oscar/infobox.html Wyświetl plik

@@ -0,0 +1,28 @@
1
+<div class="panel panel-default infobox">
2
+    <div class="panel-heading">
3
+        <h4 class="panel-title">{{ infobox.infobox }}</h4>
4
+    </div>
5
+    <div class="panel-body">
6
+        {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" />{% endif %}
7
+        {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
8
+
9
+        {% if infobox.attributes %}
10
+        <table class="table table-striped infobox_part">
11
+            {% for attribute in infobox.attributes %}
12
+            <tr>
13
+                <td>{{ attribute.label }}</td>
14
+                <td>{{ attribute.value }}</td>
15
+            </tr>
16
+            {% endfor %}
17
+        </table>
18
+        {% endif %}
19
+
20
+        {% if infobox.urls %}
21
+        <div class="infobox_part">
22
+            {% for url in infobox.urls %}
23
+            <p class="btn btn-default btn-xs"><a href="{{ url.url }}">{{ url.title }}</a></p>
24
+            {% endfor %}
25
+        </div>
26
+        {% endif %}
27
+    </div>
28
+</div>

+ 8
- 6
searx/templates/oscar/results.html Wyświetl plik

@@ -47,9 +47,7 @@
47 47
             {% if suggestions %}
48 48
             <div class="panel panel-default">
49 49
                 <div class="panel-heading">
50
-                    <h4 class="panel-title">
51
-                        <a data-toggle="collapse" data-parent="#accordion" href="#suggestions">{{ _('Suggestions') }}</a>
52
-                    </h4>
50
+                    <h4 class="panel-title">{{ _('Suggestions') }}</h4>
53 51
                 </div>
54 52
                 <div class="panel-body">
55 53
                     {% for suggestion in suggestions %}
@@ -64,9 +62,7 @@
64 62
 
65 63
             <div class="panel panel-default">
66 64
                 <div class="panel-heading">
67
-                    <h4 class="panel-title">
68
-                        <a data-toggle="collapse" data-parent="#accordion" href="#links">{{ _('Links') }}</a>
69
-                    </h4>
65
+                    <h4 class="panel-title">{{ _('Links') }}</h4>
70 66
                 </div>
71 67
                 <div class="panel-body">
72 68
                     <form role="form">
@@ -91,6 +87,12 @@
91 87
                 </div>
92 88
             </div>
93 89
         
90
+        {% if infoboxes %}
91
+            {% for infobox in infoboxes %}
92
+                {% include 'oscar/infobox.html' %}
93
+            {% endfor %}
94
+        {% endif %}    
95
+        
94 96
         </div><!-- /#sidebar_results -->
95 97
     </div>
96 98
 {% endblock %}