summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/conf/__init__.py8
-rw-r--r--askbot/const/__init__.py10
-rw-r--r--askbot/forms.py7
-rw-r--r--askbot/models/question.py10
-rw-r--r--askbot/skins/common/media/js/utils.js5
-rw-r--r--askbot/skins/default/media/style/style.less4
-rw-r--r--askbot/views/readers.py6
7 files changed, 38 insertions, 12 deletions
diff --git a/askbot/conf/__init__.py b/askbot/conf/__init__.py
index 8378fca3..7ccd19bd 100644
--- a/askbot/conf/__init__.py
+++ b/askbot/conf/__init__.py
@@ -37,3 +37,11 @@ def should_show_sort_by_relevance():
questions by search relevance
"""
return ('postgresql_psycopg2' in askbot.get_database_engine_name())
+
+def get_tag_display_filter_strategy_choices():
+ from askbot import const
+ from askbot.conf import settings as askbot_settings
+ if askbot_settings.SUBSCRIBED_TAG_SELECTOR_ENABLED:
+ return const.TAG_DISPLAY_FILTER_STRATEGY_CHOICES
+ else:
+ return const.TAG_DISPLAY_FILTER_STRATEGY_MINIMAL_CHOICES
diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py
index 2633055f..32ceeaad 100644
--- a/askbot/const/__init__.py
+++ b/askbot/const/__init__.py
@@ -301,11 +301,17 @@ POST_STATUS = {
INCLUDE_ALL = 0
EXCLUDE_IGNORED = 1
INCLUDE_INTERESTING = 2
-TAG_DISPLAY_FILTER_STRATEGY_CHOICES = (
+INCLUDE_SUBSCRIBED = 3
+TAG_DISPLAY_FILTER_STRATEGY_MINIMAL_CHOICES = (
(INCLUDE_ALL, _('show all tags')),
(EXCLUDE_IGNORED, _('exclude ignored tags')),
- (INCLUDE_INTERESTING, _('only interesting tags')),
+ (INCLUDE_INTERESTING, _('only interesting tags'))
)
+TAG_DISPLAY_FILTER_STRATEGY_CHOICES = \
+ TAG_DISPLAY_FILTER_STRATEGY_MINIMAL_CHOICES + \
+ ((INCLUDE_SUBSCRIBED, _('only subscribed tags')),)
+
+
TAG_EMAIL_FILTER_STRATEGY_CHOICES = (
(INCLUDE_ALL, _('email for all tags')),
(EXCLUDE_IGNORED, _('exclude ignored tags')),
diff --git a/askbot/forms.py b/askbot/forms.py
index ea3fd5cd..b3ee4463 100644
--- a/askbot/forms.py
+++ b/askbot/forms.py
@@ -12,6 +12,7 @@ from askbot.utils.forms import NextUrlField, UserNameField
from askbot.mail import extract_first_email_address
from recaptcha_works.fields import RecaptchaField
from askbot.conf import settings as askbot_settings
+from askbot.conf import get_tag_display_filter_strategy_choices
import logging
def cleanup_dict(dictionary, key, empty_value):
@@ -1091,11 +1092,15 @@ class EditUserForm(forms.Form):
class TagFilterSelectionForm(forms.ModelForm):
email_tag_filter_strategy = forms.ChoiceField(
- choices = const.TAG_DISPLAY_FILTER_STRATEGY_CHOICES,
initial = const.EXCLUDE_IGNORED,
label = _('Choose email tag filter'),
widget = forms.RadioSelect
)
+ def __init__(self, *args, **kwargs):
+ super(TagFilterSelectionForm, self).__init__(*args, **kwargs)
+ choices = get_tag_display_filter_strategy_choices()
+ self.fields['email_tag_filter_strategy'].choices = choices
+
class Meta:
model = User
fields = ('email_tag_filter_strategy',)
diff --git a/askbot/models/question.py b/askbot/models/question.py
index bc1c45f5..4e2b3d0d 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -299,11 +299,13 @@ class ThreadManager(BaseQuerySetManager):
user_selections__user = request_user,
user_selections__reason = 'bad'
)
+ subscribed_tags = Tag.objects.none()
if askbot_settings.SUBSCRIBED_TAG_SELECTOR_ENABLED:
- meta_data['subscribed_tag_names'] = Tag.objects.filter(
+ subscribed_tags = Tag.objects.filter(
user_selections__user = request_user,
user_selections__reason = 'subscribed'
- ).values_list('name', flat = True)
+ )
+ meta_data['subscribed_tag_names'] = [tag.name for tag in subscribed_tags]
meta_data['interesting_tag_names'] = [tag.name for tag in interesting_tags]
meta_data['ignored_tag_names'] = [tag.name for tag in ignored_tags]
@@ -326,6 +328,10 @@ class ThreadManager(BaseQuerySetManager):
extra_ignored_tags = Tag.objects.get_by_wildcards(ignored_wildcards)
qs = qs.exclude(tags__in = extra_ignored_tags)
+ if request_user.display_tag_filter_strategy == const.INCLUDE_SUBSCRIBED \
+ and subscribed_tags:
+ qs = qs.filter(tags__in = subscribed_tags)
+
if askbot_settings.USE_WILDCARD_TAGS:
meta_data['interesting_tag_names'].extend(request_user.interesting_tags.split())
meta_data['ignored_tag_names'].extend(request_user.ignored_tags.split())
diff --git a/askbot/skins/common/media/js/utils.js b/askbot/skins/common/media/js/utils.js
index ad4963fc..15bac827 100644
--- a/askbot/skins/common/media/js/utils.js
+++ b/askbot/skins/common/media/js/utils.js
@@ -309,6 +309,7 @@ var TippedInput = function(){
WrappedElement.call(this);
this._instruction = null;
this._attrs = {};
+ //this._is_one_shot = false;//if true on starting typing effect is gone
};
inherits(TippedInput, WrappedElement);
@@ -317,6 +318,10 @@ TippedInput.prototype.reset = function(){
$(this._element).addClass('blank');
};
+/*TippedInput.prototype.setIsOneShot = function(boolValue) {
+ this._is_one_shot = boolValue;
+};*/
+
TippedInput.prototype.setInstruction = function(text) {
this._instruction = text;
};
diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less
index e4c1d714..00bb4be5 100644
--- a/askbot/skins/default/media/style/style.less
+++ b/askbot/skins/default/media/style/style.less
@@ -2795,10 +2795,6 @@ table.ab-subscr-form {
width: 45em;
}
-table.ab-tag-filter-form {
- width: 45em;
-}
-
.submit-row {
line-height: 30px;
padding-top: 10px;
diff --git a/askbot/views/readers.py b/askbot/views/readers.py
index b37cacb2..f1e14cc3 100644
--- a/askbot/views/readers.py
+++ b/askbot/views/readers.py
@@ -30,6 +30,7 @@ import askbot
from askbot import exceptions
from askbot.utils.diff import textDiff as htmldiff
from askbot.forms import AnswerForm, ShowQuestionForm
+from askbot import conf
from askbot import models
from askbot import schedules
from askbot.models.tag import Tag
@@ -39,7 +40,6 @@ from askbot.utils.html import sanitize_html
from askbot.utils.decorators import anonymous_forbidden, ajax_only, get_only
from askbot.search.state_manager import SearchState, DummySearchState
from askbot.templatetags import extra_tags
-import askbot.conf
from askbot.conf import settings as askbot_settings
from askbot.skins.loaders import render_into_skin, get_template #jinja2 template loading enviroment
from askbot.views import context
@@ -212,14 +212,14 @@ def questions(request, **kwargs):
'questions_count' : paginator.count,
'reset_method_count': reset_method_count,
'scope': search_state.scope,
- 'show_sort_by_relevance': askbot.conf.should_show_sort_by_relevance(),
+ 'show_sort_by_relevance': conf.should_show_sort_by_relevance(),
'search_tags' : search_state.tags,
'sort': search_state.sort,
'tab_id' : search_state.sort,
'tags' : related_tags,
'tag_list_type' : tag_list_type,
'font_size' : extra_tags.get_tag_font_size(related_tags),
- 'display_tag_filter_strategy_choices': const.TAG_DISPLAY_FILTER_STRATEGY_CHOICES,
+ 'display_tag_filter_strategy_choices': conf.get_tag_display_filter_strategy_choices(),
'email_tag_filter_strategy_choices': const.TAG_EMAIL_FILTER_STRATEGY_CHOICES,
'update_avatar_data': schedules.should_update_avatar_data(request),
'query_string': search_state.query_string(),