From eb0366a6f3ce5ef42e49b57661ac3dedd2ee0346 Mon Sep 17 00:00:00 2001 From: Paul Backhouse Date: Fri, 4 May 2012 19:55:00 +0100 Subject: Now makes use of tag_selector.js, so wildcard tags can be expanded. --- .../default/templates/main_page/javascript.html | 2 +- .../default/templates/user_profile/user_stats.html | 57 ++++++++-------------- askbot/views/users.py | 18 ++++--- 3 files changed, 34 insertions(+), 43 deletions(-) diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index 6a90c758..f92a35c8 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -26,4 +26,4 @@ {% if request.user.is_authenticated() %} {% endif %} - + diff --git a/askbot/skins/default/templates/user_profile/user_stats.html b/askbot/skins/default/templates/user_profile/user_stats.html index 8b825e53..8c25c975 100644 --- a/askbot/skins/default/templates/user_profile/user_stats.html +++ b/askbot/skins/default/templates/user_profile/user_stats.html @@ -92,62 +92,46 @@ - {% if interesting_tags %} + {% if interesting_tag_names %} {% spaceless %} -

{% trans counter=interesting_tags|length %}{{counter}} Interesting Tag{% pluralize %}{{counter}} Interesting Tags{% endtrans %}

+

{% trans counter=interesting_tag_names|length %}{{counter}} Interesting Tag{% pluralize %}{{counter}} Interesting Tags{% endtrans %}

{% endspaceless %}
-
-
    - {% for tag in interesting_tags %} -
  • - {{ macros.tag_widget( - tag.name, - html_tag = 'div', - ) - }} -
  • - {# - {% if loop.index is divisibleby 10 %} -
- {% endif %} - #} - {% endfor %} - + {{ + macros.tag_list_widget( + interesting_tag_names, + deletable = False, + make_links = True, + css_class = 'interesting marked-tags' + ) + }}
{% endif %} - {% if ignored_tags %} + {% if ignored_tag_names %} {% spaceless %} -

{% trans counter=ignored_tags|length %}{{counter}} Ignored Tag{% pluralize %}{{counter}} Ignored Tags{% endtrans %}

+

{% trans counter=ignored_tag_names|length %}{{counter}} Ignored Tag{% pluralize %}{{counter}} Ignored Tags{% endtrans %}

{% endspaceless %}
- @@ -215,5 +199,6 @@ }); }); + {% endblock %} diff --git a/askbot/views/users.py b/askbot/views/users.py index dfef7b8e..bdee93cd 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -320,12 +320,18 @@ def user_stats(request, user, context): if user.show_tags: interesting_tags = models.Tag.objects.filter(user_selections__user=user, user_selections__reason='good') + interesting_tag_names = [tag.name for tag in interesting_tags] + if user.has_interesting_wildcard_tags(): + interesting_tag_names.extend(user.interesting_tags.split()) + ignored_tags = models.Tag.objects.filter(user_selections__user=user, user_selections__reason='bad') - interesting_tags = list(interesting_tags) - ignored_tags = list(ignored_tags) + ignored_tag_names = [tag.name for tag in ignored_tags] + if user.has_ignored_wildcard_tags(): + ignored_tag_names.extend(user.ignored_tags.split()) + else: - interesting_tags = None - ignored_tags = None + interesting_tag_names = None + ignored_tag_names = None # tags = models.Post.objects.filter(author=user).values('id', 'thread', 'thread__tags') # post_ids = set() @@ -403,8 +409,8 @@ def user_stats(request, user, context): 'votes_total_per_day': votes_total, 'user_tags' : user_tags, - 'interesting_tags': interesting_tags, - 'ignored_tags': ignored_tags, + 'interesting_tag_names': interesting_tag_names, + 'ignored_tag_names': ignored_tag_names, 'badges': badges, 'total_badges' : len(badges), -- cgit v1.2.3-1-g7c22
    - {% for tag in ignored_tags %} -
  • - {{ macros.tag_widget( - tag.name, - html_tag = 'div', - ) - }} -
  • - {# - {% if loop.index is divisibleby 10 %} -
- {% endif %} - #} - {% endfor %} + {{ + macros.tag_list_widget( + ignored_tag_names, + deletable = False, + make_links = True, + css_class = 'ignored marked-tags' + ) + }}