Commit c402ab85c06f7824d77afe5442f323118c499375
1 parent
cc71f50a
Exists in
colab_search
Updated search presentation
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Carlos Oliveira <carlospecter@gmail.com>
Showing
5 changed files
with
39 additions
and
15 deletions
Show diff stats
colab/accounts/templates/accounts/user_search_preview.html
1 | -{% load i18n tz highlight gravatar %} | |
1 | +{% load i18n tz highlight gravatar date_format %} | |
2 | 2 | |
3 | -<div > | |
4 | -{% gravatar result.email 50 %} {{ result.name }} | |
5 | -Data joined: {{ result.date_joined }}<br> | |
6 | -Registred in: <a href='#'>User</a><br> | |
7 | -</div> | |
3 | +<div class="row"> | |
4 | + <div class="col-md-1"> | |
5 | + {% gravatar result.email 50 %} | |
6 | + </div> | |
7 | + <div class="col-md-11"> | |
8 | + <strong>{{ result.name }}</strong><br> | |
9 | + <strong>{% trans "Date joined" %}: {% date_format result.date_joined %}</strong><br> | |
10 | + {% trans "Registred in" %}: <strong>{% trans "User" %}</strong><br> | |
11 | + </div> | |
12 | +</div> | |
8 | 13 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,20 @@ |
1 | +from django import template | |
2 | +from django.utils.translation import ugettext as _ | |
3 | +register = template.Library() | |
4 | + | |
5 | + | |
6 | +@register.simple_tag(takes_context=True) | |
7 | +def date_format(context, date): | |
8 | + formatted_date = _('%(m)s %(d)s %(y)s' % {'m': date.strftime('%B'), | |
9 | + 'd': date.day, | |
10 | + 'y': date.year}) | |
11 | + return formatted_date | |
12 | + | |
13 | + | |
14 | +@register.simple_tag(takes_context=True) | |
15 | +def datetime_format(context, date): | |
16 | + formatted_date = date_format(context, date) | |
17 | + formatted_time = _('%(hour)s:%(min)s' % {'hour': date.hour, | |
18 | + 'min': date.strftime('%I')}) | |
19 | + formatted_datetime = _('%s at %s' % (formatted_date, formatted_time)) | |
20 | + return formatted_datetime | ... | ... |
colab/search/templates/message-preview.html
colab/search/templatetags/search_preview_templates.py
... | ... | @@ -3,6 +3,7 @@ from django import template |
3 | 3 | |
4 | 4 | register = template.Library() |
5 | 5 | |
6 | + | |
6 | 7 | @register.assignment_tag |
7 | 8 | def get_search_preview_templates(model_indexed): |
8 | 9 | app_type = model_indexed.type |
... | ... | @@ -13,6 +14,6 @@ def get_search_preview_templates(model_indexed): |
13 | 14 | elif app_type in "thread": |
14 | 15 | app_name = "superarchives" |
15 | 16 | else: |
16 | - app_name, app_type = app_type.split("_",1) | |
17 | + app_name, app_type = app_type.split("_", 1) | |
17 | 18 | |
18 | 19 | return "{}/{}_search_preview.html".format(app_name, app_type) | ... | ... |
colab/super_archives/templates/superarchives/thread_search_preview.html
1 | -{% load i18n tz highlight %} | |
1 | +{% load i18n tz highlight date_format %} | |
2 | 2 | |
3 | -<div> | |
4 | -<h3> {{ result.title }}</h3> | |
5 | -{{ result.latest_description|truncatewords:"85" }} | |
6 | -<br> | |
7 | -{{ result.modified_by }} - {{ result.modified |date:"d \d\e F \d\e Y" }} | |
8 | -<br> | |
3 | +<div class="row"> | |
4 | + {% datetime_format result.modified %} - <a href="{{result.modified_by_url}}">{{ result.modified_by }}</a><br> | |
5 | + <h4> {{ result.title }}</h4> | |
6 | + | |
7 | + {{ result.latest_description|truncatewords:"85" }} <br> | |
9 | 8 | </div> | ... | ... |