diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-09-30 02:36:28 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-09-30 02:36:28 -0400 |
commit | e3d2a247c94cfc88e18aa1cbce3ec53e2e27da6e (patch) | |
tree | ab651ec84d9289d95181df89391ad57a47f1ca35 | |
parent | 4bf184e2a2deab74b47f807a04456935885983a7 (diff) | |
download | askbot-e3d2a247c94cfc88e18aa1cbce3ec53e2e27da6e.tar.gz askbot-e3d2a247c94cfc88e18aa1cbce3ec53e2e27da6e.tar.bz2 askbot-e3d2a247c94cfc88e18aa1cbce3ec53e2e27da6e.zip |
converted some more templates to jinja2
24 files changed, 459 insertions, 532 deletions
diff --git a/askbot/skins/default/templates/about.html b/askbot/skins/default/templates/about.html deleted file mode 100644 index d091725b..00000000 --- a/askbot/skins/default/templates/about.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} -<!-- template about.html --> -{% load i18n %} -{% load extra_tags %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "About" %}{% endspaceless %}{% endblock %} -{% block forejs %} -{% endblock %} -{% block content %} -<div class="headNormal"> -{% trans "About" %} -</div> - -<div class="content"> - {{settings.FORUM_ABOUT|safe}} -</div> -{% endblock %} -<!-- end template about.html --> diff --git a/askbot/skins/default/templates/about.jinja.html b/askbot/skins/default/templates/about.jinja.html new file mode 100644 index 00000000..5e638644 --- /dev/null +++ b/askbot/skins/default/templates/about.jinja.html @@ -0,0 +1,15 @@ +{% extends "base.jinja.html" %} +<!-- template about.html --> +{% block title %}{% spaceless %}{% trans %}About{% endtrans %}{% endspaceless %}{% endblock %} +{% block forejs %} +{% endblock %} +{% block content %} +<div class="headNormal"> +{% trans %}About{% endtrans %} +</div> + +<div class="content"> + {{settings.FORUM_ABOUT}} +</div> +{% endblock %} +<!-- end template about.html --> diff --git a/askbot/skins/default/templates/account_settings.html b/askbot/skins/default/templates/account_settings.html deleted file mode 100644 index 91267d26..00000000 --- a/askbot/skins/default/templates/account_settings.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "base_content.html" %} -<!-- settings.html --> -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Account functions" %}{% endspaceless %}{% endblock %} -{% block head %} -<style type="text/css" media="screen"> - h4 {font-size:12pt;} - dt, dd { padding:0 0 0.35em 0; } - dt { float: left; width: 21ex; } - dd { margin-left: 23ex; } - - #settings-options, #settings-intro { padding: 4em 1.5em;} - #settings-options { min-height: 300px; border-left: 1px solid #333;} - - #settings-options h5 { font-weight: bold;} -</style> -{% endblock %} - -{% block content %} -<div id="main-bar"> - <h3><strong>{{ request.user.username }} {% trans "Profile" %}</strong></h3> -</div> -<div id="settings-options"> - {% if msg %} - <p class="error">{{ msg }}</p> - {% endif %} - - <dl class="list-item"> - <dt>» <a href="{% url user_changepw %}">{% trans "Change password" %}</a></dt> - <dd>{% trans "Give your account a new password." %}</dd> - {% comment %} - <dt>» <a href="{% url user_changeemail %}">{% trans "Change email " %}</a></dt> - <dd>{% trans "Add or update the email address associated with your account." %}</dd> - - <dt>» <a href="{% url user_changeopenid %}">{% trans "Change OpenID" %}</a></dt> - <dd>{% trans "Change openid associated to your account" %}</dd> - - - <dt>» <a href="{% url user_delete %}">{% trans "Delete account" %}</a></dt> - <dd>{% trans "Erase your username and all your data from website" %}</dd> - {% endcomment %} - </dl> -</div> -{% endblock %} -<!-- end settings.html --> diff --git a/askbot/skins/default/templates/answer_edit.html b/askbot/skins/default/templates/answer_edit.html index 406591e6..03dd8add 100644 --- a/askbot/skins/default/templates/answer_edit.html +++ b/askbot/skins/default/templates/answer_edit.html @@ -1,13 +1,10 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} <!-- template answer_edit.html --> -{% load i18n %} -{% load extra_tags %} -{% load smart_if %} -{% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Edit answer{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} - <script type='text/javascript' src='{% media "/js/com.cnprog.editor.js" %}'></script> - <script type='text/javascript' src='{% media "/js/com.cnprog.post.js" %}'></script> - <script type='text/javascript' src='{% media "/js/jquery.validate.pack.js" %}'></script> + <script type='text/javascript' src='{{"/js/com.cnprog.editor.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/com.cnprog.post.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/jquery.validate.pack.js"|media}}'></script> <script type='text/javascript'> {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} var codeFriendlyMarkdown = true; @@ -15,9 +12,9 @@ var codeFriendlyMarkdown = false; {% endif %} </script> - <script type='text/javascript' src='{% media "/js/wmd/showdown.js" %}'></script> - <script type='text/javascript' src='{% media "/js/wmd/wmd.js" %}'></script> - <link rel="stylesheet" type="text/css" href="{% media "/js/wmd/wmd.css" %}" /> + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + <link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" /> <script type="text/javascript"> $().ready(function(){ @@ -30,10 +27,10 @@ //toggle preview of editor var display = true; - var txt = "{% trans "hide preview" %}"; + var txt = "{% trans %}hide preview{% endtrans %}"; $('#pre-collapse').text(txt); $('#pre-collapse').bind('click', function(){ - txt = display ? "{% trans "show preview" %}" : "{% trans "hide preview" %}"; + txt = display ? "{% trans %}show preview{% endtrans %}" : "{% trans %}hide preview{% endtrans %}"; display = !display; $('#previewer').toggle(); $('#pre-collapse').text(txt); @@ -53,32 +50,32 @@ {% block content %} <div id="main-bar" class="headNormal"> - {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>] + {% trans %}Edit answer{% endtrans %} [<a href="{{ answer.question.get_absolute_url() }}#{{ answer.id }}">{% trans %}back{% endtrans %}</a>] </div> <div id="main-body" class="ask-body"> <div id="askform"> <form id="fmedit" action="{% url edit_answer answer.id %}" method="post" > - <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/> - {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %} + <label for="id_revision" ><strong>{% trans %}revision{% endtrans %}:</strong></label> <br/> + {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul() }}{% endif %} <div style="vertical-align:middle"> - {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}"> + {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans %}select revision{% endtrans %}"> </div> <div class="form-item"> <div id="wmd-button-bar" class="wmd-panel"></div> {{ form.text }} <span class="form-error"></span> <div class="preview-toggle"><span id="pre-collapse" - title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span></div> + title="{% trans %}Toggle the real time Markdown editor preview{% endtrans %}">{% trans %}toggle preview{% endtrans %}</span></div> <div id="previewer" class="wmd-preview"></div> </div> - <strong>{{ form.summary.label_tag }}</strong> <br/> + <strong>{{ form.summary.label_tag() }}</strong> <br/> {{ form.summary }} {{ form.summary.errors }} <div class="title-desc"> {{ form.summary.help_text }} </div> - <input type="submit" value="{% trans "Save edit" %}" class="submit" /> - <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" /> + <input type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> + <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> </form> </div> </div> diff --git a/askbot/skins/default/templates/answer_edit_tips.html b/askbot/skins/default/templates/answer_edit_tips.html index b0b4ae43..5e9f689a 100644 --- a/askbot/skins/default/templates/answer_edit_tips.html +++ b/askbot/skins/default/templates/answer_edit_tips.html @@ -1,65 +1,63 @@ <!-- template answer_edit_tips.html --> -{% load i18n %} -{% load smart_if %} <div class="boxC"> - <p class="subtitle darkred">{% trans "answer tips" %}</p> + <h3>{% trans %}answer tips{% endtrans %}</h3> <div> <ul class="list-item"> - <li> <b>{% trans "please make your answer relevant to this community" %}</b> + <li> <b>{% trans %}please make your answer relevant to this community{% endtrans %}</b> </li> <li> - {% trans "try to give an answer, rather than engage into a discussion" %} + {% trans %}try to give an answer, rather than engage into a discussion{% endtrans %} </li> <li> - {% trans "please try to provide details" %} + {% trans %}please try to provide details{% endtrans %} </li> <li> - {% trans "be clear and concise" %} + {% trans %}be clear and concise{% endtrans %} </li> </ul> <p class='info-box-follow-up-links'> - <a href="{% url faq %}" target="_blank" title="{% trans "see frequently asked questions" %}">faq »</a> + <a href="{% url faq %}" target="_blank" title="{% trans %}see frequently asked questions{% endtrans %}">faq »</a> </p> </div> </div> <div class="boxC"> - <p class="subtitle">{% trans "Markdown tips" %}</p> + <h3>{% trans %}Markdown tips{% endtrans %}</h3> <ul class="list-item"> {% if settings.MARKUP_CODE_FRIENDLY or settings.ENABLE_MATHJAX %} <li> - {% trans "*italic*" %} + {% trans %}*italic*{% endtrans %} </li> <li> - {% trans "**bold**" %} + {% trans %}**bold**{% endtrans %} </li> {% else %} <li> - {% trans "*italic* or _italic_" %} + {% trans %}*italic* or _italic_{% endtrans %} </li> <li> - {% trans "**bold** or __bold__" %} + {% trans %}**bold** or __bold__{% endtrans %} </li> {% endif %} <li> - <b>{% trans "link" %}</b>:[{% trans "text" %}](http://url.com/ "{% trans "title" %}") + <b>{% trans %}link{% endtrans %}</b>:[{% trans %}text{% endtrans %}](http://url.com/ "{% trans %}title{% endtrans %}") </li> <li> - <b>{% trans "image" %}</b>:![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}") + <b>{% trans %}image{% endtrans %}</b>:![alt {% trans %}text{% endtrans %}](/path/img.jpg "{% trans %}title{% endtrans %}") </li> <li> - {% trans "numbered list:" %} + {% trans %}numbered list:{% endtrans %} 1. Foo 2. Bar </li> <li> - {% trans "basic HTML tags are also supported" %} + {% trans %}basic HTML tags are also supported{% endtrans %} </li> </ul> <p class='info-box-follow-up-links'> - <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} »</a> + <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans %}learn more about Markdown{% endtrans %} »</a> </p> </div> <!-- end template answer_edit_tips.html --> diff --git a/askbot/skins/default/templates/ask.html b/askbot/skins/default/templates/ask.html index 7c314aa5..64f51d54 100644 --- a/askbot/skins/default/templates/ask.html +++ b/askbot/skins/default/templates/ask.html @@ -1,13 +1,10 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} <!-- template ask.html --> -{% load i18n %} -{% load extra_tags %} -{% load smart_if %} -{% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Ask a question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} - <script type='text/javascript' src='{% media "/js/com.cnprog.editor.js" %}'></script> - <script type='text/javascript' src='{% media "/js/com.cnprog.post.js" %}'></script> - <script type='text/javascript' src='{% media "/js/jquery.validate.pack.js" %}'></script> + <script type='text/javascript' src='{{"/js/com.cnprog.editor.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/com.cnprog.post.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/jquery.validate.pack.js"|media}}'></script> <script type='text/javascript'> {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} var codeFriendlyMarkdown = true; @@ -15,9 +12,9 @@ var codeFriendlyMarkdown = false; {% endif %} </script> - <script type='text/javascript' src='{% media "/js/wmd/showdown.js" %}'></script> - <script type='text/javascript' src='{% media "/js/wmd/wmd.js" %}'></script> - <link rel="stylesheet" type="text/css" href="{% media "/js/wmd/wmd.css" %}" /> + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> + <link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" /> <script type="text/javascript"> $().ready(function(){ //set current module button style @@ -31,10 +28,10 @@ //toggle preview of editor //todo remove copy-paste var display = true; - var txt = "[{% trans "hide preview" %}]"; + var txt = "[{% trans %}hide preview{% endtrans %}]"; $('#pre-collapse').text(txt); $('#pre-collapse').bind('click', function(){ - txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]"; + txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]"; display = !display; $('#previewer').toggle(); $('#pre-collapse').text(txt); @@ -63,78 +60,7 @@ }); </script> {% endblock %} - -{% comment %} -{% block content %} -<div id="main-bar" class="headNormal"> - {% trans "Ask a question" %} -</div> -<div id="main-body" class="ask-body"> - <div id="askform"> - <form id="fmask" action="" method="post" > - {% if not request.user.is_authenticated %} - <div class="message"> - <p>{% trans "login to post question info" %}</p> - </div> - {% else %} - {% if settings.EMAIL_VALIDATION %} - {% if not request.user.email_isvalid %} - <div class="message"> - {% blocktrans with request.user.email as email %}must have valid {{email}} to post, - see {{email_validation_faq_url}} - {% endblocktrans %} - </div> - {% endif %} - {% endif %} - {% endif %} - <div class="form-item"> - <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/> - {{ form.title }} {{ form.title.errors }} - <div class="title-desc"> - {{ form.title.help_text }} - </div> - </div> - - <div class="form-item"> - <div id="wmd-button-bar" class="wmd-panel"></div> - {{ form.text }} - - <div class="preview-toggle"> - <table width="100%"> - <tr> - <td> - <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span> - </td> - {% if settings.WIKI_ON %} - <td style="text-align:right;"> - {{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span> - </td> - {% endif %} - </tr> - - </table> - </div> - <div id="previewer" class="wmd-preview"></div> - <span class="form-error"></span> - </div> - <div class="form-item"> - <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/> - {{ form.tags }} {{ form.tags.errors }} - </div> - <p class="title-desc"> - {{ form.tags.help_text }} - </p> - {% if not request.user.is_authenticated %} - <input type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" /> - {% else %} - <input type="submit" value="{% trans "Ask your question" %}" class="submit" /> - {% endif %} - </form> - </div> -</div> -{% endblock %} -{% endcomment %} - +{# main contents of ask form is in the template input_bar #} {% block sidebar %} {% include "question_edit_tips.html" %} {% endblock %} diff --git a/askbot/skins/default/templates/ask_form.jinja.html b/askbot/skins/default/templates/ask_form.jinja.html index a7f61304..2a841a76 100644 --- a/askbot/skins/default/templates/ask_form.jinja.html +++ b/askbot/skins/default/templates/ask_form.jinja.html @@ -1,9 +1,6 @@ <div id="askform"> <form id="fmask" action="" method="post" > <div class="form-item"> - {% comment %} - <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> - {% endcomment %} <div id="askFormBar"> {% if not request.user.is_authenticated() %} <p>{% trans %}login to post question info{% endtrans %}</p> @@ -32,11 +29,11 @@ <table> <tr> <td> - <span id="pre-collapse" title="{% trans %}Toggle the real time Markdown editor preview{% endtrans %}">{% trans "toggle preview{% endtrans %}</span> + <span id="pre-collapse" title="{% trans %}Toggle the real time Markdown editor preview{% endtrans %}">{% trans %}toggle preview{% endtrans %}</span> </td> {% if settings.WIKI_ON %} <td style="text-align:right;"> - {{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span> + {{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag() }} </span> </td> {% endif %} </tr> @@ -47,7 +44,7 @@ <span class="form-error"></span> </div> <div class="form-item"> - <strong>{{ form.tags.label_tag }}:</strong> {% trans %}(required){% endtrans %} <span class="form-error"></span><br/> + <strong>{{ form.tags.label_tag() }}:</strong> {% trans %}(required){% endtrans %} <span class="form-error"></span><br/> {{ form.tags }} {{ form.tags.errors }} </div> <p class="title-desc"> diff --git a/askbot/skins/default/templates/badge.html b/askbot/skins/default/templates/badge.html index 99d74e1b..322836ad 100644 --- a/askbot/skins/default/templates/badge.html +++ b/askbot/skins/default/templates/badge.html @@ -1,34 +1,42 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} +{% import "macros.html" as macros %} <!-- template badge.html --> -{% load i18n %} -{% load extra_tags %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans badge.name %} - {% trans "Badge" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans name=badge.name %}{{name}}{% endtrans %} - {% trans %}Badge{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} - <script type="text/javascript"> + <script type="text/javascript"> $().ready(function(){ $("#nav_badges").attr('className',"on"); }); - - </script> + </script> {% endblock %} {% block content %} <div id="main-bar" class="headNormal"> - {% trans "Badge" %} +{% trans %}Badge{% endtrans %} </div> <div id="main-body" style="width:100%;margin-bottom:20px"> <p> - <a href="{{badge.get_absolute_url}}" title="{{ badge.get_type_display }} : {% trans badge.description %}" class="medal"><span class="badge{{ badge.type }}">●</span> {% trans badge.name %}</a> {% trans badge.description %} + <a href="{{badge.get_absolute_url()}}" title="{{ badge.get_type_display() }} : {% trans description=badge.description %}{{description}}{% endtrans %}" class="medal"><span class="badge{{ badge.type }}">●</span> {% trans name=badge.name%}{{name}}{% endtrans %}</a> {% trans description=badge.description %}{{description}}{% endtrans %} </p> <div> {% if badge.awarded_count %} <p style="float:left"><span class="count">{{ awards|length|intcomma }}</span> - <strong>{% blocktrans count awards|length as num_awardees %}user received this badge:{% plural %}users received this badge:{% endblocktrans %}</strong></p> + <strong>{% trans num_awardees=awards|length %}user received this badge:{% pluralize %}users received this badge:{% endtrans %}</strong></p> {% endif %} </div> <div id="award-list" style="clear:both;margin-left:20px;line-height:25px;"> {% for award in awards %} - <p style="width:180px;float:left"><a href="{% url users %}{{ award.id }}/{{ award.name }}">{{ award.name }}</a> {% get_score_badge_by_details award.rep award.gold award.silver award.bronze %}</p> + <p style="width:180px;float:left"><a href="{% url users %}{{ award.id }}/{{ award.name }}">{{ award.name }}</a> + {{ + macros.user_score_and_badge_summary( + { + 'reputation':award.rep, + 'gold': award.gold, + 'silver': award.silver, + 'bronze': award.bronze + } + ) + }} + </p> {% endfor %} </div> diff --git a/askbot/skins/default/templates/badges.html b/askbot/skins/default/templates/badges.html index 9fbd6395..6e5ef6b6 100644 --- a/askbot/skins/default/templates/badges.html +++ b/askbot/skins/default/templates/badges.html @@ -1,9 +1,6 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} <!-- template badges.html --> -{% load extra_tags %} -{% load humanize %} -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Badges summary" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Badges summary{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} <script type="text/javascript"> $().ready(function(){ @@ -14,32 +11,32 @@ {% endblock %} {% block content %} <div class="headlineA"> - <span class="headMedals">{% trans "Badges" %}</span> + <span class="headMedals">{% trans %}Badges{% endtrans %}</span> </div> <div class="badges" id="main-body" style="width:100%"> <p> - {% trans "Community gives you awards for your questions, answers and votes." %}<br/> - {% blocktrans %}Below is the list of available badges and number + {% trans %}Community gives you awards for your questions, answers and votes.{% endtrans %}<br/> +{% trans %}Below is the list of available badges and number of times each type of badge has been awarded. Give us feedback at {{feedback_faq_url}}. - {% endblocktrans %} + {% endtrans %} </p> <div id="medalList"> {% for badge in badges %} <div style="clear:both;line-height:30px"> <div style="float:left;min-width:30px;text-align:right;height:30px"> {% for a in mybadges %} - {% ifequal a.badge_id badge.id %} + {% if a.badge_id == badge.id %} <span style="font-size:175%; padding-right:5px; color:#5B9058;">✔</span> - {% endifequal %} + {% endif %} {% endfor %} </div> <div style="float:left;width:230px;"> - <a href="{{badge.get_absolute_url}}" - title="{% trans badge.get_type_display %} : {% trans badge.description %}" - class="medal"><span class="badge{{ badge.type }}">●</span> {% trans badge.name %}</a><strong> + <a href="{{badge.get_absolute_url()}}" + title="{% trans type=badge.get_type_display() %}{{type}}{% endtrans %} : {% trans description=badge.description %}{{description}}{% endtrans %}" + class="medal"><span class="badge{{ badge.type }}">●</span> {% trans name=badge.name %}{{name}}{% endtrans %}</a><strong> × {{ badge.awarded_count|intcomma }}</strong> </div> - <p style="float:left;margin-top:8px;">{% trans badge.description %}</p> + <p style="float:left;margin-top:8px;">{% trans description=badge.description %}{{description}}{% endtrans %}</p> </div> {% endfor %} </div> @@ -48,28 +45,29 @@ {% block sidebar %} <div class="boxC"> - <h3>{% trans "Community badges" %}</h3> + <h3>{% trans %}Community badges{% endtrans %}</h3> <div class="body"> <p> - <a style="cursor:default;" title="gold badge: the highest honor and is very rare" class="medal"><span class="badge1">●</span> {% trans "gold" %}</a> + <a style="cursor:default;" title="{% trans %}gold badge: the highest honor and is very rare{% endtrans %}" class="medal"><span class="badge1">●</span> {% trans %}gold{% endtrans %}</a> </p> <p> - {% trans "gold badge description" %} + {% trans %}gold badge description{% endtrans %} </p> <p> - <a style="cursor:default;" - title="silver badge: occasionally awarded for the very high quality contributions" - class="medal"><span class="badge2">●</span> {% trans "silver" %}</a> + <a + style="cursor:default;" + title="{% trans %}silver badge: occasionally awarded for the very high quality contributions{% endtrans %}" + class="medal"><span class="badge2">●</span> {% trans %}silver{% endtrans %}</a> </p> <p> - {% trans "silver badge description" %} + {% trans %}silver badge description{% endtrans %} </p> <p> - <a style="cursor:default;" title="{% trans "bronze badge: often given as a special honor" %}" class="medal"> - <span class="badge3">●</span> {% trans "bronze" %}</a> + <a style="cursor:default;" title="{% trans %}bronze badge: often given as a special honor{% endtrans %}" class="medal"> + <span class="badge3">●</span> {% trans %}bronze{% endtrans %}</a> </p> <p> - {% trans "bronze badge description" %} + {% trans %}bronze badge description{% endtrans %} </p> </div> </div> diff --git a/askbot/skins/default/templates/base_content.jinja.html b/askbot/skins/default/templates/base_content.jinja.html new file mode 100644 index 00000000..163aafa0 --- /dev/null +++ b/askbot/skins/default/templates/base_content.jinja.html @@ -0,0 +1,87 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<!-- base_content.html --> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE }}</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS}}" /> + {% block meta_description %} + <meta name="description" content="{{settings.APP_DESCRIPTION}}" /> + {% endblock %} + {% if settings.GOOGLE_SITEMAP_CODE %} + <meta name="google-site-verification" content="{{ settings.GOOGLE_SITEMAP_CODE }}" /> + {% endif %} + <link rel="shortcut icon" href="{"/images/favicon.gif"|media}}" /> + <link href="{{"/style/style.css"|media}}" rel="stylesheet" type="text/css" /> + {% spaceless %} + {% block forestyle %}{% endblock %} + {% endspaceless %} + <script src="http://www.google.com/jsapi" type="text/javascript"></script> + <script type="text/javascript">google.load("jquery", "1.2.6");</script> + <script type="text/javascript"> + var i18nLang = '{{ settings.LANGUAGE_CODE }}'; + var scriptUrl = '/{{settings.ASKBOT_URL}}' + var askbotSkin = '{{settings.ASKBOT_DEFAULT_SKIN}}'; + {% if settings.ENABLE_MATHJAX %} + var enableMathJax = true; + {% else %} + var enableMathJax = false; + {% endif %} + </script> + <script type='text/javascript' src='{{"/js/com.cnprog.i18n.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/jquery.i18n.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/com.cnprog.utils.js"|media}}'></script> + {% if settings.ENABLE_MATHJAX %} + <script type='text/javascript' src='{{settings.MATHJAX_BASE_URL}}/MathJax.js'> + MathJax.Hub.Config({ + extensions: ["tex2jax.js"], + jax: ["input/TeX","output/HTML-CSS"], + tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]} + }); + </script> + {% endif %} + {% if user_messages %} + <style type="text/css"> + body { margin-top:2.4em; } + </style> + <script type="text/javascript"> + $(document).ready(function() { + var element = $('#validate_email_alert') + element.click(function(){notify.close(true);setTimeout(function(){},1000)}) + notify.show(); + }); + </script> + {% endif %} + {% block forejs %} + {% endblock %} + </head> + <body> + <div class="notify" style="display:none"> + {% if user_messages %} + {% for message in user_messages %} + <p class="darkred">{{ message }}</p> + {% endfor %} + {% endif %} + <a id="close-notify" onclick="notify.close(true)">×</a> + </div> + {% include "header.jinja.html" %} + <div id="wrapper"> + <div id="room"> + <div id="CAFull"> + {% include "input_bar.jinja.html" %} + {% block content%} + {% endblock%} + </div> + <div id="tail" style="clear:both;"> + {% block tail %} + {% endblock %} + </div> + </div> + <div class="spacer3"></div> + </div> + {% include "footer.jinja.html" %} + {% block endjs %} + {% endblock %} + </body> +</html> +<!-- end template base_content.html --> diff --git a/askbot/skins/default/templates/book.html b/askbot/skins/default/templates/book.html deleted file mode 100644 index d525b7ac..00000000 --- a/askbot/skins/default/templates/book.html +++ /dev/null @@ -1,152 +0,0 @@ -{% extends "base_content.html" %} -<!-- template book.html --> -{% load i18n %} -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} -{% block title %}{% spaceless %}{{ book.title }}-{% trans "reading channel" %}{% endspaceless %}{% endblock %} -{% block forejs %} - <script type="text/javascript"> - $().ready(function(){ - $("#nav_books").attr('className',"on"); - //$("#nav_ask").hide(); - }); - - </script> -{% endblock %} -{% block content %} - <div class="headNormal"><a href="{{ book.get_absolute_url }}">《{{ book.title }}》</a></div> - <div class="bookInfo"> - <div class="bookCover"> - <img src="{{ book.cover_img }}" > - </div> - <div class="bookSummary"> - <table> - <tr> - <td>{% trans "[author]" %}</td> - <td><b><a href="{% url user book.user.id %}" rel="nofollow" >{{ book.author }}</a></b></td> - </tr> - <tr> - <td>{% trans "[publisher]" %}</td> - <td>{{ book.publication }}</td> - </tr> - <tr> - <td>{% trans "[publication date]" %}</td> - <td>{{ book.published_at|date:"Y-m" }}</td> - </tr> - <tr> - <td>{% trans "[price]" %}</td> - <td>{{ book.price }} {% trans "currency unit" %}</td> - </tr> - <tr> - <td>{% trans "[pages]" %}</td> - <td>{{ book.pages }} {% trans "pages abbreviation" %}</td> - </tr> - <tr> - <td>{% trans "[tags]" %}</td> - <td>{{ book.tagnames }}</td> - </tr> - <tr> - <td> </td> - <td> </td> - </tr> - {% if author_info.blog_url %} - <tr> - <td></td> - <td><a href="{{ author_info.blog_url }}" rel="nofollow" >{% trans "author blog" %} »</a></td> - </tr> - - {% endif %} - <tr> - <td> </td> - <td><a href="#" rel="nofollow">{% trans "book directory" %} »</a></td> - </tr> - <tr> - <td> </td> - <td><a href="#" rel="nofollow">{% trans "buy online" %} »</a></td> - </tr> - </table> - </div> - <div class="blogRss"> - - </div> - </div> - - <div class="bookQuestions"> - - <div class="tabBar"> - <div class="tabsB"> - <a id="qa" class="on" title="{% trans "book technical Q&A %}" href="#">{% trans "reader questions" %}</a> - </div> - </div> - <div class="bookAsk"><a href="{% url ask_book book.short_name %}">{% trans "ask the author" %}</div> - <div class="user-stats-table"> - {% for question in questions.object_list %} - {% if question.favourite_count %} - {% if question.favorited_myself %} - <div class="favorites-count"> - <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="{% media "/images/vote-favorite-on.png" %}"> - <div><b>{{question.favourite_count|intcomma}}</b></div> - </div> - {% else %} - <div class="favorites-count-off"> - <img title="{% trans "this question was selected as favorite" %} {{question.favourite_count}} {% trans "number of times" %}" src="{% media "/images/vote-favorite-off.png" %}"> - <div><b>{{question.favourite_count|intcomma}}</b></div> - </div> - {% endif %} - {% else %} - <div class="favorites-empty"> </div> - {% endif %} - <div id="question-summary-{{question.id}}" class="question-summary narrow"> - <a style="text-decoration: none;" href="{% url questions %}{{question.id}}/{{question.get_question_title}}"> - <div class="stats"> - <div class="votes"> - <div class="vote-count-post">{{question.score|intcomma}}</div> - {% trans "votes" %} - - </div> - <div title="{% if question.answer_accepted %}{% trans "the answer has been accepted to be correct" %}{% endif %}" class="status {% if question.answer_accepted %}answered-accepted{% endif %} {% ifequal question.answer_count 0 %}unanswered{% endifequal %}{% ifnotequal question.answer_count 0 %}answered{% endifnotequal %}"> - <div class="answer-count-post">{{question.answer_count|intcomma}}</div> - {% trans "answer" %} - - </div> - <div class="views"> - <div class="views-count-post">{{question.view_count|cnprog_intword|safe}}</div> - {% trans "views" %} - </div> - </div> - </a> - <div class="bookQuestionItem"> - <h3> - <a title="{{question.summary|collapse}}" href="{% url questions %}{{question.id}}/{{question.title}}">{{question.title}}</a> - </h3> - <div class="tags"> - {% for tag in question.tagname_list %} - <a href="{% url questions %}?tags={{tag|urlencode}}" title="{% blocktrans %}see questions tagged '{{ tag }}'{% endblocktrans %}" rel="tag">{{ tag }}</a> - {% endfor %} - </div> - <div class="started"> - <span class="author"><a href="{{ question.last_activity_by.get_profile_url }}">{{ question.last_activity_by }}</a></span> - <span class="score">{% get_score_badge question.last_activity_by %} </span> - <span class="date" title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</span> - </div> - </div> - </div> - <br clear="both"/> - {% endfor %} - </div> - </div> -{% endblock %} -{% block tail %} - <div class="pager"> - {% cnprog_paginator context %} - - </div> - <div class="bookFeed"> - <div id="feeds"> - <a href="{% media "/feeds/rss" %} " title="{% trans "subscribe to book RSS feed" %}">{% trans "subscribe to the questions feed" %}</a> - </div> - </div> - -{% endblock %} -<!-- end template book.html --> diff --git a/askbot/skins/default/templates/close.html b/askbot/skins/default/templates/close.html index caae2014..0f113876 100644 --- a/askbot/skins/default/templates/close.html +++ b/askbot/skins/default/templates/close.html @@ -1,9 +1,6 @@ -{% extends "base_content.html" %} +{% extends "base_content.jinja.html" %} <!-- template close.html --> -{% load i18n %} -{% load extra_tags %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "Close question" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Close question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} <script type="text/javascript"> $().ready(function(){ @@ -13,23 +10,21 @@ {% endblock %} {% block content %} <div id="main-bar" class="headNormal"> - {% trans "Close question" %} + {% trans %}Close question{% endtrans %} </div> <div id="main-body" style="width:100%;margin-bottom:10px"> - <p>{% trans "Close the question" %}: <a href="{{ question.get_absolute_url }}"> - <strong>{{ question.get_question_title }}</strong></a> - </p> - + <p>{% trans %}Close the question{% endtrans %}: <a href="{{ question.get_absolute_url() }}"> + <strong>{{ question.get_question_title() }}</strong></a> + </p> <form id="fmclose" action="{% url close question.id %}" method="post" > <p> - <strong>{% trans "Reasons" %}:</strong> {{ form.reason }} + <strong>{% trans %}Reasons{% endtrans %}:</strong> + {{ form.reason }} </p> <div id="" style="padding-top:20px"> - <input type="submit" value="{% trans "OK to close" %}" class="submit" /> - <input id="btBack" type="button" class="submit" value="{% trans "Cancel" %}" /> - + <input type="submit" value="{% trans %}OK to close{% endtrans %}" class="submit" /> + <input id="btBack" type="button" class="submit" value="{% trans %}Cancel{% endtrans %}" /> </div> - </form> </div> {% endblock %} diff --git a/askbot/skins/default/templates/edit_user_email_feeds_form.html b/askbot/skins/default/templates/edit_user_email_feeds_form.html deleted file mode 100644 index c5b23227..00000000 --- a/askbot/skins/default/templates/edit_user_email_feeds_form.html +++ /dev/null @@ -1,4 +0,0 @@ -{% load i18n %} -<table class='form-as-table ab-subscr-form'> -{{email_feeds_form.as_table}} -</table> diff --git a/askbot/skins/default/templates/faq.html b/askbot/skins/default/templates/faq.html index f3a26d0f..74c9aefd 100644 --- a/askbot/skins/default/templates/faq.html +++ b/askbot/skins/default/templates/faq.html @@ -1,46 +1,39 @@ -{% extends "base.html" %} +{% extends "base.jinja.html" %} <!-- template faq.html --> -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} -{% load i18n %} -{% block title %}{% spaceless %}FAQ{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}FAQ{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} {% endblock %} {% block content %} <div class="headNormal"> - {% trans "Frequently Asked Questions " %}(FAQ) + {% trans %}Frequently Asked Questions {% endtrans %}({% trans %}FAQ{% endtrans %}) </div> <div id="main-body" class="about" style="width:100%"> <div class="first"> - <h3 class="subtitle">{% trans "What kinds of questions can I ask here?" %}</h3> - <p>{% trans "Most importanly - questions should be <strong>relevant</strong> to this community." %} - {% trans "Before asking the question - please make sure to use search to see whether your question has alredy been answered."%} + <h3 class="subtitle">{% trans %}What kinds of questions can I ask here?{% endtrans %}</h3> + <p>{% trans %}Most importanly - questions should be <strong>relevant</strong> to this community.{% endtrans %} + {% trans %}Before asking the question - please make sure to use search to see whether your question has alredy been answered.{% endtrans %} </p> - - <h3 class="subtitle">{% trans "What questions should I avoid asking?" %}</h3> - <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %} + <h3 class="subtitle">{% trans %}What questions should I avoid asking?{% endtrans %}</h3> + <p>{% trans %}Please avoid asking questions that are not relevant to this community, too subjective and argumentative.{% endtrans %} </p> </div> - <div> - <h3 class="subtitle">{% trans "What should I avoid in my answers?" %}</h3> - <p>{{ settings.APP_TITLE }} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}</p> + <h3 class="subtitle">{% trans %}What should I avoid in my answers?{% endtrans %}</h3> + <p>{{ settings.APP_TITLE }} {% trans %}is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions.{% endtrans %}</p> </div> - <div> - <h3 class="subtitle">{% trans "Who moderates this community?" %}</h3> - <p>{% trans "The short answer is: <strong>you</strong>." %} - {% trans "This website is moderated by the users." %} - {% trans "The reputation system allows users earn the authorization to perform a variety of moderation tasks." %} + <h3 class="subtitle">{% trans %}Who moderates this community?{% endtrans %}</h3> + <p>{% trans %}The short answer is: <strong>you</strong>.{% endtrans %} + {% trans %}This website is moderated by the users.{% endtrans %} + {% trans %}The reputation system allows users earn the authorization to perform a variety of moderation tasks.{% endtrans %} </p> </div> <div> - <h3 class="subtitle">{% trans "How does reputation system work?" %}</h3> - <p>{% trans "Rep system summary" %}</p> - <p>{% blocktrans with settings.MAX_REP_GAIN_PER_USER_PER_DAY as MAX_REP_GAIN_PER_USER_PER_DAY and settings.REP_GAIN_FOR_RECEIVING_UPVOTE as REP_GAIN_FOR_RECEIVING_UPVOTE and settings.REP_LOSS_FOR_RECEIVING_DOWNVOTE|absolute_value as REP_LOSS_FOR_RECEIVING_DOWNVOTE%}For example, if you ask an interesting question or give a helpful answer, your input will be upvoted. On the other hand if the answer is misleading - it will be downvoted. Each vote in favor will generate <strong>{{REP_GAIN_FOR_RECEIVING_UPVOTE}}</strong> points, each vote against will subtract <strong>{{REP_LOSS_FOR_RECEIVING_DOWNVOTE}}</strong> points. There is a limit of <strong>{{MAX_REP_GAIN_PER_USER_PER_DAY}}</strong> points that can be accumulated for a question or answer per day. The table below explains reputation point requirements for each type of moderation task.{% endblocktrans %} + <h3 class="subtitle">{% trans %}How does reputation system work?{% endtrans %}</h3> + <p>{% trans %}Rep system summary{% endtrans %}</p> + <p>{% trans MAX_REP_GAIN_PER_USER_PER_DAY=settings.MAX_REP_GAIN_PER_USER_PER_DAY, REP_GAIN_FOR_RECEIVING_UPVOTE=settings.REP_GAIN_FOR_RECEIVING_UPVOTE, REP_LOSS_FOR_RECEIVING_DOWNVOTE=settings.REP_LOSS_FOR_RECEIVING_DOWNVOTE|absolute_value %}For example, if you ask an interesting question or give a helpful answer, your input will be upvoted. On the other hand if the answer is misleading - it will be downvoted. Each vote in favor will generate <strong>{{REP_GAIN_FOR_RECEIVING_UPVOTE}}</strong> points, each vote against will subtract <strong>{{REP_LOSS_FOR_RECEIVING_DOWNVOTE}}</strong> points. There is a limit of <strong>{{MAX_REP_GAIN_PER_USER_PER_DAY}}</strong> points that can be accumulated for a question or answer per day. The table below explains reputation point requirements for each type of moderation task.{% endtrans %} </p> <table style="font-family:arial;" cellspacing="3" cellpadding="3"> @@ -50,76 +43,75 @@ </tr> <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_VOTE_UP}}</strong></td> - <td>{% trans "upvote" %}</td> + <td>{% trans %}upvote{% endtrans %}</td> </tr> <!-- <tr> <td class="faq-rep-item"><strong>15</strong></td> - <td>{% trans "use tags" %}</td> + <td>{% trans %}use tags{% endtrans %}</td> </tr> --> <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_LEAVE_COMMENTS}}</strong></td> - <td>{% trans "add comments" %}</td> + <td>{% trans %}add comments{% endtrans %}</td> </tr> <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_VOTE_DOWN}}</strong></td> - <td>{% trans "downvote" %}</td> + <td>{% trans %}downvote{% endtrans %}</td> </tr><tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_CLOSE_OWN_QUESTIONS}}</strong></td> - <td>{% trans "open and close own questions" %}</td> + <td>{% trans %}open and close own questions{% endtrans %}</td> </tr> <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_RETAG_OTHERS_QUESTIONS}}</strong></td> - <td>{% trans "retag other's questions" %}</td> + <td>{% trans %}retag other's questions{% endtrans %}</td> </tr> {% if settings.WIKI_ON %} <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_EDIT_WIKI}}</strong></td> - <td>{% trans "edit community wiki questions" %}</td> + <td>{% trans %}edit community wiki questions{% endtrans %}</td> </tr> {% endif %} <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}}</strong></td> - <td>{% trans "edit any answer" %}</td> + <td>{% trans %}"edit any answer{% endtrans %}</td> </tr> <tr> <td class="faq-rep-item"><strong>{{settings.MIN_REP_TO_DELETE_OTHERS_COMMENTS}}</strong></td> - <td>{% trans "delete any comment" %}</td> + <td>{% trans %}"delete any comment{% endtrans %}</td> </tr> </table> </div> - {% comment %} + {# {% if settings.EMAIL_VALIDATION %} <div> - <a id='validate'></a><h3 class="subtitle">{% trans "how to validate email title" %}</h3> + <a id='validate'></a><h3 class="subtitle">{% trans %}how to validate email title{% endtrans %}</h3> <!--special case here message must contain paragraphs--> - {% blocktrans %}how to validate email info with {{send_email_key_url}} {{gravatar_faq_url}}{% endblocktrans %} + {% trans %}how to validate email info with {{send_email_key_url}} {{gravatar_faq_url}}{% endtrans %} </div> {% endif %} - {% endcomment %} + #} <div> - <a id='gravatar'></a><h3 class="subtitle">{% trans "what is gravatar" %}</h3> - {% trans "gravatar faq info" %} + <a id='gravatar'></a><h3 class="subtitle">{% trans %}what is gravatar{% endtrans %}</h3> + {% trans %}gravatar faq info{% endtrans %} </div> <div> - <h3 class="subtitle">{% trans "To register, do I need to create new password?" %}</h3> - <p>{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %} - <strong><a href="{% url user_signin %}">{% trans "Login now!" %}</a> »</strong> + <h3 class="subtitle">{% trans %}To register, do I need to create new password?{% endtrans %}</h3> + <p>{% trans %}No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc."{% endtrans %} + <strong><a href="{% url user_signin %}">{% trans %}"Login now!"{% endtrans %}</a> »</strong> </p> </div> - <div> - <h3 class="subtitle">{% trans "Why other people can edit my questions/answers?" %}</h3> - <p> {% trans "Goal of this site is..." %} {% trans "So questions and answers can be edited like wiki pages by experienced users of this site and this improves the overall quality of the knowledge base content." %} - {% trans "If this approach is not for you, we respect your choice." %} + <h3 class="subtitle">{% trans %}Why other people can edit my questions/answers?{% endtrans %}</h3> + <p> {% trans %}Goal of this site is...{% endtrans %} {% trans %}So questions and answers can be edited like wiki pages by experienced users of this site and this improves the overall quality of the knowledge base content.{% endtrans %} + {% trans %}If this approach is not for you, we respect your choice.{% endtrans %} </p> </div> <div> - <h3 class="subtitle">{% trans "Still have questions?" %}</h3> - <p>{% blocktrans %}Please ask your question at {{ask_question_url}}, help make our community better!{% endblocktrans %} + <h3 class="subtitle">{% trans %}Still have questions?{% endtrans %}</h3> + <p>{% trans %}Please ask your question at {{ask_question_url}}, help make our community better!{% endtrans %} <!-- - <a href="{% url tags %}faq" class="big">{{ settings.APP_TITLE }} {% trans "questions" %}</a>{% trans "." %} + <a href="{% url tags %}faq" class="big">{{ settings.APP_TITLE }} {% trans %}questions{% endtrans %}</a>{% trans %}.{% endtrans %} --> </p> </div> diff --git a/askbot/skins/default/templates/html.list b/askbot/skins/default/templates/html.list new file mode 100644 index 00000000..9a315a9a --- /dev/null +++ b/askbot/skins/default/templates/html.list @@ -0,0 +1,57 @@ +==todo== +404.html +500.html +email_base.html +feedback.html +instant_notification.html +logout.html +macros.html +notarobot.html +pagesize.html +paginator.html +post_contributor_info.html +privacy.html +question_counter_widget.html +question_edit.html +question_edit_tips.html +question.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 +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 + +==done== +tag_selector.jinja.html +questions.jinja.html +ask_form.jinja.html +base.jinja.html +footer.jinja.html +header.jinja.html +input_bar.jinja.html +answer_edit_tips.html +answer_edit.html +ask.html +badges.html +base_content.html +close.html +edit_user_email_feeds_form.html +user.html +user_tabs.html +faq.html diff --git a/askbot/skins/default/templates/question_edit_tips.html b/askbot/skins/default/templates/question_edit_tips.html index 9085fe1e..1817c5e8 100644 --- a/askbot/skins/default/templates/question_edit_tips.html +++ b/askbot/skins/default/templates/question_edit_tips.html @@ -1,62 +1,61 @@ <!-- question_edit_tips.html --> -{% load i18n %} <div class="boxC"> - <p class="subtitle darkred">{% trans "question tips" %}</p> + <p class="subtitle darkred">{% trans %}question tips{% endtrans %}</p> <div> <ul class="list-item"> - <li> <b>{% trans "please ask a relevant question" %}</b> + <li> <b>{% trans %}please ask a relevant question{% endtrans %}</b> </li> <li> - {% trans "please try provide enough details" %} + {% trans %}please try provide enough details{% endtrans %} </li> <li> - {% trans "be clear and concise" %} + {% trans %}be clear and concise{% endtrans %} </li> </ul> <p class='info-box-follow-up-links'> - <a href="{% url faq %}" target="_blank" title="{% trans "see frequently asked questions" %}">{% trans "faq" %} »</a> + <a href="{% url faq %}" target="_blank" title="{% trans %}see frequently asked questions{% endtrans %}">{% trans %}faq{% endtrans %} »</a> </p> </div> </div> <div class="boxC"> - <p class="subtitle">{% trans "Markdown tips" %}</p> + <p class="subtitle">{% trans %}Markdown tips{% endtrans %}</p> <ul class="list-item"> {% if settings.MARKDUP_CODE_FRIENDLY or settings.ENABLE_MATHJAX %} <li> - {% trans "*italic*" %} + {% trans %}*italic*{% endtrans %} </li> <li> - {% trans "**bold**" %} + {% trans %}**bold**{% endtrans %} </li> {% else %} <li> - {% trans "*italic* or _italic_" %} + {% trans %}*italic* or _italic_{% endtrans %} </li> <li> - {% trans "**bold** or __bold__" %} + {% trans %}**bold** or __bold__{% endtrans %} </li> {% endif %} <li> - <b>{% trans "link" %}</b>:[{% trans "text" %}](http://url.com/ "{% trans "title" %}") + <b>{% trans %}link{% endtrans %}</b>:[{% trans %}text{% endtrans %}](http://url.com/ "{% trans %}title{% endtrans %}") </li> <li> - <b>{% trans "image" %}</b>:![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}") + <b>{% trans %}image{% endtrans %}</b>:![alt {% trans %}text{% endtrans %}](/path/img.jpg "{% trans %}title{% endtrans %}") </li> <li> - {% trans "numbered list:" %} + {% trans %}numbered list:{% endtrans %} 1. Foo 2. Bar </li> <li> - {% trans "basic HTML tags are also supported" %} + {% trans %}basic HTML tags are also supported{% endtrans %} </li> </ul> <p class='info-box-follow-up-links'> - <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} »</a> + <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans %}learn more about Markdown{% endtrans %} »</a> </p> </div> <!-- end question_edit_tips.html --> diff --git a/askbot/skins/default/templates/user.jinja.html b/askbot/skins/default/templates/user.jinja.html new file mode 100644 index 00000000..941b0c92 --- /dev/null +++ b/askbot/skins/default/templates/user.jinja.html @@ -0,0 +1,39 @@ +{% extends "base.jinja.html" %} +<!-- user.html --> +{% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %} +{% block forestyle%} +<style type="text/css"> + .history-table td { padding: 5px; } + .user-stats-table { margin-left:50px; } +</style> +{% endblock %} +{% block forejs %} + {% if request.user|can_moderate_user(view_user) %} + <!-- todo: add condition that scripts are loaded for admins only --> + <script type='text/javascript' src='{{"/js/com.cnprog.admin.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/jquery.form.js"|media}}'></script> + {% endif %} + <script type="text/javascript"> + var viewUserID = {{view_user.id}}; + $().ready(function(){ + $("#nav_users").attr('className',"on"); + }); + </script> + {% block userjs %} + {% endblock %} +{% endblock %} +{% block content %} + <div id="mainbar-full"> + <div id="subheader" class="headUser"> + {% spaceless %} + <a href="{% url user_profile view_user.id, view_user.username|slugify %}"> + {% trans username=view_user.username %}{{username}}'s profile{% endtrans %} + </a> + {% endspaceless %} + </div> + {% include "user_tabs.jinja.html" %} + {% block usercontent %} + {% endblock %} + {# include "user_footer.html #} + </div> +{% endblock %}<!-- end user.html --> diff --git a/askbot/skins/default/templates/user_email_subscriptions.html b/askbot/skins/default/templates/user_email_subscriptions.html index 325383db..252b2893 100644 --- a/askbot/skins/default/templates/user_email_subscriptions.html +++ b/askbot/skins/default/templates/user_email_subscriptions.html @@ -1,24 +1,22 @@ -{% extends "user.html" %} +{% extends "user.jinja.html" %} <!-- user_email_subscriptions.html --> -{% load i18n %} -{% load extra_tags %} -{% load humanize %} - {% block usercontent %} - <h2>{% trans "Email subscription settings" %}</h2> - <p class="message">{% trans "email subscription settings info" %}</p> - <div><!-- class='inline-block'--> + <h2>{% trans %}Email subscription settings{% endtrans %}</h2> + <p class="message">{% trans %}email subscription settings info{% endtrans %} </p> + <div> {% if action_status %} - <p class="action-status"><span>{{action_status}}</span></p> + <p class="action-status"><span>{{action_status}}</span></p> {% endif %} <form method="post" action=""> - {% include "edit_user_email_feeds_form.html" %} + <table class='form-as-table ab-subscr-form'> + {{email_feeds_form.as_table()}} + </table> <table class='form-as-table ab-tag-filter-form'> {{tag_filter_selection_form}} </table> <div class="submit-row text-align-right"> - <input type="submit" class="submit" name="save" value="{% trans "Update" %}"/> - <input type="submit" class="submit" name="stop_email" value="{% trans "Stop sending email" %}"/> + <input type="submit" class="submit" name="save" value="{% trans %}Update{% endtrans %}"/> + <input type="submit" class="submit" name="stop_email" value="{% trans %}Stop sending email{% endtrans %}"/> </div> </form> </div> diff --git a/askbot/skins/default/templates/user_tabs.jinja.html b/askbot/skins/default/templates/user_tabs.jinja.html new file mode 100644 index 00000000..9ea39682 --- /dev/null +++ b/askbot/skins/default/templates/user_tabs.jinja.html @@ -0,0 +1,38 @@ +<!-- user_tabs.html --> +<div class="tabBar"> + <div class="tabsA"> + <a id="stats" {% if tab_name=="stats" %}class="on"{% endif %} + title="{% trans %}User profile{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=stats">{% trans %}overview{% endtrans %}</a> + <a id="recent" {% if tab_name=="recent" %}class="on"{% endif %} + title="{% trans %}recent activity{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=recent">{% trans %}activity{% endtrans %}</a> + {% if request.user == view_user or request.user|can_moderate_user(view_user) %} + <a id="responses" {% if tab_name=="responses" %}class="on"{% endif %} + title="{% trans %}comments and answers to others questions{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=responses">{% trans %}responses{% endtrans %}</a> + {% endif %} + <a id="reputation" {% if tab_name=="reputation" %}class="on"{% endif %} + title="{% trans %}graph of user reputation{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=reputation">{% trans %}reputation history{% endtrans %}</a> + {% if request.user == view_user or request.user|can_moderate_user(view_user) %} + <a id="votes" {% if tab_name=="votes" %}class="on"{% endif %} + title="{% trans %}user vote record{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=votes">{% trans %}casted votes{% endtrans %}</a> + {% endif %} + <a id="favorites" {% if tab_name=="favorites" %}class="on"{% endif %} + title="{% trans %}questions that user selected as his/her favorite{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=favorites">{% trans %}favorites{% endtrans %}</a> + {% if request.user == view_user or request.user|can_moderate_user(view_user) %} + <a id="email_subscriptions" {% if tab_name=="email_subscriptions" %}class="on"{% endif %} + title="{% trans %}email subscription settings{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=email_subscriptions">{% trans %}subscriptions{% endtrans %}</a> + {% endif %} + {% if request.user|can_moderate_user(view_user) %} + <a id="moderation" {% if tab_name=="moderation" %}class="on"{% endif %} + title="{% trans %}moderate this user{% endtrans %}" + href="{% url user_profile view_user.id, view_user.username|slugify %}?sort=moderation">{% trans %}moderation{% endtrans %}</a> + {% endif %} + </div> +</div> +<!-- end user_tabs.html --> diff --git a/askbot/skins/loaders.py b/askbot/skins/loaders.py index fa6f1a7d..e44801e6 100644 --- a/askbot/skins/loaders.py +++ b/askbot/skins/loaders.py @@ -1,5 +1,6 @@ -from django.template.loaders import filesystem import os.path +from django.template.loaders import filesystem +from django.utils import translation from askbot.conf import settings as askbot_settings from django.conf import settings as django_settings from coffin.common import CoffinEnvironment @@ -52,5 +53,14 @@ class SkinEnvironment(CoffinEnvironment): loaders.append(jinja_loaders.FileSystemLoader(template_dirs)) return loaders + def set_language(self, language_code): + """hooks up translation objects from django to jinja2 + environment. + note: not so sure about thread safety here + """ + trans = translation.trans_real.translation(language_code) + self.install_gettext_translations(trans) + + ENV = SkinEnvironment(autoescape=False, extensions=['jinja2.ext.i18n']) -ENV.install_null_translations() +ENV.set_language(django_settings.LANGUAGE_CODE) diff --git a/askbot/views/commands.py b/askbot/views/commands.py index 010e20f1..4c57f05f 100644 --- a/askbot/views/commands.py +++ b/askbot/views/commands.py @@ -23,6 +23,7 @@ from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from askbot.utils.decorators import ajax_method, ajax_login_required from askbot.templatetags import extra_filters as template_filters +from askbot.skins.loaders import ENV import logging def process_vote(user = None, vote_direction = None, post = None): @@ -319,15 +320,10 @@ def close(request, id):#close question else: request.user.assert_can_close_question(question) form = CloseForm() - response = render_to_response( - 'close.html', - { - 'form' : form, - 'question' : question, - }, - context_instance=RequestContext(request) - ) - return response + template = ENV.get_template('close.html') + data = {'form': form, 'question': question} + context = RequestContext(request, data) + return HttpResponse(template.render(context)) except exceptions.PermissionDenied, e: request.user.message_set.create(message = unicode(e)) return HttpResponseRedirect(question.get_absolute_url()) diff --git a/askbot/views/meta.py b/askbot/views/meta.py index 88d9bac7..5942b277 100644 --- a/askbot/views/meta.py +++ b/askbot/views/meta.py @@ -12,19 +12,24 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from askbot.utils.forms import get_next_url from askbot.models import Badge, Award +from askbot.skins.loaders import ENV import askbot def about(request): - return render_to_response('about.html', context_instance=RequestContext(request)) + template = ENV.get_template('about.jinja.html') + context = RequestContext(request) + return HttpResponse(template.render(context)) def faq(request): + template = ENV.get_template('faq.html') data = { 'view_name':'faq', 'gravatar_faq_url': reverse('faq') + '#gravatar', #'send_email_key_url': reverse('send_email_key'), 'ask_question_url': reverse('ask'), } - return render_to_response('faq.html', data, context_instance=RequestContext(request)) + context = RequestContext(request, data) + return HttpResponse(template.render(context)) def feedback(request): data = {'view_name':'feedback'} @@ -71,12 +76,15 @@ def badges(request):#user status/reputation system my_badges = Award.objects.filter(user=request.user).values('badge_id') #my_badges.query.group_by = ['badge_id'] - return render_to_response('badges.html', { + template = ENV.get_template('badges.html') + data = { 'badges' : badges, 'view_name': 'badges', 'mybadges' : my_badges, 'feedback_faq_url' : reverse('feedback'), - }, context_instance=RequestContext(request)) + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) def badge(request, id): badge = get_object_or_404(Badge, id=id) @@ -92,9 +100,12 @@ def badge(request, id): params=[id] ).distinct('id') - return render_to_response('badge.html', { + template = ENV.get_template('badge.html') + data = { 'view_name': badge, 'awards' : awards, 'badge' : badge, - }, context_instance=RequestContext(request)) + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) diff --git a/askbot/views/users.py b/askbot/views/users.py index aa7815a0..f368c6d6 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -33,6 +33,7 @@ from askbot.conf import settings as askbot_settings from askbot import models from askbot import exceptions from askbot.models import signals +from askbot.skins.loaders import ENV question_type = ContentType.objects.get_for_model(models.Question) answer_type = ContentType.objects.get_for_model(models.Answer) @@ -956,7 +957,8 @@ def user_email_subscriptions(request, user): tag_filter_form = forms.TagFilterSelectionForm(instance=user) action_status = None - return render_to_response('user_email_subscriptions.html',{ + template = ENV.get_template('user_email_subscriptions.html') + data = { 'active_tab': 'users', 'tab_name': 'email_subscriptions', 'tab_description': _('email subscription settings'), @@ -965,7 +967,9 @@ def user_email_subscriptions(request, user): 'email_feeds_form': email_feeds_form, 'tag_filter_selection_form': tag_filter_form, 'action_status': action_status, - }, context_instance=RequestContext(request)) + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) user_view_call_table = { 'stats': user_stats, @@ -1000,26 +1004,3 @@ def user(request, id, slug=None): user_view_func = user_stats return user_view_func(request, profile_owner) - -@login_required -def account_settings(request):#todo: is this actually used? - """ - index pages to changes some basic account settings : - - change password - - change email - - associate a new openid - - delete account - - url : / - - template : authopenid/settings.html - """ - logging.debug('') - msg = request.GET.get('msg', '') - is_openid = False - - return render_to_response('account_settings.html', { - 'active_tab':'users', - 'msg': msg, - 'is_openid': is_openid - }, context_instance=RequestContext(request)) diff --git a/askbot/views/writers.py b/askbot/views/writers.py index dc40e2b6..4ef00809 100644 --- a/askbot/views/writers.py +++ b/askbot/views/writers.py @@ -25,6 +25,7 @@ from askbot import auth from askbot.views.readers import _get_tags_cache_json from askbot import forms from askbot import models +from askbot.skins.loaders import ENV # used in index page INDEX_PAGE_SIZE = 20 @@ -170,12 +171,15 @@ def ask(request):#view used to ask a new question form.initial['title'] = query tags = _get_tags_cache_json() - return render_to_response('ask.html', { + template = ENV.get_template('ask.html') + data = { 'active_tab': 'ask', 'form' : form, 'tags' : tags, 'email_validation_faq_url':reverse('faq') + '#validate', - }, context_instance=RequestContext(request)) + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) @login_required def retag_question(request, id): @@ -299,16 +303,16 @@ def edit_answer(request, id): else: revision_form = forms.RevisionForm(answer, latest_revision) form = forms.EditAnswerForm(answer, latest_revision) - return render_to_response( - 'answer_edit.html', - { - 'active_tab': 'questions', - 'answer': answer, - 'revision_form': revision_form, - 'form': form, - }, - context_instance=RequestContext(request) - ) + template = ENV.get_template('answer_edit.html') + data = { + 'active_tab': 'questions', + 'answer': answer, + 'revision_form': revision_form, + 'form': form, + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) + except exceptions.PermissionDenied, e: request.user.message_set.create(message = unicode(e)) return HttpResponseRedirect(answer.get_absolute_url()) |