Commit 6d7208fdac32e91b38f446b3118cec6ed4a4961e

Authored by Matheus Fernandes
Committed by Luiz Oliveira
1 parent b7363d30

Fixed dashboard search preview

Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com>
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
colab/search/templates/dashboard-message-preview.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +{% load i18n tz highlight search_preview_templates %}
  2 +{% get_dashboard_search_preview_templates result as template_target %}
  3 +{% include template_target %}
... ...
colab/search/templatetags/search_preview_templates.py
... ... @@ -9,3 +9,10 @@ def get_search_preview_templates(model_indexed):
9 9 app_type = model_indexed.type
10 10  
11 11 return "search/{}_search_preview.html".format(app_type)
  12 +
  13 +
  14 +@register.assignment_tag
  15 +def get_dashboard_search_preview_templates(model_indexed):
  16 + app_type = model_indexed.type
  17 +
  18 + return "dashboard/{}_search_preview.html".format(app_type)
... ...
colab/super_archives/templates/dashboard/thread_search_preview.html 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +{% load i18n tz highlight %}
  2 +
  3 +<li class="preview-message">
  4 +<span class="glyphicon glyphicon-{{ result.icon_name }}" title="{{ result.type }}"></span>
  5 +
  6 +{% if result.tag %}
  7 +<a href="{% firstof result.mailinglist_url result.mailinglist.get_absolute_url result.url %}">
  8 + <span class="label label-primary">{{ result.tag }}</span>
  9 +</a>
  10 +{% endif %}
  11 +
  12 +{% if result.title %}
  13 + <a href="{{ result.url }}{% if result.type == 'thread' and result.latest_message_pk %}#msg-{{ result.latest_message_pk }}{% elif result.type == 'thread' and result.pk %}#msg-{{ result.pk }}{% endif %}" {% if result.latest_description %}title="{{ result.latest_description|escape|truncatechars:150 }}"{% elif result.description %}title="{{ result.description|escape|truncatechars:150 }}"{% endif %}>
  14 + <span class="subject">
  15 + <!-- a striptags filter was raising an error here because using with highlight -->
  16 + {% if query %}
  17 + {% highlight result.title with query max_length "1000" %}
  18 + {% else %}
  19 + {{ result.title }}
  20 + {% endif %}
  21 + </span>
  22 + </a>
  23 +{% endif %}
  24 +
  25 +{% if result.description %}
  26 + <!-- a striptags filter was raising an error here because using with highlight -->
  27 + <span class="quiet">- {% if query %}
  28 + {% highlight result.description with query max_length "150" %}
  29 + {% else %}
  30 + {% if result.latest_description %}
  31 + {{ result.latest_description|striptags|escape|truncatechars:150 }}
  32 + {% elif result.description %}
  33 + {{ result.description|striptags|escape|truncatechars:150 }}
  34 + {% endif %}
  35 + {% endif %}
  36 + </span>
  37 +{% endif %}
  38 +
  39 +{% if result.fullname or result.modified or result.modified_by %}
  40 + <div class="quiet">
  41 + {% if result.modified_by %}
  42 + <span class="pull-left">{% trans "by" %}
  43 + {% if result.modified_by_url %}
  44 + <a href="{{ result.modified_by_url }}">
  45 + {% else %}
  46 + <span>
  47 + {% endif %}
  48 +
  49 + {% if query %}
  50 + {% highlight result.modified_by with query %}
  51 + {% else %}
  52 + {{ result.modified_by }}
  53 + {% endif %}
  54 +
  55 + {% if result.modified_by_url %}
  56 + </a>
  57 + {% else %}
  58 + </span>
  59 + {% endif %}
  60 + </span>
  61 + {% else %}
  62 + <span class="pull-left">{% trans "by" %} {% trans "Anonymous" %}</span>
  63 + {% endif %}
  64 + {% if result.modified %}
  65 + <span class="pull-right">{{ result.modified|localtime|timesince }} {% trans "ago" %}</span>
  66 + {% endif %}
  67 + </div>
  68 +{% endif %}
  69 +</li>
0 70 \ No newline at end of file
... ...
colab/templates/home.html
... ... @@ -22,7 +22,7 @@
22 22 </a>
23 23 <ul class="message-list">
24 24 {% for result in latest_results %}
25   - {% include "message-preview.html" %}
  25 + {% include "dashboard-message-preview.html" %}
26 26 {% endfor %}
27 27 </ul>
28 28 <a class="column-align"
... ... @@ -53,7 +53,7 @@
53 53 </a>
54 54 <ul class="message-list">
55 55 {% for thread in hottest_threads %}
56   - {% include "message-preview.html" with result=thread %}
  56 + {% include "dashboard-message-preview.html" with result=thread %}
57 57 {% endfor %}
58 58 </ul>
59 59 <a href="{% url 'haystack_search' %}?type=thread">
... ... @@ -72,7 +72,7 @@
72 72 </a>
73 73 <ul class="message-list">
74 74 {% for thread in latest_threads %}
75   - {% include "message-preview.html" with result=thread.latest_message %}
  75 + {% include "dashboard-message-preview.html" with result=thread.latest_message %}
76 76 {% endfor %}
77 77 </ul>
78 78 <a href="{% url 'haystack_search' %}?type=thread&amp;order=latest">
... ...