Commit fa271c26690b198b6293f0a2ed25373e939a2925

Authored by Lucas Moura
1 parent 802bb413

Add query highlight for user and email search

Signed-off-by: Lucas Moura <lucas.moura128@gmail.com>
Signed-off-by: Simião Carvalho <simiaosimis@gmail.com>
colab/accounts/templates/search/user_search_preview.html
... ... @@ -7,11 +7,19 @@
7 7 </a>
8 8 </div>
9 9 <div class="col-md-10">
10   - <strong><a href="{% url 'user_profile' username=result.username %}"><h4>{{ result.name }}</h4></a></strong>
  10 + <strong><a href="{% url 'user_profile' username=result.username %}">
  11 +
  12 + {% if query %}
  13 + <h4>{% highlight result.name with query %}</h4></a>
  14 + {% else %}
  15 + <h4>{{ result.name }}</h4></a>
  16 + {% endif %}
  17 +
  18 + </strong>
11 19 <small><strong>{% trans "Since" %}: {% date_format result.date_joined %}</strong></small><br>
12 20 <small>{% trans "Registered in" %}: <strong>{% trans "User" %}</strong></small><br>
13 21 </div>
14 22 </div>
15 23 <div class="row">
16 24 <hr>
17   -</div>
18 25 \ No newline at end of file
  26 +</div>
... ...
colab/super_archives/templates/search/thread_search_preview.html
... ... @@ -2,10 +2,30 @@
2 2  
3 3 <div class="row">
4 4 <div class="col-md-12">
5   - <small>{% datetime_format result.modified %} - <a href="{{result.modified_by_url}}">{{ result.modified_by }}</a></small><br>
6   - <h4><a href="{{result.url}}">{{ result.title }}</a></h4>
  5 + <small>{% datetime_format result.modified %} -
  6 +
  7 + {% if query %}
  8 + <a href="{{result.modified_by_url}}">{% highlight result.modified_by with query max_length "1000" %}</a>
  9 + {% else %}
  10 + <a href="{{result.modified_by_url}}">{{result.modified_by }}</a>
  11 + {% endif %}
  12 +
  13 + </small><br>
  14 +
  15 + {% if query %}
  16 + <h4><a href="{{result.url}}">{% highlight result.title with query max_length "1000"%}</a></h4>
  17 + {% else %}
  18 + <h4><a href="{{result.url}}">{{ result.title }}</a></h4>
  19 + {% endif %}
  20 +
7 21 {% with result.latest_description|truncatewords:"85" as description %}
8   - {{description | default_if_none:"a"}}<br>
  22 +
  23 + {% if query %}
  24 + {% highlight description with query max_length "1000" %}<br>
  25 + {% else %}
  26 + {{description | default_if_none:"a"}}<br>
  27 + {% endif %}
  28 +
9 29 {% endwith %}
10 30 <small>{% trans "Registred in" %}: <strong>{% trans "Discussion" %}</strong></small>
11 31 </div>
... ...