Browse Source

[fix] apply changes in infobox's styles

changes were made for wolframalpha infobox:

    - wrap text inside infobox.
      for example, there's a hill in New Zealand called
      Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu
      (don't blame me, blame the Kiwis)
      and now it doesn't break the infobox.

    - add an optional image field for infobox's attributes.
      (doesn't affect ddg infobox at all)

    - table is now always split in half.
      needed so that images stay inside infobox.
      (max-width doesn't work for inline elements, it's the table
      that has to set the width.

if you don't like how the table width looks now in ddg/wiki's infobox,
i can change that code so that the style only applies when using
wolframalpha.
a01200356 9 years ago
parent
commit
4267b11a45

+ 1
- 1
searx/static/themes/default/css/style.css
File diff suppressed because it is too large
View File


+ 3
- 2
searx/static/themes/default/less/style.less View File

476
 	   margin: 0px 2px 5px 5px;
476
 	   margin: 0px 2px 5px 5px;
477
 	   padding: 0px 2px 2px;
477
 	   padding: 0px 2px 2px;
478
 	   max-width: 21em;
478
 	   max-width: 21em;
479
+       word-wrap: break-word;
479
 
480
 
480
 	   .infobox {
481
 	   .infobox {
481
 	   	    margin: 10px 0 10px;
482
 	   	    margin: 10px 0 10px;
485
                     /* box-shadow: 0px 0px 5px #CCC; */
486
                     /* box-shadow: 0px 0px 5px #CCC; */
486
 
487
 
487
 	   	    img {
488
 	   	    img {
488
-		    	max-width: 20em;
489
+		    	max-width: 90%;
489
 			max-heigt: 12em;
490
 			max-heigt: 12em;
490
 			display: block;
491
 			display: block;
491
 			margin: 5px;
492
 			margin: 5px;
497
 		    }
498
 		    }
498
 
499
 
499
 		    table {
500
 		    table {
500
-		    	  width: auto;
501
+                  table-layout: fixed;
501
 
502
 
502
 			  td {
503
 			  td {
503
 		       	     vertical-align: top;
504
 		       	     vertical-align: top;

+ 1
- 1
searx/static/themes/oscar/css/oscar.min.css View File

17
 .result_download{margin-right:5px}
17
 .result_download{margin-right:5px}
18
 #pagination{margin-top:30px;padding-bottom:50px}
18
 #pagination{margin-top:30px;padding-bottom:50px}
19
 .label-default{color:#aaa;background:#fff}
19
 .label-default{color:#aaa;background:#fff}
20
-.infobox .infobox_part{margin-bottom:20px;word-wrap:break-word}
20
+.infobox .infobox_part{margin-bottom:20px;word-wrap:break-word;table-layout:fixed}
21
 .infobox .infobox_part:last-child{margin-bottom:0}
21
 .infobox .infobox_part:last-child{margin-bottom:0}
22
 .search_categories{margin:10px 0;text-transform:capitalize}
22
 .search_categories{margin:10px 0;text-transform:capitalize}
23
 .cursor-text{cursor:text !important}
23
 .cursor-text{cursor:text !important}

+ 2
- 1
searx/static/themes/oscar/less/oscar/infobox.less View File

1
 .infobox {
1
 .infobox {
2
     .infobox_part {
2
     .infobox_part {
3
         margin-bottom: 20px;
3
         margin-bottom: 20px;
4
-         word-wrap: break-word;
4
+        word-wrap: break-word;
5
+        table-layout: fixed;
5
     }
6
     }
6
     
7
     
7
     .infobox_part:last-child {
8
     .infobox_part:last-child {

+ 8
- 1
searx/templates/default/infobox.html View File

7
     <div class="attributes">
7
     <div class="attributes">
8
         <table>
8
         <table>
9
             {% for attribute in infobox.attributes %}
9
             {% for attribute in infobox.attributes %}
10
-            <tr><td>{{ attribute.label }}</td><td>{{ attribute.value }}</td></tr>
10
+            <tr>
11
+                <td>{{ attribute.label }}</td>
12
+                {% if attribute.image %}
13
+                <td><img src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
14
+                {% else %}
15
+                <td>{{ attribute.value }}</td>
16
+                {% endif %}
17
+            </tr>
11
             {% endfor %}
18
             {% endfor %}
12
         </table>
19
         </table>
13
     </div>
20
     </div>

+ 5
- 1
searx/templates/oscar/infobox.html View File

1
 <div class="panel panel-default infobox">
1
 <div class="panel panel-default infobox">
2
     <div class="panel-heading">
2
     <div class="panel-heading">
3
-        <h4 class="panel-title">{{ infobox.infobox }}</h4>
3
+        <h4 class="panel-title infobox_part">{{ infobox.infobox }}</h4>
4
     </div>
4
     </div>
5
     <div class="panel-body">
5
     <div class="panel-body">
6
         {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %}
6
         {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %}
11
             {% for attribute in infobox.attributes %}
11
             {% for attribute in infobox.attributes %}
12
             <tr>
12
             <tr>
13
                 <td>{{ attribute.label }}</td>
13
                 <td>{{ attribute.label }}</td>
14
+                {% if attribute.image %}
15
+                <td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
16
+                {% else %}
14
                 <td>{{ attribute.value }}</td>
17
                 <td>{{ attribute.value }}</td>
18
+                {% endif %}
15
             </tr>
19
             </tr>
16
             {% endfor %}
20
             {% endfor %}
17
         </table>
21
         </table>