Browse Source

oscar template: add infobox

Thomas Pointhuber 10 years ago
parent
commit
c36c935b03

+ 2 - 0
searx/static/oscar/css/oscar.min.css

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

+ 9 - 0
searx/static/oscar/less/oscar/infobox.less

@@ -0,0 +1,9 @@
+.infobox {
+    .infobox_part {
+        margin-bottom: 20px;
+    }
+    
+    .infobox_part:last-child {
+        margin-bottom: 0;
+    }
+}

+ 2 - 0
searx/static/oscar/less/oscar/oscar.less

@@ -4,6 +4,8 @@
 
 @import "results.less";
 
+@import "infobox.less";
+
 @import "search.less";
 
 @import "cursor.less";

+ 28 - 0
searx/templates/oscar/infobox.html

@@ -0,0 +1,28 @@
+<div class="panel panel-default infobox">
+    <div class="panel-heading">
+        <h4 class="panel-title">{{ infobox.infobox }}</h4>
+    </div>
+    <div class="panel-body">
+        {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ infobox.img_src }}" />{% endif %}
+        {% if infobox.content %}<p class="infobox_part">{{ infobox.content }}</p>{% endif %}
+
+        {% if infobox.attributes %}
+        <table class="table table-striped infobox_part">
+            {% for attribute in infobox.attributes %}
+            <tr>
+                <td>{{ attribute.label }}</td>
+                <td>{{ attribute.value }}</td>
+            </tr>
+            {% endfor %}
+        </table>
+        {% endif %}
+
+        {% if infobox.urls %}
+        <div class="infobox_part">
+            {% for url in infobox.urls %}
+            <p class="btn btn-default btn-xs"><a href="{{ url.url }}">{{ url.title }}</a></p>
+            {% endfor %}
+        </div>
+        {% endif %}
+    </div>
+</div>

+ 8 - 6
searx/templates/oscar/results.html

@@ -47,9 +47,7 @@
             {% if suggestions %}
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <h4 class="panel-title">
-                        <a data-toggle="collapse" data-parent="#accordion" href="#suggestions">{{ _('Suggestions') }}</a>
-                    </h4>
+                    <h4 class="panel-title">{{ _('Suggestions') }}</h4>
                 </div>
                 <div class="panel-body">
                     {% for suggestion in suggestions %}
@@ -64,9 +62,7 @@
 
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <h4 class="panel-title">
-                        <a data-toggle="collapse" data-parent="#accordion" href="#links">{{ _('Links') }}</a>
-                    </h4>
+                    <h4 class="panel-title">{{ _('Links') }}</h4>
                 </div>
                 <div class="panel-body">
                     <form role="form">
@@ -91,6 +87,12 @@
                 </div>
             </div>
         
+        {% if infoboxes %}
+            {% for infobox in infoboxes %}
+                {% include 'oscar/infobox.html' %}
+            {% endfor %}
+        {% endif %}    
+        
         </div><!-- /#sidebar_results -->
     </div>
 {% endblock %}