summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-01-25 09:43:32 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-01-25 09:43:32 -0600
commit0e80d522e2f07191df2013980422503e0585e8b4 (patch)
treede3d304e109340239945c17293961f2b0fddf847
parentdb9d539e0d333aa13c5b9381df51c874ada71d15 (diff)
parentfabf880b47cfbb1d97895303343361befdca9563 (diff)
downloadaskbot-0e80d522e2f07191df2013980422503e0585e8b4.tar.gz
askbot-0e80d522e2f07191df2013980422503e0585e8b4.tar.bz2
askbot-0e80d522e2f07191df2013980422503e0585e8b4.zip
Merge branch 'master' of github.com:ASKBOT/askbot-devel
-rw-r--r--askbot/auth.py2
-rw-r--r--askbot/media/style/style.less15
-rw-r--r--askbot/models/__init__.py3
-rw-r--r--askbot/models/post.py2
-rw-r--r--askbot/search/postgresql/__init__.py5
-rw-r--r--askbot/templates/macros.html41
-rw-r--r--askbot/templates/question_edit.html2
-rw-r--r--askbot/templates/user_inbox/responses_and_flags.html4
-rw-r--r--askbot/templates/widgets/ask_form.html2
-rw-r--r--askbot/templates/widgets/language_nav.html4
-rw-r--r--askbot/views/writers.py14
11 files changed, 57 insertions, 37 deletions
diff --git a/askbot/auth.py b/askbot/auth.py
index 846445b4..2d8f5d43 100644
--- a/askbot/auth.py
+++ b/askbot/auth.py
@@ -111,7 +111,7 @@ def onUnFlaggedItem(post, user, timestamp=None):
flagged_user = post.author
flagged_user.receive_reputation(
- - askbot_settings.REP_LOSS_FOR_RECEIVING_FLAG
+ askbot_settings.REP_LOSS_FOR_RECEIVING_FLAG
)
flagged_user.save()
diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less
index c2e20577..c86ed8b5 100644
--- a/askbot/media/style/style.less
+++ b/askbot/media/style/style.less
@@ -527,7 +527,7 @@ body.user-messages {
list-style: none;
overflow: auto;
padding: 0 0 10px 0;
- margin: 0 0 20px 0;
+ margin: 0;
position: relative;
li {
padding: 5px 10px;
@@ -1611,6 +1611,9 @@ ul#related-tags li {
width: 100%;
max-width: 395px;
}
+ .lang-selector {
+ margin: 1px 0 0 5px;
+ }
}
.ask-page,
@@ -1754,7 +1757,6 @@ ul#related-tags li {
.wmd-container {
border:#cce6ec 3px solid;
- min-height: 250px;
textarea {
border: none;
}
@@ -3780,6 +3782,10 @@ p.signup_p {
clear:both;
line-height:18px;
margin-bottom:15px;
+ h2 {
+ margin: 0;
+ padding: 0;
+ }
}
#responses div.face {
@@ -3791,7 +3797,7 @@ p.signup_p {
}
.response-parent {
- margin-top: 18px;
+ margin-top: 8px;
}
.response-parent strong{
@@ -3807,9 +3813,6 @@ p.signup_p {
#responses input {
float:left;
}
-#re_tools {
- margin-bottom:10px;
-}
#re_sections {
margin-bottom:6px;
}
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py
index 1193ffbd..e019826f 100644
--- a/askbot/models/__init__.py
+++ b/askbot/models/__init__.py
@@ -134,6 +134,9 @@ class RelatedObjectSimulator(object):
self.user = user
self.model_class = model_class
+ def all(self):
+ return self.model_class.objects.all()
+
def count(self, **kwargs):
kwargs['user'] = self.user
return self.model_class.objects.filter(**kwargs).count()
diff --git a/askbot/models/post.py b/askbot/models/post.py
index e5e96f3b..c5e19818 100644
--- a/askbot/models/post.py
+++ b/askbot/models/post.py
@@ -2176,7 +2176,7 @@ class PostRevision(models.Model):
if is_multilingual:
request_language = get_language()
- activate_language(self.thread.language_code)
+ activate_language(self.post.thread.language_code)
if self.post.is_question():
url = reverse('question_revisions', args = (self.post.id,))
diff --git a/askbot/search/postgresql/__init__.py b/askbot/search/postgresql/__init__.py
index 9720a7bb..4e359cc1 100644
--- a/askbot/search/postgresql/__init__.py
+++ b/askbot/search/postgresql/__init__.py
@@ -43,6 +43,9 @@ def run_full_text_search(query_set, query_text, text_search_vector_name):
text_search_vector_name + \
' @@ plainto_tsquery(%s)'
+ if getattr(django_settings, 'ASKBOT_MULTILINGUAL', True):
+ where_clause += " AND language_code='" + get_language() + "'"
+
search_query = '&'.join(query_text.split())#apply "AND" operator
extra_params = (search_query,)
extra_kwargs = {
@@ -51,8 +54,6 @@ def run_full_text_search(query_set, query_text, text_search_vector_name):
'params': extra_params,
'select_params': extra_params,
}
- if getattr(django_settings, 'ASKBOT_MULTILINGUAL', True):
- extra_kwargs['select']['language_code'] = get_language()
return query_set.extra(**extra_kwargs)
diff --git a/askbot/templates/macros.html b/askbot/templates/macros.html
index 02a97cc7..f94fc12d 100644
--- a/askbot/templates/macros.html
+++ b/askbot/templates/macros.html
@@ -12,20 +12,25 @@
<div class="face">
{{ gravatar(response.user, 48) }}
</div>
- <a style="font-size:12px" href="{{ response.user.get_absolute_url() }}">{{ response.user.username|escape }}</a>
- <a style="text-decoration:none;" href="{{ response.response_url }}">
- {{ response.response_type }}
- ({{ timeago(response.timestamp) }}):<br/>
- {% if inbox_section != 'flags' %}
- {{ response.response_snippet }}
- {% endif %}
- </a>
- {% if inbox_section == 'flags' %}
- <a class="re_expand" href="{{ response.response_url }}">
- <!--div class="re_snippet">{{ response.response_snippet|escape }}</div-->
- <div class="re_content">{{ response.response_content }}</div>
- </a>
- {% endif %}
+ <div class="content">
+ <a
+ style="font-size:12px"
+ href="{{ response.user.get_absolute_url() }}"
+ >{{ response.user.username|escape }}</a>
+ <a style="text-decoration:none;" href="{{ response.response_url }}">
+ {{ response.response_type }}
+ ({{ timeago(response.timestamp) }}):<br/>
+ {% if inbox_section != 'flags' %}
+ {{ response.response_snippet }}
+ {% endif %}
+ </a>
+ {% if inbox_section == 'flags' %}
+ <a class="re_expand" href="{{ response.response_url }}">
+ <!--div class="re_snippet">{{ response.response_snippet|escape }}</div-->
+ <div class="re_content">{{ response.response_content }}</div>
+ </a>
+ {% endif %}
+ </div>
</div>
{%- endmacro -%}
@@ -591,6 +596,14 @@ answer {% if answer.accepted() %}accepted-answer{% endif %} {% if answer.author_
{%- include "widgets/user_long_score_and_badge_summary.html" -%}
{%- endmacro -%}
+{%- macro country_flag(country_code, flag_label) -%}
+ <img
+ class="flag"
+ src="{{ ('/images/flags/' ~ country_code|lower ~ '.gif')|media }}"
+ alt="{{ flag_label }}"
+ />
+{%- endmacro -%}
+
{%- macro user_country_flag(user) -%}
{% if user.country and user.show_country %}
<img class="flag"
diff --git a/askbot/templates/question_edit.html b/askbot/templates/question_edit.html
index 653d351e..d8053e45 100644
--- a/askbot/templates/question_edit.html
+++ b/askbot/templates/question_edit.html
@@ -45,8 +45,10 @@
{{ macros.checkbox_in_div(form.post_privately) }}
{% endif %}
{% if settings.MULTILINGUAL %}
+ <div class="lang-selector">
<label for="id_language">{% trans %}Change language{% endtrans %}</label>
{{ form.language }}
+ </div>
{% endif %}
</div>
<input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" />&nbsp;
diff --git a/askbot/templates/user_inbox/responses_and_flags.html b/askbot/templates/user_inbox/responses_and_flags.html
index c889bb0a..16599c1d 100644
--- a/askbot/templates/user_inbox/responses_and_flags.html
+++ b/askbot/templates/user_inbox/responses_and_flags.html
@@ -28,9 +28,7 @@
<div id="responses">
{% for response in responses %}
<div class="response-parent" data-response-id="{{response.id}}">
- <p class="headline">
- <strong>"{{ response.response_title.strip()|escape}}"</strong>
- </p>
+ <h2>"{{ response.response_title.strip()|escape}}"</h2>
{{ macros.inbox_post_snippet(response, inbox_section) }}
{% for nested_response in response.nested_responses %}
{{ macros.inbox_post_snippet(nested_response, inbox_section) }}
diff --git a/askbot/templates/widgets/ask_form.html b/askbot/templates/widgets/ask_form.html
index 080931ec..1ecab359 100644
--- a/askbot/templates/widgets/ask_form.html
+++ b/askbot/templates/widgets/ask_form.html
@@ -47,8 +47,10 @@
{{ macros.checkbox_in_div(form.post_privately) }}
{% endif %}
{% if settings.MULTILINGUAL %}
+ <div class="lang-selector">
<label for="id_language">{% trans %}Select language{% endtrans %}</label>
{{ form.language }}
+ </div>
{% endif %}
</div>
{% if not request.user.is_authenticated() %}
diff --git a/askbot/templates/widgets/language_nav.html b/askbot/templates/widgets/language_nav.html
index 7db6d559..a8b4c8d9 100644
--- a/askbot/templates/widgets/language_nav.html
+++ b/askbot/templates/widgets/language_nav.html
@@ -1,8 +1,8 @@
<span class="lang-nav">
- <span>{{ settings.LANGUAGES_DICT[language_code] }}</span>
+ <span>{{ settings.LANGUAGES_DICT[current_language_code] }}</span>
<ul>
{% for lang in settings.LANGUAGES_DICT %}
- {% if lang != language_code %}
+ {% if lang != current_language_code %}
<li>
<a
href="/{{ lang }}/{{ settings.ASKBOT_URL }}"
diff --git a/askbot/views/writers.py b/askbot/views/writers.py
index 17f806df..f77ed58c 100644
--- a/askbot/views/writers.py
+++ b/askbot/views/writers.py
@@ -266,10 +266,7 @@ def ask(request):#view used to ask a new question
return HttpResponseRedirect(url_utils.get_login_url())
if request.method == 'GET':
- form = forms.AskForm(
- user=request.user,
- initial={'language': get_language()}
- )
+ form = forms.AskForm(user=request.user)
draft_title = ''
draft_text = ''
@@ -283,12 +280,13 @@ def ask(request):#view used to ask a new question
draft_tagnames = draft.tagnames
form.initial = {
- 'title': request.REQUEST.get('title', draft_title),
- 'text': request.REQUEST.get('text', draft_text),
+ 'ask_anonymously': request.REQUEST.get('ask_anonymousy', False),
'tags': request.REQUEST.get('tags', draft_tagnames),
+ 'text': request.REQUEST.get('text', draft_text),
+ 'title': request.REQUEST.get('title', draft_title),
+ 'post_privately': request.REQUEST.get('post_privately', False),
+ 'language': get_language(),
'wiki': request.REQUEST.get('wiki', False),
- 'ask_anonymously': request.REQUEST.get('ask_anonymousy', False),
- 'post_privately': request.REQUEST.get('post_privately', False)
}
if 'group_id' in request.REQUEST:
try: