Commit f8e88aa424c868790d8c1dfb4721b74a731f6bf3

Authored by Macartur Sousa
Committed by Matheus Fernandes
1 parent 24854caf
Exists in colab_search

Added dynamic include for search_preview templates

Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Signed-off-by: Lucas Moura <lucas.moura28@gmail.com>
Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
colab/accounts/templates/accounts/user_search_preview.html
1 1 {% load i18n tz highlight gravatar %}
2 2  
3   -<div > {% gravatar user.email 50 %} {{ user.name }}
4   -Data joined: {{ user.date_joined }}
5   -Registred in: <a href='#'>link</a><br>
  3 +<div >
  4 +{% gravatar result.email 50 %} {{ result.name }}
  5 +Data joined: {{ result.date_joined }}<br>
  6 +Registred in: <a href='#'>User</a><br>
6 7 </div>
7   -
... ...
colab/search/templates/message-preview.html 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +{% load i18n tz highlight search_preview_templates %}
  2 +
  3 +{% get_search_preview_templates result as template_target %}
  4 +{% include template_target %}
... ...
colab/search/templatetags/__init__.py 0 → 100644
colab/search/templatetags/search_preview_templates.py 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +from django import template
  2 +
  3 +
  4 +register = template.Library()
  5 +
  6 +@register.assignment_tag
  7 +def get_search_preview_templates(model_indexed):
  8 + app_type = model_indexed.type
  9 + app_name = ""
  10 +
  11 + if app_type in "user":
  12 + app_name = "accounts"
  13 + elif app_type in "thread":
  14 + app_name = "superarchives"
  15 + else:
  16 + app_name, app_type = app_type.split("_",1)
  17 +
  18 + return "{}/{}_search_preview.html".format(app_name, app_type)
... ...
colab/super_archives/templates/message-preview.html
... ... @@ -1,18 +0,0 @@
1   -{% load i18n tz highlight %}
2   -
3   -{% if result.type in "user" %}
4   - {% include "accounts/user_search_preview.html" with user=result %}
5   -{% endif %}
6   -
7   -{% if result.type in "thread" %}
8   - {% include "superarchives/thread_search_preview.html" with thread=result %}
9   -{% endif%}
10   -
11   -{% if result.type in "noosfero_community"%}
12   - {% include "noosfero/community_search_preview.html" with community=result %}
13   -{% endif%}
14   -
15   -{% if result.type in "noosfero_article"%}
16   - {% include "noosfero/article_search_preview.html" with article=result %}
17   -{% endif%}
18   -
colab/super_archives/templates/superarchives/thread_search_preview.html
1 1 {% load i18n tz highlight %}
2 2  
3 3 <div>
4   -<h3> {{ thread.title }}</h3>
5   -{{ thread.latest_description }}
  4 +<h3> {{ result.title }}</h3>
  5 +{{ result.latest_description|truncatewords:"85" }}
6 6 <br>
7   -{{ thread.modified_by }} - {{ thread.modified |date:"d \d\e F \d\e Y" }}
  7 +{{ result.modified_by }} - {{ result.modified |date:"d \d\e F \d\e Y" }}
8 8 <br>
9 9 </div>
... ...