From 8d3c67d11b51cf6aef7f064fa3763ed1aeaf58ad Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 1 Oct 2010 22:02:57 -0400 Subject: all used templates except login forms are converted to jinja2 --- askbot/middleware/view_log.py | 4 +- askbot/models/__init__.py | 5 + askbot/models/answer.py | 7 +- askbot/models/base.py | 6 + askbot/models/question.py | 26 +- askbot/skins/default/media/style/style.css | 4 - askbot/skins/default/templates/base.jinja.html | 6 +- .../default/templates/base_content.jinja.html | 6 +- askbot/skins/default/templates/html.list | 41 ++- askbot/skins/default/templates/macros.html | 23 +- askbot/skins/default/templates/pagesize.html | 27 -- .../default/templates/post_contributor_info.html | 51 ---- askbot/skins/default/templates/question.html | 2 +- askbot/skins/default/templates/question_list.html | 2 +- askbot/skins/default/templates/question_retag.html | 44 ++- .../templates/question_summary_list_roll.html | 2 +- askbot/skins/default/templates/questions.html | 280 +++++++++---------- .../skins/default/templates/questions.jinja.html | 305 --------------------- askbot/skins/default/templates/questions_ajax.html | 2 +- askbot/skins/default/templates/reopen.html | 31 +-- askbot/skins/default/templates/revisions.html | 99 +++++++ .../skins/default/templates/revisions_answer.html | 83 ------ askbot/skins/default/templates/tags.html | 23 +- askbot/skins/default/templates/user_edit.html | 39 ++- askbot/skins/default/templates/user_favorites.html | 6 +- askbot/skins/default/templates/user_info.html | 48 ++-- askbot/skins/default/templates/user_moderate.html | 36 ++- askbot/skins/default/templates/user_recent.html | 17 +- .../skins/default/templates/user_reputation.html | 21 +- askbot/skins/default/templates/user_responses.html | 21 +- askbot/skins/default/templates/user_stats.html | 41 ++- askbot/skins/default/templates/user_votes.html | 27 +- askbot/skins/default/templates/users.html | 41 ++- .../skins/default/templates/users_questions.html | 65 +++-- askbot/templatetags/extra_filters_jinja.py | 21 ++ askbot/templatetags/extra_tags.py | 26 -- askbot/tests/email_alert_tests.py | 2 +- askbot/tests/page_load_tests.py | 34 +-- askbot/urls.py | 6 +- askbot/views/commands.py | 18 +- askbot/views/readers.py | 111 +++----- askbot/views/users.py | 262 +++++++++--------- askbot/views/writers.py | 7 +- 43 files changed, 732 insertions(+), 1196 deletions(-) delete mode 100644 askbot/skins/default/templates/pagesize.html delete mode 100644 askbot/skins/default/templates/post_contributor_info.html delete mode 100644 askbot/skins/default/templates/questions.jinja.html create mode 100644 askbot/skins/default/templates/revisions.html delete mode 100644 askbot/skins/default/templates/revisions_answer.html diff --git a/askbot/middleware/view_log.py b/askbot/middleware/view_log.py index d3e2d2f1..25e9f37f 100644 --- a/askbot/middleware/view_log.py +++ b/askbot/middleware/view_log.py @@ -4,13 +4,13 @@ from askbot.views.readers import questions as questions_view from askbot.views.commands import vote from django.views.static import serve from askbot.views.writers import delete_comment, question_comments, answer_comments -from askbot.views.readers import question_revisions, answer_revisions +from askbot.views.readers import revisions #todo: the list is getting bigger and bigger - maybe there is a better way to #trigger reset of sarch state? IGNORED_VIEWS = (serve, vote, delete_comment, question_comments, answer_comments, - question_revisions, answer_revisions) + revisions) class ViewLog(object): """must be modified only in this middlware diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 10a76018..9958c2ed 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -35,6 +35,9 @@ from askbot.startup_tests import run_startup_tests run_startup_tests() +def get_model(model_name): + return models.get_model('askbot', model_name) + User.add_to_class( 'status', models.CharField( @@ -1936,4 +1939,6 @@ __all__ = [ #'AuthKeyUserAssociation', 'User', + + 'get_model' ] diff --git a/askbot/models/answer.py b/askbot/models/answer.py index 9f48e720..f025a0b7 100644 --- a/askbot/models/answer.py +++ b/askbot/models/answer.py @@ -9,7 +9,8 @@ from askbot.models import content from askbot.models.question import Question from askbot import const from askbot.utils.slug import slugify - +from askbot.utils import markup +from askbot.utils.html import sanitize_html class AnswerManager(models.Manager): def create_new( @@ -206,6 +207,10 @@ class AnswerRevision(ContentRevision): def get_question_title(self): return self.answer.question.title + def as_html(self): + markdowner = markup.get_parser() + return sanitize_html(markdowner.convert(self.text)) + class Meta(ContentRevision.Meta): db_table = u'answer_revision' ordering = ('-revision',) diff --git a/askbot/models/base.py b/askbot/models/base.py index c54d344d..dcd94ab9 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -193,6 +193,12 @@ class ContentRevision(models.Model): abstract = True app_label = 'askbot' + def as_html(self): + """should return html representation of + the revision + """ + raise NotImplementedError() + class AnonymousContent(models.Model): """ diff --git a/askbot/models/question.py b/askbot/models/question.py index 82fa60d1..5f914bd5 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -17,6 +17,8 @@ from askbot.models import content from askbot import const from askbot.utils.lists import LazyList from askbot.utils.slug import slugify +from askbot.utils import markup +from askbot.utils.html import sanitize_html #todo: too bad keys are duplicated see const sort methods QUESTION_ORDER_BY_MAP = { @@ -47,6 +49,7 @@ class QuestionManager(models.Manager): #summary field is denormalized in .save() call ) if question.wiki: + #DATED COMMENT #todo: this is confusing - last_edited_at field #is used as an indicator whether question has been edited #in template askbot/skins/default/templates/post_contributor_info.html @@ -314,9 +317,6 @@ class Question(content.Content, DeletableContent): return LazyList(get_data) - def get_tag_names(self): - return self.tagnames.split(' ') - def get_similarity(self, other_question = None): """return number of tags in the other question that overlap with the current question (self) @@ -521,18 +521,18 @@ class Question(content.Content, DeletableContent): if initial_addition: tags = Tag.objects.get_or_create_multiple( - self.tagname_list(), + self.get_tag_names(), self.author ) self.tags.add(*tags) Tag.objects.update_use_counts(tags) - def tagname_list(self): + def get_tag_names(self): """Creates a list of Tag names from the ``tagnames`` attribute.""" - return [name for name in self.tagnames.split(u' ')] + return self.tagnames.split(u' ') def tagname_meta_generator(self): - return u','.join([unicode(tag) for tag in self.tagname_list()]) + return u','.join([unicode(tag) for tag in self.get_tag_names()]) def get_absolute_url(self): return '%s%s' % ( @@ -660,6 +660,9 @@ class FavoriteQuestion(models.Model): def __unicode__(self): return '[%s] favorited at %s' %(self.user, self.added_at) +QUESTION_REVISION_TEMPLATE = ('

%(title)s

\n' + '
%(html)s
\n' + '
%(tags)s
') class QuestionRevision(ContentRevision): """A revision of a Question.""" question = models.ForeignKey(Question, related_name='revisions') @@ -677,6 +680,15 @@ class QuestionRevision(ContentRevision): #print 'in QuestionRevision.get_absolute_url()' return reverse('question_revisions', args=[self.question.id]) + def as_html(self): + markdowner = markup.get_parser() + return QUESTION_REVISION_TEMPLATE % { + 'title': self.title, + 'html': sanitize_html(markdowner.convert(self.text)), + 'tags': ' '.join(['%s' % tag + for tag in self.tagnames.split(' ')]), + } + def save(self, **kwargs): """Looks up the next available revision number.""" if not self.revision: diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index cbdceba9..d1d6ca2c 100755 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -1630,10 +1630,6 @@ span.form-error { /*修订记录*/ -#revisions { - width: 950px; -} - .revision { margin: 10px 0 10px 0; width: 100%; diff --git a/askbot/skins/default/templates/base.jinja.html b/askbot/skins/default/templates/base.jinja.html index 3051f1f7..6cf23a26 100644 --- a/askbot/skins/default/templates/base.jinja.html +++ b/askbot/skins/default/templates/base.jinja.html @@ -6,15 +6,15 @@ {% load i18n %} - {% block title %}{% endblock %} - {{ settings.APP_TITLE }} + {% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }} {% spaceless %} {% block meta %}{% endblock %} {% block meta_description %} - + {% endblock %} {% endspaceless %} - + {% if settings.GOOGLE_SITEMAP_CODE %} {% endif %} diff --git a/askbot/skins/default/templates/base_content.jinja.html b/askbot/skins/default/templates/base_content.jinja.html index 492e9136..a2895c33 100644 --- a/askbot/skins/default/templates/base_content.jinja.html +++ b/askbot/skins/default/templates/base_content.jinja.html @@ -2,11 +2,11 @@ - {% block title %}{% endblock %} - {{ settings.APP_TITLE }} + {% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }} - + {% block meta_description %} - + {% endblock %} {% if settings.GOOGLE_SITEMAP_CODE %} diff --git a/askbot/skins/default/templates/html.list b/askbot/skins/default/templates/html.list index 477f2080..ddb3f444 100644 --- a/askbot/skins/default/templates/html.list +++ b/askbot/skins/default/templates/html.list @@ -1,37 +1,34 @@ ==todo== +question_retag.html - todo debug 404.html 500.html +paginator.html - still used in questions ajax + +==unused== +notarobot.html +user_recent.html +question_counter_widget.html +email_base.html question_list.html -question_retag.html questions_ajax.html question_summary_list_roll.html -reopen.html -revisions_answer.html -revisions_question.html -tags.html -user_edit.html -user_email_subscriptions.html user_favorites.html +users_questions.html user_footer.html -user_info.html -user_moderate.html -user_recent.html -user_reputation.html user_responses.html users.html -users_questions.html -user_stats.html -user_votes.html -pagesize.html -paginator.html -notarobot.html -post_contributor_info.html - -==unused== -question_counter_widget.html -email_base.html ==done== +user_info.html +user_reputation.html +user_moderate.html +user_votes.html +user_stats.html +user_email_subscriptions.html +user_edit.html +tags.html +revisions.html +reopen.html question_edit.html privacy.html tag_selector.jinja.html diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index 96c95fb1..f3ec824a 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -121,6 +121,8 @@ {%- macro post_contributor_info(post, contributor_type, is_wiki) -%}
+{# there is a whole bunch of trickery here, probably indicative of +poor design of the data or methods on data objects #} {% if contributor_type=="original_author" %} {% if is_wiki %}

{% trans %}community wiki{% endtrans %}

@@ -149,7 +151,16 @@ {{ user_score_and_badge_summary(post.author) }}

{% endif %} {% else %} - {% if post.last_edited_at %} + {% if post.__class__.__name__ in ('Question', 'Answer') %} + {% set last_edited_at = post.last_edited_at %} + {% set original_author = post.author %} + {% set update_author = post.last_edited_by %} + {% elif post.__class__.__name__ in ('QuestionRevision', 'AnswerRevision') %} + {% set last_edited_at = post.revised_at %} + {% set original_author = None %}{# fake value to force display widget in the revision views #} + {% set update_author = post.author %} + {% endif %} + {% if last_edited_at %}

{% trans %}updated{% endtrans %} {{ post.last_edited_at|diff_date }} + >{% trans %}updated{% endtrans %} {{ last_edited_at|diff_date }}

- {% if post.author != post.last_edited_by or is_wiki %} - {{ gravatar(post.last_edited_by, 32) }} -

{{post.last_edited_by.get_profile_link()}}
- {{ user_score_and_badge_summary(post.last_edited_by) }}

+ {% if original_author != display_author or is_wiki %} + {{ gravatar(update_author, 32) }} +

{{update_author.get_profile_link()}}
+ {{ user_score_and_badge_summary(update_author) }}

{% endif %} {% endif %} {% endif %} diff --git a/askbot/skins/default/templates/pagesize.html b/askbot/skins/default/templates/pagesize.html deleted file mode 100644 index 5fb28e20..00000000 --- a/askbot/skins/default/templates/pagesize.html +++ /dev/null @@ -1,27 +0,0 @@ - -{% spaceless %} -{% load i18n %} -{% if is_paginated %} -
- {% trans "posts per page" %} - {% ifequal page_size 10 %} - 10 - {% else %} - 10 - {% endifequal %} - - {% ifequal page_size 30 %} - 30 - {% else %} - 30 - {% endifequal %} - - {% ifequal page_size 50 %} - 50 - {% else %} - 50 - {% endifequal %} -
-{% endif %} -{% endspaceless %} - diff --git a/askbot/skins/default/templates/post_contributor_info.html b/askbot/skins/default/templates/post_contributor_info.html deleted file mode 100644 index 260a0590..00000000 --- a/askbot/skins/default/templates/post_contributor_info.html +++ /dev/null @@ -1,51 +0,0 @@ -{% load i18n %} -{% load smart_if %} -{% load extra_tags %} -
-{% ifequal contributor_type "original_author" %} - {% if wiki %} -

{% trans "community wiki" %}

-

- {% blocktrans count post.revisions.all|length as rev_count %}{{rev_count}} revision{% plural %}{{rev_count}} revisions{% endblocktrans %} -

-

{{post.author.get_profile_link}}

- {% else %} -

- {% ifequal post_type "question" %} - {% trans "asked" %} - {% else %} - {% ifequal post_type "answer" %} - {% trans "answered" %} - {% else %} - {% trans "posted" %} - {% endifequal %} - {% endifequal %} - {% ifequal post_type "revision" %} - {% diff_date post.revised_at %} - {% else %} - {% diff_date post.added_at %} - {% endifequal %} -

- {% gravatar post.author 32 %} -

{{post.author.get_profile_link}}
- {% get_score_badge post.author %}

- {% endif %} -{% else %} - {% if post.last_edited_at %} -

- {% ifequal post_type 'question' %} - - {% else %} - - {% endifequal %} - {% trans "updated" %} {% diff_date post.last_edited_at %} - -

- {% if post.author != post.last_edited_by or wiki %} - {% gravatar post.last_edited_by 32 %} -

{{post.last_edited_by.get_profile_link}}
- {% get_score_badge post.last_edited_by %}

- {% endif %} - {% endif %} -{% endifequal %} -
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index bdaade04..a79e687f 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -132,7 +132,7 @@
{#todo: here we have important case to reset search state #}
- {% for tag in question.tagname_list() %} + {% for tag in question.get_tag_names() %} diff --git a/askbot/skins/default/templates/question_list.html b/askbot/skins/default/templates/question_list.html index 3f5d701b..95e4834a 100644 --- a/askbot/skins/default/templates/question_list.html +++ b/askbot/skins/default/templates/question_list.html @@ -60,7 +60,7 @@ {% endif %}
- {% for tag in question.tagname_list %} + {% for tag in question.get_tag_names %} {% endfor %}
diff --git a/askbot/skins/default/templates/question_retag.html b/askbot/skins/default/templates/question_retag.html index 97f723fb..90eaef37 100644 --- a/askbot/skins/default/templates/question_retag.html +++ b/askbot/skins/default/templates/question_retag.html @@ -1,18 +1,16 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} -{% load extra_tags %} -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Change tags" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Change tags{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} - - - + + + - - + + {% endblock %} {% block content %} -{% get_current_language as LANGUAGE_CODE %} -{% cache 600 "scope_sort_tabs" search_tags request.user scope sort query context.page context.page_size LANGUAGE_CODE %} +{% cache 600 "scope_sort_tabs" search_tags request.user scope sort query context.page context.page_size language_code %}
- {% trans "In:" %} - {% trans "all" %} - {% trans "unanswered" %} - {% if request.user.is_authenticated %} - {% trans "favorite" %} + {% trans %}In:{% endtrans %} + {% trans %}all{% endtrans %} + {% trans %}unanswered{% endtrans %} + {% if request.user.is_authenticated() %} + {% trans %}favorite{% endtrans %} {% endif %}
- {% trans "Sort by:" %} + {% trans %}Sort by:{% endtrans %} {% if sort == "oldest" %} {% trans "oldest" %} + title="{% trans %}click to see the newest questions{% endtrans %}">{% trans %}oldest{% endtrans %} + {% elif sort == "latest" %} + {% trans %}newest{% endtrans %} {% else %} - {% if sort == "latest" %} - {% trans "newest" %} - {% else %} - {% trans "newest" %} - {% endif %} + {% trans %}newest{% endtrans %} {% endif %} {% if sort == "inactive" %} {% trans "inactive" %} + title="{% trans %}click to see the most recently updated questions{% endtrans %}">{% trans %}inactive{% endtrans %} + {% elif sort == "active" %} + {% trans %}active{% endtrans %} {% else %} - {% if sort == "active" %} - {% trans "active" %} - {% else %} - {% trans "active" %} - {% endif %} + {% trans %}active{% endtrans %} {% endif %} {% if sort == "coldest" %} {% trans "less answers" %} + title="{% trans %}click to see hottest questions{% endtrans %}">{% trans %}less answers{% endtrans %} + {% elif sort == "hottest" %} + {% trans %}more answers{% endtrans %} {% else %} - {% if sort == "hottest" %} - {% trans "more answers" %} - {% else %} - {% trans "more answers" %} - {% endif %} + {% trans %}more answers{% endtrans %} {% endif %} {% if sort == "leastvoted" %} {% trans "unpopular" %} + title="{% trans %}click to see most voted questions{% endtrans %}">{% trans %}unpopular{% endtrans %} + {% elif sort == "mostvoted" %} + {% trans %}popular{% endtrans %} {% else %} - {% if sort == "mostvoted" %} - {% trans "popular" %} - {% else %} - {% trans "popular" %} - {% endif %} + {% trans %}popular{% endtrans %} {% endif %}
@@ -122,62 +108,54 @@

({% trans {% trans "rss feed" %}) + alt="{% trans %}subscribe to the questions feed{% endtrans %}" + src="{{"/images/feed-icon-small.png"|media}}"/> {% trans %}rss feed{% endtrans %})

{% if author_name or search_tags or query %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %} + {% trans cnt=questions_count, q_num=questions_count|intcomma %} {{q_num}} question found - {% plural %} + {% pluralize %} {{q_num}} questions found - {% endblocktrans %} + {% endtrans %} {% else %} - {% blocktrans count questions_count as cnt with questions_count|intcomma as q_num %}{{q_num}} question{% plural %}{{q_num}} questions{% endblocktrans %} + {% trans cnt=questions_count, q_num=questions_count|intcomma %}{{q_num}} question{% pluralize %}{{q_num}} questions{% endtrans %} + {% endif %} + {% if author_name %} + {% trans %}with {{author_name}}'s contributions{% endtrans %} + {% endif %} + {% if search_tags %}{% if author_name %}, {% endif %} + {% trans %}tagged{% endtrans %} + "{{ search_tags|join('", "') }}" {% endif %} - {% joinitems using ', ' %} - {% if author_name %} - {% blocktrans %}with {{author_name}}'s contributions{% endblocktrans %} - {% endif %} - {% separator %} - {% if search_tags %} - {% trans "tagged" %} - "{{ search_tags|join:"\", \"" }}" - {% endif %} - {% endjoinitems %}

{% if author_name or search_tags or query %} -

{% trans "Search tips:" %} - {% ifmany query search_tags author_name %} - {% joinitems using ', ' ' or ' %} - {% if author_name %} - {% trans "reset author" %} - {% endif %} - {% separator %} - {% if search_tags %} - {% trans "reset tags" %} - {% endif %} - {% separator %} - {% ifmany query search_tags author_name %} - {% trans "start over" %} - {% endifmany %} - {% endjoinitems %} +

{% trans %}Search tips:{% endtrans %} + {% if reset_method_count > 1 %} + {% if author_name %} + {% trans %}reset author{% endtrans %} + {% endif %} + {% if search_tags %}{% if author_name and query %}, {% elif author_name %}{% trans %} or {% endtrans %}{% endif %} + {% trans %}reset tags{% endtrans %} + {% endif %} + {% if query %}{% trans %} or {% endtrans %} + {% trans %}start over{% endtrans %} + {% endif %} {% else %} - {% trans "start over" %} - {% endifmany %} - {% trans " - to expand, or dig in by adding more tags and revising the query." %} + {% trans %}start over{% endtrans %} + {% endif %} + {% trans %} - to expand, or dig in by adding more tags and revising the query.{% endtrans %}

{% else %} -

{% trans "Search tip:" %} {% trans "add tags and a query to focus your search" %}

+

{% trans %}Search tip:{% endtrans %} {% trans %}add tags and a query to focus your search{% endtrans %}

{% endif %}
{% endif %}
-{% get_current_language as LANGUAGE_CODE %} -{% cache 60 questions search_tags scope sort query context.page context.page_size LANGUAGE_CODE %} +{% cache 60 "questions" questions search_tags scope sort query context.page context.page_size language_code %} {% for question in questions.object_list %}
@@ -191,12 +169,9 @@ {% endif %} >{{question.score|humanize_counter}}
- {% blocktrans count question.score as cnt %}vote{% plural %}votes{% endblocktrans %} + {% trans cnt=question.score %}vote{% pluralize %}votes{% endtrans %}
- {% comment %} -
- {% endcomment %}
{{question.answer_count|humanize_counter}}
- {% blocktrans count question.answer_count as cnt %}answer{% plural %}answers{% endblocktrans %} + {% trans cnt=question.answer_count %}answer{% pluralize %}answers{% endtrans %}
@@ -223,108 +198,101 @@ {% endif %} >{{question.view_count|humanize_counter}}
- {% blocktrans count question.view_count as cnt %}view{% plural %}views{% endblocktrans %} + {% trans cnt=question.view_count %}view{% pluralize %}views{% endtrans %}
-

{{question.title}}

+

{{question.title|escape}}

- {% diff_date question.last_activity_at %} - {% if question.last_activity_by %} - {{ question.last_activity_by }} {% get_score_badge question.last_activity_by %} - {% endif %} + {{ question.last_activity_at|diff_date }} + {{question.last_activity_by.username}} + {{macros.user_score_and_badge_summary(question.last_activity_by)}}
- {% for tag in question.tagname_list %} - + {% for tag in question.get_tag_names() %} + {% endfor %}
{% endfor %} {% endcache %} - {% comment %}todo: fix css here{% endcomment %} + {# comment todo: fix css here #} {% if questions_count == 0 %} - {% comment %}todo: add tips to widen selection{% endcomment%} + {# todo: add tips to widen selection #}

{% if scope == "unanswered" %} - {% trans "There are no unanswered questions here" %} + {% trans %}There are no unanswered questions here{% endtrans %} {% endif %} {% if scope == "favorite" %} - {% trans "No favorite questions here. " %} - {% trans "Please start (bookmark) some questions when you visit them" %} + {% trans %}No favorite questions here. {% endtrans %} + {% trans %}Please start (bookmark) some questions when you visit them{% endtrans %} {% endif %}

{% if query or search_tags or author_name %}

- {% trans "You can expand your search by " %} - {% ifmany query search_tags author_name %} - {% joinitems using ', ' ' or ' %} - {% if author_name %} - {% trans "resetting author" %} - {% endif %} - {% separator %} - {% if search_tags %} - {% trans "resetting tags" %} - {% endif %} - {% separator %} - {% ifmany query search_tags author_name %} - {% trans "starting over" %} - {% endifmany %} - {% endjoinitems %} + {% trans %}You can expand your search by {% endtrans %} + {% if reset_method_count > 1 %} + {% if author_name %} + {% trans %}resetting author{% endtrans %} + {% endif %} + {% if search_tags %}{% if author_name and query %}, {% elif author_name %}{% trans %} or {% endtrans %}{% endif %} + {% trans %}resetting tags{% endtrans %} + {% endif %} + {% if query %}{% trans %} or {% endtrans %} + {% trans %}starting over{% endtrans %} + {% endif %} {% else %} - {% trans "starting over" %} - {% endifmany %} + {% trans %}starting over{% endtrans %} + {% endif %}

{% endif %}

- {% trans "Please always feel free to ask your question!" %} + {% trans %}Please always feel free to ask your question!{% endtrans %}

{% else %}

- {% trans "Did not find what you were looking for?" %} - {% trans "Please, post your question!" %} + {% trans %}Did not find what you were looking for?{% endtrans %} + {% trans %}Please, post your question!{% endtrans %}

{% endif %}
- + {% endblock %} {% block tail %} - {% if questions_count > 10 %}{%comment%}todo: remove magic number{%endcomment%} -
{% cnprog_paginator context %}
-
{% cnprog_pagesize context %}
+ {% if questions_count > 10 %}{# todo: remove magic number #} +
{{ macros.paginator(context|setup_paginator) }}
+
{{ macros.pagesize_switch(context) }}
{% endif %} {% endblock %} {% block sidebar %} {% if contributors %} - {% get_current_language as LANGUAGE_CODE %} - {% cache 600 contributors search_tags scope sort query context.page context.page_size LANGUAGE_CODE %} + {% cache 600 "contributors" contributors search_tags scope sort query context.page context.page_size language_code %}
-

{% trans "Contributors" %}

+

{% trans %}Contributors{% endtrans %}

{% spaceless %} {% for person in contributors %} - {% gravatar person 48 %} + {{ macros.gravatar(person,48) }} {% endfor %} {% endspaceless %}
{% endcache %} {% endif %} - {% if request.user.is_authenticated %} - {% include "tag_selector.html" %} + {% if request.user.is_authenticated() %} + {% include "tag_selector.jinja.html" %} {% endif %} {% if tags %} - {% get_current_language as LANGUAGE_CODE %} - {% cache 600 tags search_tags scope sort query context.page context.page_size LANGUAGE_CODE %} + {% cache 600 "tags" tags search_tags scope sort query context.page context.page_size language_code %}
-

{% trans "Related tags" %}

+

{% trans %}Related tags{% endtrans %}

- {% for tag in question.tagname_list %} + {% for tag in question.get_tag_names %} {% endfor %}
diff --git a/askbot/skins/default/templates/reopen.html b/askbot/skins/default/templates/reopen.html index 75bc026a..a2617150 100644 --- a/askbot/skins/default/templates/reopen.html +++ b/askbot/skins/default/templates/reopen.html @@ -1,9 +1,6 @@ -{% extends "base_content.html" %} +{% extends "base.jinja.html" %} -{% load extra_tags %} -{% load i18n %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "Reopen question" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Reopen question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} + + +{% endblock %} + +{% block content %} +
+ {% trans %}Revision history{% endtrans %} [{% trans %}back{% endtrans %}] +
+
+{% for revision in revisions %} +
+
+
+ + + + + + + +
+ {% trans %}click to hide/show revision{% endtrans %} + + {{ revision.revision }} + {% if revision.summary %} +
+ {{ revision.summary }} +
+ {% endif %} + {% if request.user|can_edit_post(post) %} + {% trans %}edit{% endtrans %} + {% endif %} +
+
+ {% if revision.revision == 1 %} + {% set contributor_type = "original_author" %} + {% else %} + {% set contributor_type = "last_updater" %} + {% endif %} + {{ macros.post_contributor_info( + revision, + contributor_type, + False) + }} +
+
+
+
+
+ {{ revision.diff }} +
+
+{% endfor %} +
+{% endblock %} + +{% block endjs %} +{% endblock %} + diff --git a/askbot/skins/default/templates/revisions_answer.html b/askbot/skins/default/templates/revisions_answer.html deleted file mode 100644 index 92eafe6a..00000000 --- a/askbot/skins/default/templates/revisions_answer.html +++ /dev/null @@ -1,83 +0,0 @@ -{% extends "base_content.html" %} - -{% load i18n %} -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %} -{% block forejs %} - - - -{% endblock %} - -{% block content %} -
- {% trans "Revision history" %} [{% trans "back" %}] -
-
-
- {% for revision in revisions %} -
-
-
- - - - - - - - -
{% trans - {{ revision.revision }} - {% if revision.summary %} -
{{ revision.summary }}
- {% endif %} - {% if request.user|can_edit_post:post %} - {% trans "edit" %} - {% endif %} - -
-
- {% post_contributor_info revision %} -
-
-
-
-
- {{ revision.diff|safe }} -
-
- {% endfor %} -
-
-{% endblock %} - -{% block endjs %} -{% endblock %} - diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html index 6627db32..91184aa0 100644 --- a/askbot/skins/default/templates/tags.html +++ b/askbot/skins/default/templates/tags.html @@ -1,9 +1,7 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} +{% import "macros.html" as macros %} -{% load i18n %} -{% load extra_tags %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "Tag list" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Tag list{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} - - + + {% endblock %} {% block usercontent %}
{% if view_user.id == user.id %} -

{% trans "Your karma change log." %}

+

{% trans %}Your karma change log.{% endtrans %}

{% else %} -

{% blocktrans with view_user.username as user_name %}{{user_name}}'s karma change log{% endblocktrans %}

+

{% trans user_name=view_user.username %}{{user_name}}'s karma change log{% endtrans %}

{% endif %}
{% for rep in reputation %}

{{ rep.positive }} {{ rep.negative }} - {{ rep.get_explanation_snippet|safe }} - ({% diff_date rep.reputed_at %}) + {{ rep.get_explanation_snippet() }} + ({{rep.reputed_at|diff_date}})

{% endfor %}
diff --git a/askbot/skins/default/templates/user_responses.html b/askbot/skins/default/templates/user_responses.html index 2d96112b..432a74c7 100644 --- a/askbot/skins/default/templates/user_responses.html +++ b/askbot/skins/default/templates/user_responses.html @@ -1,7 +1,8 @@ -{% extends "user.html" %} +{% extends "user.jinja.html" %} +{% import "macros.html" as macros %} -{% comment %} +{# This template accepts a list of response list they are a generalized form of any response and @@ -12,11 +13,7 @@ response_type - type of response response_url - link to the question response_title - title of the question response_snippet - abbreviated content of the response -{% endcomment %} - -{% load extra_tags %} -{% load humanize %} -{% load i18n %} +#} {% block usercontent %}
@@ -24,14 +21,14 @@ response_snippet - abbreviated content of the response diff --git a/askbot/skins/default/templates/user_stats.html b/askbot/skins/default/templates/user_stats.html index 23d8ddb8..67d9a4d2 100644 --- a/askbot/skins/default/templates/user_stats.html +++ b/askbot/skins/default/templates/user_stats.html @@ -1,19 +1,15 @@ -{% extends "user.html" %} +{% extends "user.jinja.html" %} -{% load i18n %} -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} {% block usercontent %} {% include "user_info.html" %} {% spaceless %} -

{% blocktrans count questions|length as counter %}{{counter}} Question{% plural %}{{counter}} Questions{% endblocktrans %}

+

{% trans counter=questions|length %}{{counter}} Question{% pluralize %}{{counter}} Questions{% endtrans %}

{% endspaceless %} {% include "users_questions.html" %} {% spaceless %} -

{% blocktrans count answered_questions|length as counter %}{{counter}} Answer{% plural %}{{counter}} Answers{% endblocktrans %}

+

{% trans counter=answered_questions|length %}{{counter}} Answer{% pluralize %}{{counter}} Answers{% endtrans %}

{% endspaceless %}
{% for answered_question in answered_questions %} @@ -21,7 +17,7 @@ + title="{% trans answer_score=answered_question.answer_score %}the answer has been voted for {{ answer_score }} times{% endtrans %} {% if answered_question.accepted %}{% trans %}this answer has been selected as correct{% endtrans %}{%endif%}"> {{ answered_question.answer_score }} @@ -31,7 +27,7 @@ {% endspaceless %} {% if answered_question.comment_count %} - {% blocktrans count answered_question.comment_count as comment_count %}({{comment_count}} comment){% plural %}the answer has been commented {{comment_count}} times{% endblocktrans %} + {% trans comment_count=answered_question.comment_count %}({{comment_count}} comment){% pluralize %}the answer has been commented {{comment_count}} times{% endtrans %} {% endif %}
@@ -41,19 +37,18 @@
{% spaceless %} -

{% blocktrans count total_votes as cnt %}{{cnt}} Vote{% plural %}{{cnt}} Votes {% endblocktrans %}

+

{% trans cnt=total_votes %}{{cnt}} Vote{% pluralize %}{{cnt}} Votes {% endtrans %}

{% endspaceless %}
@@ -61,18 +56,18 @@ {% spaceless %} -

{% blocktrans count user_tags|length as counter %}{{counter}} Tag{% plural %}{{counter}} Tags{% endblocktrans %}

+

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

{% endspaceless %}
- {% trans - {{up_votes}} - + {% trans %}thumb up{% endtrans %} + {{up_votes}} - {% trans - {{down_votes}} + {% trans %}thumb down{% endtrans %} + {{down_votes}}
- {% for tag in user_tags%} + {% for tag in user_tags %} × {{ tag.user_tag_usage_count|intcomma }}
- {% if forloop.counter|divisibleby:"10" %} + {% if loop.index is divisibleby 10 %}
{% endif %} @@ -83,15 +78,15 @@ {% spaceless %} -

{% blocktrans count total_awards as counter %}{{counter}} Badge{% plural %}{{counter}} Badges{% endblocktrans %}

+

{% trans counter=total_awards %}{{counter}} Badge{% pluralize %}{{counter}} Badges{% endtrans %}

{% endspaceless %}
- {% for award in awards %}{% comment %}todo: translate badge name properly{% endcomment %} -  {% trans award.name %} × {{ award.count|intcomma }}
- {% if forloop.counter|divisibleby:"6" %} + {% for award in awards %}{# todo: translate badge name properly #} +  {% trans name=award.name %}{{name}}{% endtrans %} × {{ award.count|intcomma }}
+ {% if loop.index is divisibleby 3 %}
{% endif %} diff --git a/askbot/skins/default/templates/user_votes.html b/askbot/skins/default/templates/user_votes.html index 5a8f9316..9b738cd9 100644 --- a/askbot/skins/default/templates/user_votes.html +++ b/askbot/skins/default/templates/user_votes.html @@ -1,30 +1,25 @@ -{% extends "user.html" %} +{% extends "user.jinja.html" %} -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} -{% load i18n %} - {% block usercontent %}
{% for vote in votes %}
-
{% diff_date vote.voted_at 3 %}
+
{{vote.voted_at|diff_date(3)}}
- {% ifequal vote.vote 1 %} - + {% if vote.vote==1 %} + {% else %} - - {% endifequal %} + + {% endif %}
- {% ifequal vote.answer_id 0 %} - {{ vote.title }} + {% if vote.answer_id==0 %} + {{ vote.title|escape }} {% else %} - {{ vote.title }} - {% endifequal %} + {{ vote.title|escape}} + {% endif %}
-
+
{% endfor %} diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html index f3ccd6e9..61ac7b57 100644 --- a/askbot/skins/default/templates/users.html +++ b/askbot/skins/default/templates/users.html @@ -1,12 +1,10 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} +{% import "macros.html" as macros %} -{% load extra_tags %} -{% load humanize %} -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Users" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Users{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %}