Commit 88c2742c8b1c6d69d571231baab9b3c65b337619
1 parent
44cccc61
Exists in
master
and in
39 other branches
Changing default search template to work with different types
Showing
1 changed file
with
42 additions
and
22 deletions
Show diff stats
src/templates/search/search.html
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | {{ page.paginator.count }} {% trans "documents found" %} |
11 | 11 | </span> |
12 | 12 | </div> |
13 | + | |
13 | 14 | <hr/> |
14 | 15 | |
15 | 16 | <div class="row"> |
... | ... | @@ -45,14 +46,32 @@ |
45 | 46 | <div class="col-lg-10"> |
46 | 47 | <ul class="none indent list-unstyled"> |
47 | 48 | {% for result in page.object_list %} |
48 | - <br /> | |
49 | - {% if result.model_name == 'message' %} | |
50 | - {% include "search/search-message-preview.html" %} | |
51 | - {% elif result.model_name == 'user' %} | |
52 | - {% include "search/search-user-preview.html" %} | |
53 | - {% elif result.model_name == 'wiki' %} | |
54 | - {% include "search/search-wiki-preview.html" %} | |
55 | - {% endif %} | |
49 | + <li class="preview-message"> | |
50 | + {% if result.model_name == 'message' %} | |
51 | + {% include "search/search-message-preview.html" %} | |
52 | + {% elif result.model_name == 'user' %} | |
53 | + {% include "search/search-user-preview.html" %} | |
54 | + {% elif result.model_name == 'wiki' %} | |
55 | + {% include "search/search-wiki-preview.html" %} | |
56 | + {% elif result.model_name == 'revision' %} | |
57 | + {% include "search/search-revision-preview.html" %} | |
58 | + {% elif result.model_name == 'ticket' %} | |
59 | + {% include "search/search-ticket-preview.html" %} | |
60 | + {% endif %} | |
61 | + | |
62 | + {% if result.author %} | |
63 | + <div class="quiet"> | |
64 | + <span class="pull-left">{% trans "by" %} | |
65 | + {% if result.author and result.author_url %} | |
66 | + <a href="{{ result.author_url }}">{{ result.author }}</a> | |
67 | + {% else %} | |
68 | + <span>{{ result.author }}</span> | |
69 | + {% endif %} | |
70 | + </span> | |
71 | + <span class="pull-right">{{ result.modified|timesince }} {% trans "ago" %}</span> | |
72 | + </div> | |
73 | + {% endif %} | |
74 | + </li> | |
56 | 75 | {% empty %} |
57 | 76 | <li class="text-center"> |
58 | 77 | {% trans "No results for your search." %} |
... | ... | @@ -60,24 +79,25 @@ |
60 | 79 | {% endfor %} |
61 | 80 | </ul> |
62 | 81 | |
63 | - {% if docs.numFound %} | |
64 | - <div> | |
65 | - <span> | |
66 | - {% if docs.has_previous %} | |
67 | - <a href="{% append_to_get p=docs.previous_page_number %}">{% trans "Previous" %}</a> | |
68 | - {% endif %} | |
69 | - | |
82 | + {% if query and page.has_other_pages %} | |
83 | + <div class="text-center"> | |
70 | 84 | <span> |
71 | - {% trans "Page" %} {{ docs.page_num }} {% trans "of" %} {{ docs.num_of_pages }} | |
85 | + {% if page.has_previous %} | |
86 | + <a href="{% append_to_get page=page.previous_page_number %}">{% trans "Previous" %}</a> | |
87 | + {% endif %} | |
88 | + <span> | |
89 | + {% trans "Page" %} {{ page.number }} {% trans "of" %} | |
90 | + {{ page.paginator.num_pages }} | |
91 | + </span> | |
92 | + | |
93 | + {% if page.has_next %} | |
94 | + <a href="{% append_to_get page=page.next_page_number %}">{% trans "Next" %}</a> | |
95 | + {% endif %} | |
72 | 96 | </span> |
97 | + </div> | |
98 | + {% endif %} | |
73 | 99 | |
74 | - {% if docs.has_next %} | |
75 | - <a href="{% append_to_get p=docs.next_page_number %}">{% trans "Next" %}</a> | |
76 | - {% endif %} | |
77 | - </span> | |
78 | - </div> | |
79 | 100 | </div> |
80 | - {% endif %} | |
81 | 101 | </div> |
82 | 102 | |
83 | 103 | {% endblock %} | ... | ... |