From 056d1c9f0f9dbbbab395a3df79824c9ec7f9afe2 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Tue, 26 Mar 2013 01:27:42 -0400 Subject: created default filler for the "followed" scope when it is the only enabled scope and added custom js placeholder for the question page --- askbot/doc/source/changelog.rst | 1 + askbot/media/style/style.less | 6 +++++- askbot/models/question.py | 18 +++++++++++++++--- askbot/templates/question.html | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index 59db9e05..f59138c5 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,7 @@ Changes in Askbot Development version ------------------- +* Added a placeholder template for the custom javascript on the question page * Allowed to disable the big "ask" button. * Some support for the media compression (Tyler Mandry) * Allowed to enable and disable question scopes on the main page diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less index 1f8f1b13..70808714 100644 --- a/askbot/media/style/style.less +++ b/askbot/media/style/style.less @@ -766,11 +766,15 @@ body.anon.ask-page .search-drop-menu { } .scopes-True-False-False, .scopes-False-True-False, -.scopes-False-False-True { +.scopes-False-False-True, +.scopes-False-False-False { #searchBar, .search-drop-menu { margin-left: 52px; } + #scopeNav { + width: 0; + } } /* ----- Content layout, check two_column_body.html or one_column_body.html ----- */ diff --git a/askbot/models/question.py b/askbot/models/question.py index 5526d3a8..455b0845 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -337,11 +337,23 @@ class ThreadManager(BaseQuerySetManager): raise Exception('UNANSWERED_QUESTION_MEANING setting is wrong') elif search_state.scope == 'followed': - favorite_filter = models.Q(favorited_by=request_user) + followed_filter = models.Q(favorited_by=request_user) if 'followit' in django_settings.INSTALLED_APPS: followed_users = request_user.get_followed_users() - favorite_filter |= models.Q(posts__post_type__in=('question', 'answer'), posts__author__in=followed_users) - qs = qs.filter(favorite_filter) + followed_filter |= models.Q(posts__post_type__in=('question', 'answer'), posts__author__in=followed_users) + + #a special case: "personalized" main page only == + #if followed is the only available scope + #if total number (regardless of users selections) + #followed questions is < than a pagefull - we should mix in a list of + #random questions + if askbot_settings.ALL_SCOPE_ENABLED == askbot_settings.UNANSWERED_SCOPE_ENABLED == False: + followed_question_count = qs.filter(followed_filter).distinct().count() + if followed_question_count < 30: + #here we mix in anything + followed_filter |= models.Q(deleted=False) + + qs = qs.filter(followed_filter) #user contributed questions & answers if search_state.author: diff --git a/askbot/templates/question.html b/askbot/templates/question.html index 482f5e72..74e101b2 100644 --- a/askbot/templates/question.html +++ b/askbot/templates/question.html @@ -319,6 +319,7 @@ {% if settings.TAG_SOURCE == 'category-tree' %} {% include "meta/category_tree_js.html" %} {% endif %} + {% include "question/custom_javascript.html" ignore missing %} {% endcompress %} {#