diff options
author | Paul Backhouse <paulb@aptivate.org> | 2012-05-04 19:55:00 +0100 |
---|---|---|
committer | Paul Backhouse <paulb@aptivate.org> | 2012-05-04 19:55:00 +0100 |
commit | eb0366a6f3ce5ef42e49b57661ac3dedd2ee0346 (patch) | |
tree | 4ed383933c349e09af28f0ec0e8a4ef5f9a54e7d | |
parent | ef4879d0a2202b0839a1b5a8600262b062666edc (diff) | |
download | askbot-eb0366a6f3ce5ef42e49b57661ac3dedd2ee0346.tar.gz askbot-eb0366a6f3ce5ef42e49b57661ac3dedd2ee0346.tar.bz2 askbot-eb0366a6f3ce5ef42e49b57661ac3dedd2ee0346.zip |
Now makes use of tag_selector.js, so wildcard tags can be expanded.
-rw-r--r-- | askbot/skins/default/templates/main_page/javascript.html | 2 | ||||
-rw-r--r-- | askbot/skins/default/templates/user_profile/user_stats.html | 57 | ||||
-rw-r--r-- | 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() %} <script type='text/javascript' src='{{"/js/tag_selector.js"|media}}'></script> {% endif %} -<script type="text/javascript" src="{{"/js/live_search.js"|media}}"></script> +<script type="text/javascript" src='{{"/js/live_search.js"|media}}'></script> 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 @@ </tr> </table> </div> - {% if interesting_tags %} + {% if interesting_tag_names %} <a name="interesting tags"></a> {% spaceless %} - <h2>{% trans counter=interesting_tags|length %}<span class="count">{{counter}}</span> Interesting Tag{% pluralize %}<span class="count">{{counter}}</span> Interesting Tags{% endtrans %}</h2> + <h2>{% trans counter=interesting_tag_names|length %}<span class="count">{{counter}}</span> Interesting Tag{% pluralize %}<span class="count">{{counter}}</span> Interesting Tags{% endtrans %}</h2> {% endspaceless %} <div class="user-stats-table"> <table class="tags"> <tr> <td valign="top"> - <ul id="ab-interesting-tags" class="tags"> - {% for tag in interesting_tags %} - <li> - {{ macros.tag_widget( - tag.name, - html_tag = 'div', - ) - }} - </li> - {# - {% if loop.index is divisibleby 10 %} - </td> - <td width="180" valign="top"> - {% endif %} - #} - {% endfor %} - </ul> + {{ + macros.tag_list_widget( + interesting_tag_names, + deletable = False, + make_links = True, + css_class = 'interesting marked-tags' + ) + }} </td> </tr> </table> </div> {% endif %} - {% if ignored_tags %} + {% if ignored_tag_names %} <a name="ignored tags"></a> {% spaceless %} - <h2>{% trans counter=ignored_tags|length %}<span class="count">{{counter}}</span> Ignored Tag{% pluralize %}<span class="count">{{counter}}</span> Ignored Tags{% endtrans %}</h2> + <h2>{% trans counter=ignored_tag_names|length %}<span class="count">{{counter}}</span> Ignored Tag{% pluralize %}<span class="count">{{counter}}</span> Ignored Tags{% endtrans %}</h2> {% endspaceless %} <div class="user-stats-table"> <table class="tags"> <tr> <td valign="top"> <ul id="ab-ignored-tags" class="tags"> - {% for tag in ignored_tags %} - <li> - {{ macros.tag_widget( - tag.name, - html_tag = 'div', - ) - }} - </li> - {# - {% if loop.index is divisibleby 10 %} - </td> - <td width="180" valign="top"> - {% endif %} - #} - {% endfor %} + {{ + macros.tag_list_widget( + ignored_tag_names, + deletable = False, + make_links = True, + css_class = 'ignored marked-tags' + ) + }} </ul> </td> </tr> @@ -215,5 +199,6 @@ }); }); </script> + <script type='text/javascript' src='{{"/js/tag_selector.js"|media}}'></script> {% endblock %} <!-- end user_stats.html --> 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), |