diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-10-08 22:55:23 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-10-08 22:55:23 -0400 |
commit | a09ac4f98bad866bc851c1f6da757bb0bbc5f090 (patch) | |
tree | 266ffac62f663fc20820c859fa53127cc0dc71d9 | |
parent | 91c5ebf35c28183ddbab9ed4dcea4e7dfc1fca0a (diff) | |
download | askbot-a09ac4f98bad866bc851c1f6da757bb0bbc5f090.tar.gz askbot-a09ac4f98bad866bc851c1f6da757bb0bbc5f090.tar.bz2 askbot-a09ac4f98bad866bc851c1f6da757bb0bbc5f090.zip |
all templates converted to jinja2
86 files changed, 683 insertions, 1878 deletions
diff --git a/askbot/deps/django_authopenid/forms.py b/askbot/deps/django_authopenid/forms.py index bc878ec9..2d4b57d6 100644 --- a/askbot/deps/django_authopenid/forms.py +++ b/askbot/deps/django_authopenid/forms.py @@ -43,7 +43,6 @@ from askbot import const as askbot_const from django.utils.safestring import mark_safe from askbot.deps.recaptcha_django import ReCaptchaField from askbot.utils.forms import NextUrlField, UserNameField, UserEmailField, SetPasswordForm -EXTERNAL_LOGIN_APP = settings.LOAD_EXTERNAL_LOGIN_APP() # needed for some linux distributions like debian try: diff --git a/askbot/deps/django_authopenid/urls.py b/askbot/deps/django_authopenid/urls.py index bbd0f2a2..3ed2eaa3 100644 --- a/askbot/deps/django_authopenid/urls.py +++ b/askbot/deps/django_authopenid/urls.py @@ -3,19 +3,6 @@ from django.conf.urls.defaults import patterns, url from django.utils.translation import ugettext as _ from django.conf import settings -#print 'stuff to import %s' % settings.EXTERNAL_LOGIN_APP.__name__ + '.views' -#try: -# settings.EXTERNAL_LOGIN_APP = __import__('mediawiki.views') -#print 'stuff to import %s' % settings.EXTERNAL_LOGIN_APP.__name__ + '.views' -#try: -# print 'imported fine' -# print settings.EXTERNAL_LOGIN_APP.__dict__.keys() -#except: -# print 'dammit!' -#from mediawiki.views import signup_view -#settings.EXTERNAL_LOGIN_APP.views.signup_view() - -#print settings.EXTERNAL_LOGIN_APP.__dict__.keys() urlpatterns = patterns('askbot.deps.django_authopenid.views', # yadis rdf url(r'^yadis.xrdf$', 'xrdf', name='yadis_xrdf'), @@ -24,6 +11,7 @@ urlpatterns = patterns('askbot.deps.django_authopenid.views', url(r'^%s%s$' % (_('signin/'),_('newquestion/')), 'signin', kwargs = {'newquestion':True}, name='user_signin_new_question'), url(r'^%s%s$' % (_('signin/'),_('newanswer/')), 'signin', kwargs = {'newanswer':True}, name='user_signin_new_answer'), url(r'^%s$' % _('signout/'), 'signout', name='user_signout'), + #this view is "complete-openid" signin url(r'^%s%s$' % (_('signin/'), _('complete/')), 'complete_signin', name='user_complete_signin'), url( @@ -37,15 +25,11 @@ urlpatterns = patterns('askbot.deps.django_authopenid.views', 'signup_with_password', name='user_signup_with_password' ), - # manage account settings - #url(r'^$', 'account_settings', name='user_account_settings'), - #url(r'^%s%s$' % (_('email/'),_('validate/')), 'changeemail', name='user_validateemail',kwargs = {'action':'validate'}), - #url(r'^%s%s$' % (_('email/'), _('change/')), 'changeemail', name='user_changeemail'), + #these two commeted out urls should work only with EMAIL_VALIDATION=True + #but the setting is disabled right now #url(r'^%s%s$' % (_('email/'), _('sendkey/')), 'send_email_key', name='send_email_key'), - url(r'^%s(?P<key>[\dabcdef]{32})?$' % _('recover/'), 'account_recover', name='user_account_recover'), #url(r'^%s%s(?P<id>\d+)/(?P<key>[\dabcdef]{32})/$' % (_('email/'), _('verify/')), 'verifyemail', name='user_verifyemail'), - #url(r'^%s$' % _('openid/'), 'changeopenid', name='user_changeopenid'), - #url(r'^%s$' % _('delete/'), 'delete', name='user_delete'), + url(r'^%s(?P<key>[\dabcdef]{32})?$' % _('recover/'), 'account_recover', name='user_account_recover'), url( r'^delete_login_method/$',#this method is ajax only 'delete_login_method', diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index 096fae87..4c4c12f0 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -35,7 +35,6 @@ from django.utils import simplejson from django.http import HttpResponseRedirect, get_host, Http404, \ HttpResponseServerError from django.http import HttpResponse -from django.shortcuts import render_to_response from django.template import RequestContext, loader, Context from django.conf import settings from askbot.conf import settings as askbot_settings @@ -51,6 +50,8 @@ from django.utils.safestring import mark_safe from django.core.mail import send_mail from django.views.defaults import server_error +from askbot.skins.loaders import ENV + from openid.consumer.consumer import Consumer, \ SUCCESS, CANCEL, FAILURE, SETUP_NEEDED from openid.consumer.discover import DiscoveryFailure @@ -74,16 +75,11 @@ from django import forms as django_forms import logging from askbot.utils.forms import get_next_url -EXTERNAL_LOGIN_APP = settings.LOAD_EXTERNAL_LOGIN_APP() - #todo: decouple from askbot def login(request,user): from django.contrib.auth import login as _login from askbot.models import signals - if settings.USE_EXTERNAL_LEGACY_LOGIN == True: - EXTERNAL_LOGIN_APP.api.login(request,user) - #1) get old session key session_key = request.session.session_key #2) get old search state @@ -159,8 +155,8 @@ def ask_openid( def complete(request, on_success=None, on_failure=None, return_to=None): """ complete openid signin """ - on_success = on_success or default_on_success - on_failure = on_failure or default_on_failure + assert(on_success is not None) + assert(on_failure is not None) logging.debug('in askbot.deps.django_authopenid.complete') @@ -194,21 +190,6 @@ def complete(request, on_success=None, on_failure=None, return_to=None): logging.debug('BAD OPENID STATUS') assert False, "Bad openid status: %s" % openid_response.status -def default_on_success(request, identity_url, openid_response): - """ default action on openid signin success """ - logging.debug('') - request.session['openid'] = util.from_openid_response(openid_response) - logging.debug('performing default action on openid success %s' % get_next_url(request)) - return HttpResponseRedirect(get_next_url(request)) - -def default_on_failure(request, message): - """ default failure action on signin """ - logging.debug('default openid failure action') - return render_to_response('openid_failure.html', { - 'message': message - }) - - def not_authenticated(func): """ decorator that redirect user to next page if he/she is already logged in.""" @@ -550,11 +531,9 @@ def show_signin_view( data['major_login_providers'] = major_login_providers.values() data['minor_login_providers'] = minor_login_providers.values() - return render_to_response( - 'authopenid/signin.html', - data, - context_instance=RequestContext(request) - ) + template = ENV.get_template('authopenid/signin.html') + context = RequestContext(request, data) + return HttpResponse(template.render(context)) @login_required def delete_login_method(request): @@ -682,17 +661,6 @@ def finalize_generic_signin( logging.debug('login success') return HttpResponseRedirect(redirect_url) - -def is_association_exist(openid_url): - """ test if an openid is already in database """ - is_exist = True - try: - uassoc = UserAssociation.objects.get(openid_url__exact = openid_url) - except UserAssociation.DoesNotExist: - is_exist = False - logging.debug(str(is_exist)) - return is_exist - @not_authenticated def register(request, provider_name = None): """ @@ -809,19 +777,18 @@ def register(request, provider_name = None): provider_logo = providers[provider_name] logging.debug('printing authopenid/complete.html output') - return render_to_response( - 'authopenid/complete.html', - { - 'openid_register_form': register_form, - 'email_feeds_form': email_feeds_form, - 'provider':mark_safe(provider_logo), - 'username': username, - 'email': email, - 'login_type':'openid', - 'gravatar_faq_url':reverse('faq') + '#gravatar', - }, - context_instance=RequestContext(request) - ) + template = ENV.get_template('authopenid/complete.html') + data = { + 'openid_register_form': register_form, + 'email_feeds_form': email_feeds_form, + 'provider':mark_safe(provider_logo), + 'username': username, + 'email': email, + 'login_type':'openid', + 'gravatar_faq_url':reverse('faq') + '#gravatar', + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) def signin_failure(request, message): """ @@ -916,10 +883,9 @@ def signup_with_password(request): 'form': form, 'email_feeds_form': email_feeds_form } - return render_to_response( - 'authopenid/signup_with_password.html', - context_data, - context_instance=RequestContext(request)) + template = ENV.get_template('authopenid/signup_with_password.html') + context = RequestContext(request, context_data) + return HttpResponse(template.render(context)) #what if request is not posted? @login_required @@ -939,46 +905,24 @@ def signout(request): logout(request) logging.debug('user logged out') return HttpResponseRedirect(get_next_url(request)) + +XRDF_TEMPLATE = """<?xml version='1.0' encoding='UTF-8'?> +<xrds:XRDS + xmlns:xrds='xri://$xrds' + xmlns:openid='http://openid.net/xmlns/1.0' + xmlns='xri://$xrd*($v*2.0)'> + <XRD> + <Service> + <Type>http://specs.openid.net/auth/2.0/return_to</Type> + <URI>%(return_to)s</URI> + </Service> + </XRD> +</xrds:XRDS>""" def xrdf(request): url_host = get_url_host(request) - logging.debug('what does this do??') - return_to = [ - "%s%s" % (url_host, reverse('user_complete_signin')) - ] - return render_to_response('authopenid/yadis.xrdf', { - 'return_to': return_to - }, context_instance=RequestContext(request)) - -@login_required -def account_settings(request): - """ - 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 = True - - try: - uassoc = UserAssociation.objects.get( - user__username__exact=request.user.username - ) - except: - is_openid = False - - - return render_to_response('authopenid/settings.html', { - 'msg': msg, - 'is_openid': is_openid - }, context_instance=RequestContext(request)) + return_to = "%s%s" % (url_host, reverse('user_complete_signin')) + return HttpResponse(XRDF_TEMPLATE % {'return_to': return_to}) def find_email_validation_messages(user): msg_text = _('your email needs to be validated see %(details_url)s') \ @@ -1041,15 +985,16 @@ def send_email_key(request): if current email is valid shows 'key_not_sent' view of authopenid/changeemail.html template """ - if askbot_settings.EMAIL_VALIDATION == True: if request.user.email_isvalid: - return render_to_response('authopenid/changeemail.html', - { 'email': request.user.email, - 'action_type': 'key_not_sent', - 'change_link': reverse('user_changeemail')}, - context_instance=RequestContext(request) - ) + template = ENV.get_template('authopenid/changeemail.html') + data = { + 'email': request.user.email, + 'action_type': 'key_not_sent', + 'change_link': reverse('user_changeemail') + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) else: send_new_email_key(request.user) return validation_email_sent(request) @@ -1108,12 +1053,18 @@ def account_recover(request, key = None): #internal server view used as return value by other views def validation_email_sent(request): + """this function is called only if EMAIL_VALIDATION setting is + set to True bolean value, basically dead now""" + assert(askbot_settings.EMAIL_VALIDATION == True) logging.debug('') - return render_to_response('authopenid/changeemail.html', - { 'email': request.user.email, - 'change_email_url': reverse('user_changeemail'), - 'action_type': 'validate', }, - context_instance=RequestContext(request)) + template = ENV.get_template('authopenid/changeemail.html') + data = { + 'email': request.user.email, + 'change_email_url': reverse('user_changeemail'), + 'action_type': 'validate' + } + context = RequestContext(request, data) + return HttpResponse(template.render(context)) def verifyemail(request,id=None,key=None): """ @@ -1121,277 +1072,17 @@ def verifyemail(request,id=None,key=None): url = /email/verify/{{user.id}}/{{user.email_key}}/ """ logging.debug('') - if askbot.settings.EMAIL_VALIDATION == True: + if askbot_settings.EMAIL_VALIDATION == True: user = User.objects.get(id=id) if user: if user.email_key == key: user.email_isvalid = True clear_email_validation_message(user) user.save() - return render_to_response('authopenid/changeemail.html', { - 'action_type': 'validation_complete', - }, context_instance=RequestContext(request)) + template = ENV.get_template('authopenid/changeemail.html') + data = {'action_type': 'validation_complete'} + context = RequestContext(request, data) + return HttpResponse(template.render(context)) else: logging.error('hmm, no user found for email validation message - foul play?') raise Http404 - -@login_required -def changeemail(request, action='change'): - """ - changeemail view. requires openid with request type GET - - url: /email/* - - template : authopenid/changeemail.html - """ - logging.debug('') - msg = request.GET.get('msg', None) - extension_args = {} - user_ = request.user - - if request.POST: - if 'cancel' in request.POST: - msg = _('your email was not changed') - request.user.message_set.create(message=msg) - return HttpResponseRedirect(get_next_url(request)) - form = forms.ChangeEmailForm(request.POST, user=user_) - if form.is_valid(): - new_email = form.cleaned_data['email'] - if new_email != user_.email: - if askbot_settings.EMAIL_VALIDATION == True: - action = 'validate' - else: - action = 'done_novalidate' - set_new_email(user_, new_email,nomessage=True) - else: - action = 'keep' - - elif not request.POST and 'openid.mode' in request.GET: - redirect_to = get_url_host(request) + reverse('user_changeemail') - return complete( - request, - on_success = emailopenid_success, - on_failure = emailopenid_failure, - return_to = redirect_to - ) - else: - form = forms.ChangeEmailForm(initial={'email': user_.email}, - user=user_) - - output = render_to_response('authopenid/changeemail.html', { - 'form': form, - 'email': user_.email, - 'action_type': action, - 'gravatar_faq_url': reverse('faq') + '#gravatar', - 'change_email_url': reverse('user_changeemail'), - 'msg': msg - }, context_instance=RequestContext(request)) - - if action == 'validate': - set_email_validation_message(user_) - - return output - -def emailopenid_success(request, identity_url, openid_response): - logging.debug('') - openid_ = util.from_openid_response(openid_response) - - user_ = request.user - try: - uassoc = UserAssociation.objects.get( - openid_url__exact=identity_url - ) - except: - return emailopenid_failure(request, - _("No OpenID %s found associated in our database" % identity_url)) - - if uassoc.user.username != request.user.username: - return emailopenid_failure(request, - _("The OpenID %s isn't associated to current user logged in" % - identity_url)) - - new_email = request.session.get('new_email', '') - if new_email: - user_.email = new_email - user_.save() - del request.session['new_email'] - msg = _("Email Changed.") - - redirect = "%s?msg=%s" % (reverse('user_account_settings'), - urlquote_plus(msg)) - return HttpResponseRedirect(redirect) - - -def emailopenid_failure(request, message): - logging.debug('') - redirect_to = "%s?msg=%s" % ( - reverse('user_changeemail'), urlquote_plus(message)) - return HttpResponseRedirect(redirect_to) - -@login_required -def changeopenid(request): - """ - change openid view. Allow user to change openid - associated to its username. - - url : /changeopenid/ - - template: authopenid/changeopenid.html - """ - logging.error('change openid view - never tested it yet!!!') - - extension_args = {} - openid_url = '' - has_openid = True - msg = request.GET.get('msg', '') - - user_ = request.user - - try: - uopenid = UserAssociation.objects.get(user=user_) - openid_url = uopenid.openid_url - except: - has_openid = False - - redirect_to = get_url_host(request) + reverse('user_changeopenid') - if request.POST and has_openid: - form = forms.ChangeopenidForm(request.POST, user=user_) - if form.is_valid(): - return ask_openid(request, form.cleaned_data['openid_url'], - redirect_to, on_failure=changeopenid_failure) - elif not request.POST and has_openid: - if 'openid.mode' in request.GET: - return complete( - request, - on_success = changeopenid_success, - on_failure = changeopenid_failure, - return_to = redirect_to - ) - - form = forms.ChangeopenidForm(initial={'openid_url': openid_url }, user=user_) - return render_to_response('authopenid/changeopenid.html', { - 'form': form, - 'has_openid': has_openid, - 'msg': msg - }, context_instance=RequestContext(request)) - -def changeopenid_success(request, identity_url, openid_response): - logging.error('never tested this worflow') - openid_ = util.from_openid_response(openid_response) - is_exist = True - try: - uassoc = UserAssociation.objects.get(openid_url__exact=identity_url) - except: - is_exist = False - - if not is_exist: - try: - uassoc = UserAssociation.objects.get( - user__username__exact=request.user.username - ) - uassoc.openid_url = identity_url - uassoc.save() - except: - uassoc = UserAssociation(user=request.user, - openid_url=identity_url) - uassoc.save() - elif uassoc.user.username != request.user.username: - return changeopenid_failure(request, - _('This OpenID is already associated with another account.')) - - request.session['openids'] = [] - request.session['openids'].append(openid_) - - msg = _("OpenID %s is now associated with your account." % identity_url) - redirect = "%s?msg=%s" % ( - reverse('user_account_settings'), - urlquote_plus(msg)) - return HttpResponseRedirect(redirect) - - -def changeopenid_failure(request, message): - logging.error('never tested this workflow') - redirect_to = "%s?msg=%s" % ( - reverse('user_changeopenid'), - urlquote_plus(message)) - return HttpResponseRedirect(redirect_to) - -@login_required -def delete(request): - """ - delete view. Allow user to delete its account. Password/openid are required to - confirm it. He should also check the confirm checkbox. - - url : /delete - - template : authopenid/delete.html - """ - logging.error('deleting account - never tested this') - - extension_args = {} - - user_ = request.user - - redirect_to = get_url_host(request) + reverse('user_delete') - if request.POST: - form = forms.DeleteForm(request.POST, user=user_) - if form.is_valid(): - if not form.test_openid: - user_.delete() - return signout(request) - else: - return ask_openid(request, form.cleaned_data['password'], - redirect_to, on_failure=deleteopenid_failure) - elif not request.POST and 'openid.mode' in request.GET: - return complete( - request, - on_success = deleteopenid_success, - on_failure = deleteopenid_failure, - return_to = redirect_to - ) - - form = forms.DeleteForm(user=user_) - - msg = request.GET.get('msg','') - return render_to_response('authopenid/delete.html', { - 'form': form, - 'msg': msg, - }, context_instance=RequestContext(request)) - -def deleteopenid_success(request, identity_url, openid_response): - logging.error('never tested this') - openid_ = util.from_openid_response(openid_response) - - user_ = request.user - try: - uassoc = UserAssociation.objects.get( - openid_url__exact=identity_url - ) - except: - return deleteopenid_failure(request, - _("No OpenID %s found associated in our database" % identity_url)) - - if uassoc.user.username == user_.username: - user_.delete() - return signout(request) - else: - return deleteopenid_failure(request, - _("The OpenID %s isn't associated to current user logged in" % - identity_url)) - - msg = _("Account deleted.") - redirect = reverse('index') + u"/?msg=%s" % (urlquote_plus(msg)) - return HttpResponseRedirect(redirect) - - -def deleteopenid_failure(request, message): - logging.error('never tested this') - redirect_to = "%s?msg=%s" % (reverse('user_delete'), urlquote_plus(message)) - return HttpResponseRedirect(redirect_to) - -def external_legacy_login_info(request): - logging.debug('maybe this view does not belong in this library') - feedback_url = reverse('feedback') - return render_to_response('authopenid/external_legacy_login_info.html', - {'feedback_url':feedback_url}, - context_instance=RequestContext(request)) diff --git a/askbot/middleware/pagesize.py b/askbot/middleware/pagesize.py index 20af6aa6..d4c0a9a3 100644 --- a/askbot/middleware/pagesize.py +++ b/askbot/middleware/pagesize.py @@ -1,6 +1,11 @@ import logging import traceback import sys +from django.http import HttpResponse, Http404 +from django.template import RequestContext +from django.conf import settings +from askbot.skins.loaders import ENV + # used in questions QUESTIONS_PAGE_SIZE = 10 class QuestionsPageSizeMiddleware(object): @@ -33,7 +38,17 @@ class QuestionsPageSizeMiddleware(object): request.session["page_size"] = page_size def process_exception(self, request, exception): + #todo: move this to separate middleware exc_type, exc_value, exc_traceback = sys.exc_info() - logging.debug(''.join(traceback.format_tb(exc_traceback))) - logging.debug(exc_type) - logging.debug(exc_value) + logging.critical(''.join(traceback.format_tb(exc_traceback))) + logging.critical(exc_type) + logging.critical(exc_value) + if exc_type == Http404: + return None + if getattr(settings, 'DEBUG', False) == True: + return None + else: + #todo - we have a strange requirement - maybe remove + #500.html needs RequestContext, while handler500 only receives Context + template = ENV.get_template('500.jinja.html') + return HttpResponse(template.render(RequestContext(request))) diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 81e5a991..f313f641 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -168,21 +168,6 @@ AUTHENTICATION_BACKENDS = ( 'askbot.deps.django_authopenid.backends.AuthBackend', ) -#this needs to go -USE_EXTERNAL_LEGACY_LOGIN = False #DO NOT USE, and do not delete this line, will be removed later -if 'USE_EXTERNAL_LEGACY_LOGIN' in locals() and USE_EXTERNAL_LEGACY_LOGIN: - INSTALLED_APPS += (EXTERNAL_LEGACY_LOGIN_MODULE,) - - if 'EXTERNAL_LEGACY_LOGIN_AUTHENTICATION_BACKEND' in locals(): - AUTHENTICATION_BACKENDS += (EXTERNAL_LEGACY_LOGIN_AUTHENTICATION_BACKEND,) - if 'EXTERNAL_LEGACY_LOGIN_AUTHENTICATION_MIDDLEWARE' in locals(): - MIDDLEWARE_CLASSES += (EXTERNAL_LEGACY_LOGIN_AUTHENTICATION_MIDDLEWARE,) - def LOAD_EXTERNAL_LOGIN_APP(): - return __import__(EXTERNAL_LEGACY_LOGIN_MODULE, [], [], ['api','forms','views']) -else: - LOAD_EXTERNAL_LOGIN_APP = lambda: None - - #logging settings LOG_FILENAME = 'askbot.log' logging.basicConfig( diff --git a/askbot/skins/default/templates/404.html b/askbot/skins/default/templates/404.html index 8ca393ee..2a3933d8 100644 --- a/askbot/skins/default/templates/404.html +++ b/askbot/skins/default/templates/404.html @@ -1,49 +1,5 @@ -{% extends "base_content.html" %} -<!-- template 404.html --> -{% load i18n %} -{% block title %}{% spaceless %}404 Error{% endspaceless %}{% endblock %} -{% block forestyle%} -<style type="text/css"> - form input { margin-right: 5px; } -</style> -{% endblock %} -{% block forejs %} - <script type="text/javascript"> - $().ready(function(){ - $("#linkPrevious").bind("click", back=function(){history.go(-1);}) - }); - - </script> -{% endblock %} -{% block content %} -<div id="main-bar" class="headNormal"> - 404 Not Found -</div> -<div id="main-body" class=""> - <div style="padding:5px 0px 10px 0;line-height:25px;"> - <h3>{% trans "Sorry, could not find the page you requested." %}</h3> - <div style="margin-top:5px"> - {% trans "This might have happened for the following reasons:" %}<br/> - <ul> - <li>{% trans "this question or answer has been deleted;" %}</li> - <li>{% trans "url has error - please check it;" %}</li> - <li>{% trans "the page you tried to visit is protected or you don't have sufficient points, see" %} <a href="{% url faq %}"> faq</a>;</li> - <li>{% trans "if you believe this error 404 should not have occured, please" %} - <a href="{{feedback_site_url}}" target="_blank">{% trans "report this problem" %}</a></li> - </u> - </div> - <script type="text/javascript"> - var GOOG_FIXURL_LANG = '{{settings.LANGUAGE_CODE}}'; - var GOOG_FIXURL_SITE = '{{site_url}}'; - </script> - <script type="text/javascript" src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script> - <ul> - <li><a href="#" id="linkPrevious">{% trans "back to previous page" %} »</li> - <li><a href="{% url questions %}">{% trans "see all questions" %} »</a></li> - <li><a href="{% url tags %}">{% trans "see all tags" %} »</a></li> - </u> - </div> - -</div> -{% endblock %} -<!-- end template 404.html --> +{% load extra_tags %} +{% include_jinja "404.jinja.html" %} +{% comment %} +this one has to be a django template because of use of default hander404 +{% endcomment %} diff --git a/askbot/skins/default/templates/404.jinja.html b/askbot/skins/default/templates/404.jinja.html new file mode 100644 index 00000000..61c2b767 --- /dev/null +++ b/askbot/skins/default/templates/404.jinja.html @@ -0,0 +1,47 @@ +{% extends "base_content.html" %} +<!-- template 404.jinja.html --> +{% block title %}{% spaceless %}{% trans %}Page not found{% endtrans %}{% endspaceless %}{% endblock %} +{% block forestyle%} +<style type="text/css"> + form input { margin-right: 5px; } +</style> +{% endblock %} +{% block forejs %} + <script type="text/javascript"> + $().ready(function(){ + $("#linkPrevious").bind("click", back=function(){history.go(-1);}) + }); + + </script> +{% endblock %} +{% block content %} +<div id="main-bar" class="headNormal"> + {% trans %}Page not found{% endtrans %} +</div> +<div id="main-body" class=""> + <div style="padding:5px 0px 10px 0;line-height:25px;"> + <h3>{% trans %}Sorry, could not find the page you requested.{% endtrans %}</h3> + <div style="margin-top:5px"> + {% trans %}This might have happened for the following reasons:{% endtrans %}<br/> + <ul> + <li>{% trans %}this question or answer has been deleted;{% endtrans %}</li> + <li>{% trans %}url has error - please check it;{% endtrans %}</li> + <li>{% trans %}the page you tried to visit is protected or you don't have sufficient points, see{% endtrans %} <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a>;</li> + <li>{% trans %}if you believe this error 404 should not have occured, please{% endtrans %} + <a href="{{feedback_site_url}}" target="_blank">{% trans %}report this problem{% endtrans %}</a></li> + </u> + </div> + <script type="text/javascript"> + var GOOG_FIXURL_LANG = '{{settings.LANGUAGE_CODE}}'; + var GOOG_FIXURL_SITE = '{{site_url}}'; + </script> + <script type="text/javascript" src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script> + <ul> + <li><a href="#" id="linkPrevious">{% trans %}back to previous page{% endtrans %} »</li> + <li><a href="{% url questions %}">{% trans %}see all questions{% endtrans %} »</a></li> + <li><a href="{% url tags %}">{% trans %}see all tags{% endtrans %} »</a></li> + </u> + </div> +</div> +{% endblock %} +<!-- end template 404.jinja.html --> diff --git a/askbot/skins/default/templates/500.html b/askbot/skins/default/templates/500.html index 51e73178..04d706ec 100644 --- a/askbot/skins/default/templates/500.html +++ b/askbot/skins/default/templates/500.html @@ -1,35 +1,5 @@ -{% extends "base_content.html" %} -<!-- template 500.html --> -{% load i18n %} -{% block title %}{% spaceless %}500 Error{% endspaceless %}{% endblock %} -{% block forejs %} - <script type="text/javascript"> - $().ready(function(){ - $("#linkPrevious").bind("click", back=function(){history.go(-1);}) - }); - - </script> -{% endblock %} -{% block content %} -<div id="main-bar" class=""> - <h3> - 500 Server Error - </h3> - -</div> -<div id="main-body" class="headNormal"> - <div style="padding:5px 0px 10px 0;line-height:25px"> - <h3>{% trans "sorry, system error" %}</h3> - <br/> - {% trans "system error log is recorded, error will be fixed as soon as possible" %}<br/> - {% trans "please report the error to the site administrators if you wish" %} - <ul> - <li><a href="#" id="linkPrevious">{% trans "back to previous page" %}</li> - <li><a href="{% url questions %}">{% trans "see latest questions" %}</a></li> - <li><a href="{% url tags %}">{% trans "see tags" %}</a></li> - </u> - </div> - -</div> -{% endblock %} -<!-- end template 500.html --> +{% load extra_tags %} +{% include_jinja "500.jinja.html" %} +{% comment %}this template must be django +because of the use of default handler500 +{% endcomment %} diff --git a/askbot/skins/default/templates/500.jinja.html b/askbot/skins/default/templates/500.jinja.html new file mode 100644 index 00000000..e353ac2e --- /dev/null +++ b/askbot/skins/default/templates/500.jinja.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} +<!-- template 500.html --> +{% block title %}{% spaceless %}{% trans %}Internal server error{% endtrans %}{% endspaceless %}{% endblock %} +{% block forejs %} + <script type="text/javascript"> + $().ready(function(){ + $("#linkPrevious").bind("click", back=function(){history.go(-1);}) + }); + + </script> +{% endblock %} +{% block content %} +<div id="main-bar" class=""> + <h3>{% trans %}Internal server error{% endtrans %}</h3> +</div> +<div id="main-body" class="headNormal"> + <div style="padding:5px 0px 10px 0;line-height:25px"> + {% trans %}system error log is recorded, error will be fixed as soon as possible{% endtrans %}<br/> + {% trans %}please report the error to the site administrators if you wish{% endtrans %} + <ul> + <li><a href="#" id="linkPrevious">{% trans %}back to previous page{% endtrans %}</li> + <li><a href="{% url questions %}">{% trans %}see latest questions{% endtrans %}</a></li> + <li><a href="{% url tags %}">{% trans %}see tags{% endtrans %}</a></li> + </u> + </div> +</div> +{% endblock %} +<!-- end template 500.html --> diff --git a/askbot/skins/default/templates/about.jinja.html b/askbot/skins/default/templates/about.html index 5e638644..b69eac0a 100644 --- a/askbot/skins/default/templates/about.jinja.html +++ b/askbot/skins/default/templates/about.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template about.html --> {% block title %}{% spaceless %}{% trans %}About{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/answer_edit.html b/askbot/skins/default/templates/answer_edit.html index 03dd8add..a7fc4aca 100644 --- a/askbot/skins/default/templates/answer_edit.html +++ b/askbot/skins/default/templates/answer_edit.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template answer_edit.html --> {% block title %}{% spaceless %}{% trans %}Edit answer{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/ask.html b/askbot/skins/default/templates/ask.html index 64f51d54..109ba6b6 100644 --- a/askbot/skins/default/templates/ask.html +++ b/askbot/skins/default/templates/ask.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template ask.html --> {% block title %}{% spaceless %}{% trans %}Ask a question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/ask_form.html b/askbot/skins/default/templates/ask_form.html index 1bb3866b..2a841a76 100644 --- a/askbot/skins/default/templates/ask_form.html +++ b/askbot/skins/default/templates/ask_form.html @@ -1,20 +1,15 @@ -{% load i18n %} -{% load smart_if %} <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" %}</p> + {% if not request.user.is_authenticated() %} + <p>{% trans %}login to post question info{% endtrans %}</p> {% else %} {% if settings.EMAIL_VALIDATION %} {% if not request.user.email_isvalid %} - {% blocktrans with request.user.email as email %}must have valid {{email}} to post, + {% trans email=request.user.email %}must have valid {{email}} to post, see {{email_validation_faq_url}} - {% endblocktrans %} + {% endtrans %} {% endif %} {% endif %} {% endif %} @@ -27,20 +22,18 @@ {{ 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> <tr> <td> - <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</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> @@ -51,16 +44,16 @@ <span class="form-error"></span> </div> <div class="form-item"> - <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <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"> {{ form.tags.help_text }} </p> - {% if not request.user.is_authenticated %} - <input type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" /> + {% if not request.user.is_authenticated() %} + <input type="submit" value="{% trans %}Login/signup to post your question{% endtrans %}" class="submit" /> {% else %} - <input type="submit" value="{% trans "Ask your question" %}" class="submit" /> + <input type="submit" value="{% trans %}Ask your question{% endtrans %}" class="submit" /> {% endif %} </form> </div> diff --git a/askbot/skins/default/templates/ask_form.jinja.html b/askbot/skins/default/templates/ask_form.jinja.html deleted file mode 100644 index 2a841a76..00000000 --- a/askbot/skins/default/templates/ask_form.jinja.html +++ /dev/null @@ -1,59 +0,0 @@ -<div id="askform"> - <form id="fmask" action="" method="post" > - <div class="form-item"> - <div id="askFormBar"> - {% if not request.user.is_authenticated() %} - <p>{% trans %}login to post question info{% endtrans %}</p> - {% else %} - {% if settings.EMAIL_VALIDATION %} - {% if not request.user.email_isvalid %} - {% trans email=request.user.email %}must have valid {{email}} to post, - see {{email_validation_faq_url}} - {% endtrans %} - {% endif %} - {% endif %} - {% endif %} - <input id="id_title" class="questionTitleInput" name="title" - value="{% if form.initial.title %}{{form.initial.title}}{% endif %}"/> - </div> - {{ form.title.errors }} - <span class="form-error"></span><br/> - <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> - <tr> - <td> - <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> - </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){% endtrans %} <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{% endtrans %}" class="submit" /> - {% else %} - <input type="submit" value="{% trans %}Ask your question{% endtrans %}" class="submit" /> - {% endif %} - </form> -</div> diff --git a/askbot/skins/default/templates/authopenid/changeemail.html b/askbot/skins/default/templates/authopenid/changeemail.html index 94d1881c..a96ea274 100644 --- a/askbot/skins/default/templates/authopenid/changeemail.html +++ b/askbot/skins/default/templates/authopenid/changeemail.html @@ -1,88 +1,80 @@ {% extends "base_content.html" %} -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Change email" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Change email{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} <!-- changeemail.html action_type={{action_type}}--> -{% ifequal action_type "change" %} +{% if action_type=="change" %} <div id="main-bar" class="headNormal"> {% if user.email %} - {% trans "Change email" %} + {% trans %}Change email{% endtrans %} {% else %} - {% trans "Save your email address" %} + {% trans %}Save your email address{% endtrans %} {% endif %} </div> <p class="message"> {% if user.email %} - {% blocktrans %}change {{email}} info{% endblocktrans %} + {% trans %}change {{email}} info{% endtrans %} {% else %} - {% blocktrans %}here is why email is required, see {{gravatar_faq_url}}{% endblocktrans %} + {% trans %}here is why email is required, see {{gravatar_faq_url}}{% endtrans %} {% endif %} </p> {% if msg %} <p class="error">{{ msg }}</p> {% endif %} - <div class="aligned"> <form action="." method="post" accept-charset="utf-8"> {% if next %} <input type="hidden" name="next" value="{{next}}"/> {% endif %} <div class="form-row-vertical"> - <label for="id_email">{% if user.email %}{% trans "Your new Email" %}{% else %}{% trans "Your Email" %}{% endif %}</label> + <label for="id_email">{% if user.email %}{% trans %}Your new Email{% endtrans %}{% else %}{% trans %}Your Email{% endtrans %}{% endif %}</label> {% if form.email.errors %} - <p class="error">{{form.email.errors|join:", "}}</p> + <p class="error">{{form.email.errors|join(", ")}}</p> {% endif %} {{ form.email }} </div> <div class="submit-row"> - <input class="submit" type="submit" name="change_email" value="{% if user.email %}{% trans "Change email" %}{% else %}{% trans "Save Email" %}{% endif %}"> + <input class="submit" type="submit" name="change_email" value="{% if user.email %}{% trans %}Change email{% endtrans %}{% else %}{% trans %}Save Email{% endtrans %}{% endif %}"> {% if user.email %} - <input class="submit" type="submit" name="cancel" value="{% trans "Cancel" %}"> + <input class="submit" type="submit" name="cancel" value="{% trans %}Cancel{% endtrans %}"> {% endif %} </div> - </form> </div> -{% endifequal %} -{% ifequal action_type "validate" %} +{% elif action_type=="validate" %} <div id="main-bar" class="headNormal"> - {% trans "Validate email" %} + {% trans %}Validate email{% endtrans %} </div> <p class="message"> - {% blocktrans %}validate {{email}} info or go to {{change_email_url}}{% endblocktrans %} + {% trans %}validate {{email}} info or go to {{change_email_url}}{% endtrans %} </p> -{% endifequal %} -{% ifequal action_type "keep" %} +{% elif action_type=="keep" %} <div id="main-bar" class="headNormal"> - {% trans "Email not changed" %} + {% trans %}Email not changed{% endtrans %} </div> <p class="message"> - {% blocktrans %}old {{email}} kept, if you like go to {{change_email_url}}{% endblocktrans %} + {% trans %}old {{email}} kept, if you like go to {{change_email_url}}{% endtrans %} </p> -{% endifequal %} -{% ifequal action_type "done_novalidate" %} +{% elif action_type=="done_novalidate" %} <div id="main-bar" class="headNormal"> - {% trans "Email changed" %} + {% trans %}Email changed{% endtrans %} </div> <p class="message"> - {% blocktrans %}your current {{email}} can be used for this{% endblocktrans %} + {% trans %}your current {{email}} can be used for this{% endtrans %} </p> -{% endifequal %} -{% ifequal action_type "validation_complete" %} +{% elif action_type=="validation_complete" %} <div id="main-bar" class="headNormal"> - {% trans "Email verified" %} + {% trans %}Email verified{% endtrans %} </div> <p class="message"> - {% trans "thanks for verifying email" %} + {% trans %}thanks for verifying email{% endtrans %} </p> -{% endifequal %} -{% ifequal action_type "key_not_sent" %} +{% elif action_type=="key_not_sent" %} <div id="main-bar" class="headNormal"> - {% trans "email key not sent" %} + {% trans %}email key not sent{% endtrans %} </div> <p class="message"> - {% blocktrans %}email key not sent {{email}} change email here {{change_link}}{% endblocktrans %} + {% trans %}email key not sent {{email}} change email here {{change_link}}{% endtrans %} </p> -{% endifequal %} +{% endif %} {% endblock %} <!-- end changeemail.html --> diff --git a/askbot/skins/default/templates/authopenid/changeopenid.html b/askbot/skins/default/templates/authopenid/changeopenid.html deleted file mode 100644 index d01788fb..00000000 --- a/askbot/skins/default/templates/authopenid/changeopenid.html +++ /dev/null @@ -1,35 +0,0 @@ -{% extends "base.html" %} -<!-- changeopenid.html --> -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Change OpenID" %}{% endspaceless %}{% endblock %} -{% block content %} -<div id="main-bar" class=""> - <h3> - {% trans "Account: change OpenID URL" %} - </h3> -</div> - -<p>{% blocktrans %}This is where you can change your OpenID URL. Make sure you remember it!{% endblocktrans %}</p> -{% if form.errors %} -<p class="errors">{% trans "Please correct errors below:" %}<br /> - {% if form.openid_url.errors %} - <span class="error">{{ form.openid_url.errors|join:", " }}</span> - {% endif %} - - -</p> -{% endif %} -{% if msg %} - <p class="errors">{{ msg }}</p> -{% endif %} - -<div class="aligned"> - <form action="." method="post" accept-charset="utf-8"> - - <div id="form-row"><label for="id_openid_url">{% trans "OpenID URL:" %}</label>{{ form.openid_url }}</div> - <p><input type="submit" value="{% trans "Change OpenID" %}"></p> - - </form> - </div> -{% endblock %} -<!-- end changeopenid.html --> diff --git a/askbot/skins/default/templates/authopenid/changepw.html b/askbot/skins/default/templates/authopenid/changepw.html deleted file mode 100644 index 8b059544..00000000 --- a/askbot/skins/default/templates/authopenid/changepw.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} -<!-- changepw.html --> -{% load i18n %} -{% block head %}{% endblock %} -{% block title %}{% spaceless %}{% trans "Change password" %}{% endspaceless %}{% endblock %} -{% block content %} -<div class="headNormal">{% trans "Account: change password" %}</div> -<p class="message">{% blocktrans %}This is where you can change your password. Make sure you remember it!{% endblocktrans %}</p> -<div class="aligned"> - <form action="." method="post" accept-charset="utf-8"> - <ul id="changepw-form" class="form-horizontal-rows"> - {{form.as_ul}} - </ul> - <div class="submit-row"><input type="submit" class="submit" value="{% trans "Change password" %}" /></div> - </form> - </div> -{% endblock %} -<!-- end changepw.html --> diff --git a/askbot/skins/default/templates/authopenid/complete.html b/askbot/skins/default/templates/authopenid/complete.html index ad53cd9a..ee5bf241 100644 --- a/askbot/skins/default/templates/authopenid/complete.html +++ b/askbot/skins/default/templates/authopenid/complete.html @@ -1,6 +1,6 @@ {% extends "base_content.html" %} <!-- complete.html --> -{% comment %} +{# views calling this template: * django_authopenid.views.register with login_type='openid' * django_authopenid.views.signin - with login_type='legacy' @@ -16,35 +16,31 @@ parameters: * openid_verify_form - not clear what this form is supposed to do, not used for legacy * email_feeds_form forum.forms.SimpleEmailSubscribeForm * openid_username_exists -{% endcomment %} -{% load i18n %} +#} {% block head %}{% endblock %} -{% block title %}{% spaceless %}{% trans "Connect your OpenID with this site" %}{% endspaceless %}{% endblock %} +{% block title %}{% spaceless %}{% trans %}Connect your OpenID with this site{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} <div id="main-bar" class="headNormal"> - {% trans "Connect your OpenID with your account on this site" %} + {% trans %}Connect your OpenID with your account on this site{% endtrans %} </div> <div id="completetxt" > <div class="message"> - {% ifequal login_type 'openid' %} - {% blocktrans %}register new {{provider}} account info, see {{gravatar_faq_url}}{% endblocktrans %} - {% else %} - {% ifequal login_type 'legacy' %} + {% if login_type=='openid' %} + {% trans %}register new {{provider}} account info, see {{gravatar_faq_url}}{% endtrans %} + {% elif login_type=='legacy' %} {% if external_login_name_is_taken %} - {% blocktrans %}{{username}} already exists, choose another name for + {% trans %}{{username}} already exists, choose another name for {{provider}}. Email is required too, see {{gravatar_faq_url}} - {% endblocktrans %} + {% endtrans %} {% else %} - {% blocktrans %}register new external {{provider}} account info, see {{gravatar_faq_url}}{% endblocktrans %} + {% trans %}register new external {{provider}} account info, see {{gravatar_faq_url}}{% endtrans %} {% endif %} - {% else %} - {% blocktrans %}register new Facebook connect account info, see {{gravatar_faq_url}}{% endblocktrans %} - {% endifequal %} - {% endifequal %} + {% else %} + {% trans %}register new Facebook connect account info, see {{gravatar_faq_url}}{% endtrans %} + {% endif %} </div> - <p style="display:none">{% trans "This account already exists, please use another." %}</p> + <p style="display:none">{% trans %}This account already exists, please use another.{% endtrans %}</p> </div> - {% if openid_register_form.errors %} <ul class="errorlist"> {% if openid_register_form.non_field_errors %} @@ -55,39 +51,37 @@ parameters: </ul> {% endif %} <div class="login"> - {% ifequal login_type 'openid' %} + {% if login_type=='openid' %} <form name="fregister" action="{% url user_register %}" method="POST"> + {% elif login_type=='facebook' %} + <form name="fregister" action="" method="POST"> {% else %} - {% ifequal login_type 'facebook' %} - <form name="fregister" action="" method="POST"> - {% else %} - <form name="fregister" action="{% url user_signin %}" method="POST"> - {% endifequal %} - {% endifequal %} + <form name="fregister" action="{% url user_signin %}" method="POST"> + {% endif %} {{ openid_register_form.next }} <div class="form-row-vertical"> - <label for="id_username">{% trans "Screen name label" %}</label> + <label for="id_username">{% trans %}Screen name label{% endtrans %}</label> {% if openid_register_form.username.errors %} - <p class="error">{{ openid_register_form.username.errors|join:", " }}</p> + <p class="error">{{ openid_register_form.username.errors|join(", ") }}</p> {% endif %} {{ openid_register_form.username }} </div> <div class="form-row-vertical margin-bottom"> - <label for="id_email">{% trans "Email address label" %}</label> + <label for="id_email">{% trans %}Email address label{% endtrans %}</label> {% if openid_register_form.email.errors %} - <p class="error">{{ openid_register_form.email.errors|join:", " }}</p> + <p class="error">{{ openid_register_form.email.errors|join(", ") }}</p> {% endif %} {{ openid_register_form.email }} </div> - <p>{% trans "receive updates motivational blurb" %}</p> + <p>{% trans %}receive updates motivational blurb{% endtrans %}</p> <div class='simple-subscribe-options'> {{email_feeds_form.subscribe}} {% if email_feeds_form.errors %} - <p class="error">{% trans "please select one of the options above" %}</p> + <p class="error">{% trans %}please select one of the options above{% endtrans %}</p> {% endif %} </div> - <p class='space-above'>{% trans "Tag filter tool will be your right panel, once you log in." %}</p> - <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="{% trans "create account" %}"/></div> + <p class='space-above'>{% trans %}Tag filter tool will be your right panel, once you log in.{% endtrans %}</p> + <div class="submit-row"><input type="submit" class="submit" name="bnewaccount" value="{% trans %}create account{% endtrans %}"/></div> </form> </div> {% endblock %} diff --git a/askbot/skins/default/templates/authopenid/confirm_email.txt b/askbot/skins/default/templates/authopenid/confirm_email.txt index 3a01f146..1a0f4e63 100644 --- a/askbot/skins/default/templates/authopenid/confirm_email.txt +++ b/askbot/skins/default/templates/authopenid/confirm_email.txt @@ -1,13 +1,12 @@ -{% load i18n %} -{% trans "Thank you for registering at our Q&A forum!" %} +{% trans %}Thank you for registering at our Q&A forum!{% endtrans %} -{% trans "Your account details are:" %} +{% trans %}Your account details are:{% endtrans %} -{% trans "Username:" %} {{ username }} -{% trans "Password:" %} {{ password }} +{% trans %}Username:{% endtrans %} {{ username }} +{% trans %}Password:{% endtrans %} {{ password }} -{% trans "Please sign in here:" %} +{% trans %}Please sign in here:{% endtrans %} {{signup_url}} -{% blocktrans %}Sincerely, -Forum Administrator{% endblocktrans %} +{% trans %}Sincerely, +Forum Administrator{% endtrans %} diff --git a/askbot/skins/default/templates/authopenid/delete.html b/askbot/skins/default/templates/authopenid/delete.html deleted file mode 100644 index 0f9f1c60..00000000 --- a/askbot/skins/default/templates/authopenid/delete.html +++ /dev/null @@ -1,39 +0,0 @@ -{% extends "base.html" %} -<!-- delete.html --> -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Delete account" %}{% endspaceless %}{% endblock %} -{% block content %} -<div id="main-bar" class=""> - <h3> - {% trans "Account: delete account" %} - </h3> -</div> - -<p class="settings-descr">{% blocktrans %}Note: After deleting your account, anyone will be able to register this username.{% endblocktrans %}</p> -{% if form.errors %} -<p class="errors">{% trans "Please correct errors below:" %}<br /> - {% if form.confirm.errors %} - <span class="error">{% trans "Check confirm box, if you want delete your account." %}</span><br /> - {% endif %} - {% if form.password.errors %} - <span class="error">{% trans "Password:" %} {{ form.password.errors|join:", " }}</span> - {% endif %} -</p> -{% endif %} -{% if msg %} -<p class="errors">{% trans "Please correct errors below:" %}<br /> - <span class="error">{{ msg }}</span> - </p> -{% endif %} -<div class="aligned"> - <form action="." method="post" accept-charset="utf-8"> - - <div id="form-row"> {{ form.confirm }} {% trans "I am sure I want to delete my account." %}</div> - <div id="form-row"><label for="id_password">{% trans "Password/OpenID URL" %}</label>{{ form.password }} {% trans "(required for your security)" %}</div> - - <p><input type="submit" value="{% trans "Delete account permanently" %}"></p> - - </form> - </div> -{% endblock %} -<!-- end delete.html --> diff --git a/askbot/skins/default/templates/authopenid/email_validation.txt b/askbot/skins/default/templates/authopenid/email_validation.txt index 5b166a9b..9c5baa8a 100644 --- a/askbot/skins/default/templates/authopenid/email_validation.txt +++ b/askbot/skins/default/templates/authopenid/email_validation.txt @@ -1,15 +1,14 @@ -{% load i18n %} -{% trans "Greetings from the Q&A forum" %}, +{% trans %}Greetings from the Q&A forum{% endtrans %}, -{% trans "To make use of the Forum, please follow the link below:" %} +{% trans %}To make use of the Forum, please follow the link below:{% endtrans %} {{validation_link}} -{% trans "Following the link above will help us verify your email address." %} +{% trans %}Following the link above will help us verify your email address.{% endtrans %} -{% blocktrans %}If you beleive that this message was sent in mistake - +{% trans %}If you beleive that this message was sent in mistake - no further action is needed. Just ingore this email, we apologize -for any inconvenience{% endblocktrans %} +for any inconvenience{% endtrans %} -{% blocktrans %}Sincerely, -Forum Administrator{% endblocktrans %} +{% trans %}Sincerely, +Forum Administrator{% endtrans %} diff --git a/askbot/skins/default/templates/authopenid/external_legacy_login_info.html b/askbot/skins/default/templates/authopenid/external_legacy_login_info.html deleted file mode 100644 index 3318499c..00000000 --- a/askbot/skins/default/templates/authopenid/external_legacy_login_info.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base_content.html" %} -<!--customize this template--> -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Traditional login information" %}{% endspaceless %}{% endblock %} -{% block content %} -<div class="headNormal"> - {% trans "Traditional login information" %} -</div> -{% spaceless %} -<div class="message"> -<!--add info about your external login site here--> -{% blocktrans %}how to login with password through external login website or use {{feedback_url}}{% endblocktrans %} -</div> -{% endspaceless %} -{% endblock %} diff --git a/askbot/skins/default/templates/authopenid/failure.html b/askbot/skins/default/templates/authopenid/failure.html deleted file mode 100644 index d075d6b0..00000000 --- a/askbot/skins/default/templates/authopenid/failure.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> -<!-- failure.html --> -<html> -<head> - <title>OpenID failed</title> -</head> -<body> -<h1>OpenID failed</h1> - -<p>{{ message|escape }}</p> - -</body> -</html><!-- end failure.html --> diff --git a/askbot/skins/default/templates/authopenid/sendpw_email.txt b/askbot/skins/default/templates/authopenid/sendpw_email.txt deleted file mode 100644 index f044ca45..00000000 --- a/askbot/skins/default/templates/authopenid/sendpw_email.txt +++ /dev/null @@ -1,9 +0,0 @@ -{% load i18n %} -{% blocktrans%}Someone has requested to reset your password on {{site_url}}. -If it were not you, it is safe to ignore this email.{% endblocktrans %} - -{% blocktrans %}email explanation how to use new {{password}} for {{username}} -with the {{key_link}}{% endblocktrans %} - -{% blocktrans %}Sincerely, -Forum Administrator{% endblocktrans %} diff --git a/askbot/skins/default/templates/authopenid/settings.html b/askbot/skins/default/templates/authopenid/settings.html deleted file mode 100644 index 66ea5953..00000000 --- a/askbot/skins/default/templates/authopenid/settings.html +++ /dev/null @@ -1,43 +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> - <dt>» <a href="{% url user_changeemail %}">{% trans "Change email " %}</a></dt> - <dd>{% trans "Add or update the email address associated with your account." %}</dd> - {% if is_openid %} - <dt>» <a href="{% url user_changeopenid %}">{% trans "Change OpenID" %}</a></dt> - <dd>{% trans "Change openid associated to your account" %}</dd> - {% endif %} - - <dt>» <a href="{% url user_delete %}">{% trans "Delete account" %}</a></dt> - <dd>{% trans "Erase your username and all your data from website" %}</dd> - </dl> -</div> -{% endblock %} -<!-- end settings.html --> diff --git a/askbot/skins/default/templates/authopenid/signin.html b/askbot/skins/default/templates/authopenid/signin.html index f3e76bdd..9f81305a 100755..100644 --- a/askbot/skins/default/templates/authopenid/signin.html +++ b/askbot/skins/default/templates/authopenid/signin.html @@ -1,19 +1,16 @@ {% extends "base.html" %}
<!-- signin.html -->
-{% load i18n %}
-{% load extra_tags %}
-{% load smart_if %}
-{% block title %}{% spaceless %}{% trans "User login" %}{% endspaceless %}{% endblock %}
+{% block title %}{% spaceless %}{% trans %}User login{% endtrans %}{% endspaceless %}{% endblock %}
{% block forejs %}
- <link rel="stylesheet" type="text/css" media="screen" href="{% media "/jquery-openid/openid.css" %}"/>
- <script type='text/javascript' src='{% media "/js/jquery.validate.pack.js" %}'></script>
- <script type="text/javascript" src="{% media "/jquery-openid/jquery.openid.js" %}"></script>
+ <link rel="stylesheet" type="text/css" media="screen" href="{{"/jquery-openid/openid.css"|media}}"/>
+ <script type='text/javascript' src='{{"/js/jquery.validate.pack.js"|media}}'></script>
+ <script type="text/javascript" src="{{"/jquery-openid/jquery.openid.js"|media}}"></script>
<script type="text/javascript">
$(document).ready( function() { $("body").authenticator(); })
var extra_token_name = {};
var create_pw_text = {};
var change_pw_text = {};
- var authUrl = '/{% trans "account/" %}';
+ var authUrl = '/{% trans %}account/{% endtrans %}';
var siteName = '{{settings.APP_SHORT_NAME}}';
var provider_count = {{existing_login_methods|length}};
{% for login_provider in major_login_providers %}
@@ -34,7 +31,7 @@ change_pw_text['{{login_provider.name}}'] = '{{login_provider.change_password_prompt}}';
{% endif %}
{% endfor %}
- {% if user.is_authenticated %}
+ {% if user.is_authenticated() %}
var userIsAuthenticated = true;
{% else %}
var userIsAuthenticated = false;
@@ -45,44 +42,42 @@ <h1>{{page_title}}</h1>
{% if answer %}
<div class="message">
- {% blocktrans with answer.question.title as title and answer.summary as summary %}
+ {% trans title=answer.question.title, summary=answer.summary %}
Your answer to {{title}} {{summary}} will be posted once you log in
- {% endblocktrans %}
+ {% endtrans %}
</div>
{% endif %}
{% if question %}
<div class="message">
- {% blocktrans with question.title as title and question.summary as summary %}Your question
+ {% trans title=question.title, summary=question.summary %}Your question
{{title}} {{summary}} will be posted once you log in
- {% endblocktrans %}
+ {% endtrans %}
</div>
{% endif %}
<p id='login-intro'>
{% if view_subtype == 'default' %}
- {% trans "Take a pick of your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one." %}
- {% endif %}
- {% if view_subtype == 'add_openid' %}
+ {% trans %}Take a pick of your favorite service below to sign in using secure OpenID or similar technology. Your external service password always stays confidential and you don't have to rememeber or create another one.{% endtrans %}
+ {% elif view_subtype == 'add_openid' %}
{% if existing_login_methods %}
- {% trans "It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods." %}
+ {% trans %}It's a good idea to make sure that your existing login methods still work, or add a new one. Please click any of the icons below to check/change or add new login methods.{% endtrans %}
{% else %}
- {% trans "Please add a more permanent login method by clicking one of the icons below, to avoid logging in via email each time." %}
+ {% trans %}Please add a more permanent login method by clicking one of the icons below, to avoid logging in via email each time.{% endtrans %}
{% endif %}
- {% endif %}
- {% if view_subtype == 'change_openid' %}
+ {% elif view_subtype == 'change_openid' %}
{% if existing_login_methods %}
- {% trans "Click on one of the icons below to add a new login method or re-validate an existing one." %}
+ {% trans %}Click on one of the icons below to add a new login method or re-validate an existing one.{% endtrans %}
{% else %}
- {% trans "You don't have a method to log in right now, please add one or more by clicking any of the icons below." %}
+ {% trans %}You don't have a method to log in right now, please add one or more by clicking any of the icons below.{% endtrans %}
{% endif %}
- {% endif %}
- {% if view_subtype == 'email_sent' %}
- {% trans "Please check your email and visit the enclosed link to re-connect to your account" %}
+ {% elif view_subtype == 'email_sent' %}
+ {% trans %}Please check your email and visit the enclosed link to re-connect to your account{% endtrans %}
{% endif %}
</p>
{% if openid_error_message %}
<p class="warning">{{ openid_error_message }}</p>
{% endif %}
{% if view_subtype != 'email_sent' and view_subtype != 'bad_key' %}
+ {# in this branch we display the login icons #}
<form id="signin-form" method="post" action="{% url user_signin %}">
{{login_form.login_provider_name}}
<div id="login-icons">
@@ -93,7 +88,7 @@ name="{{login_provider.name}}"
type="image"
class="{{login_provider.type}}"
- src="{% media login_provider.icon_media_path %}"
+ src="{{login_provider.icon_media_path|media}}"
alt="{{login_provider.tooltip_text}}"
title="{{login_provider.tooltip_text}}"
/>
@@ -107,7 +102,7 @@ name="{{login_provider.name}}"
type="image"
class="{{login_provider.type}}"
- src="{% media login_provider.icon_media_path %}"
+ src="{{login_provider.icon_media_path|media}}"
alt="{{login_provider.tooltip_text}}"
title="{{login_provider.tooltip_text}}"
/>
@@ -122,15 +117,15 @@ style="display:none;"
{% endif %}
>
- <h2 id="openid-heading">{% trans "Please enter your <span>user name</span>, then sign in" %}</h2>
- <p class="hint">{% trans "(or select another login method above)" %}</p>
+ <h2 id="openid-heading">{% trans %}Please enter your <span>user name</span>, then sign in{% endtrans %}</h2>
+ <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
<input type="text" name="openid_login_token" />
- <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans "Sign in" %}"/>
+ <input class="submit-b" type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/>
</fieldset>
{% if settings.RECAPTCHA_KEY and settings.RECAPTCHA_SECRET %}
<fieldset
id="password-fs"
- {% if user.is_anonymous %}
+ {% if user.is_anonymous() %}
{% if not login_form.username.errors and not login_form.password_login_failed %}
style="display:none;"
{% endif %}
@@ -141,48 +136,48 @@ {% endif %}
>
{{login_form.password_action}}
- {% if user.is_anonymous %}
+ {% if user.is_anonymous() %}
<h2 id="password-heading">
- {% trans "Please enter your <span>user name and password</span>, then sign in" %}
+ {% trans %}Please enter your <span>user name and password</span>, then sign in{% endtrans %}
</h2>
- <p class="hint">{% trans "(or select another login method above)" %}</p>
+ <p class="hint">{% trans %}(or select another login method above){% endtrans %}</p>
{% if login_form.password_login_failed %}
- <p class="error">{% trans "Login failed, please try again" %}</p>
+ <p class="error">{% trans %}Login failed, please try again{% endtrans %}</p>
{% endif %}
<p>
- <label for="id_username">{% trans "Login name" %}</label>
+ <label for="id_username">{% trans %}Login name{% endtrans %}</label>
{{login_form.username}}
</p>
<p>
- <label for="id_password">{% trans "Password" %}</label>
+ <label for="id_password">{% trans %}Password{% endtrans %}</label>
{{login_form.password}}
</p>
<p id="local_login_buttons">
- <input class="submit-b" name="login_with_password" type="submit" value="{% trans "Login" %}" />
- <a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}">{% trans "Create a password-protected account" %}</a>
+ <input class="submit-b" name="login_with_password" type="submit" value="{% trans %}Login{% endtrans %}" />
+ <a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}">{% trans %}Create a password-protected account{% endtrans %}</a>
</p>
{% else %}
<h2 id="password-heading">
- {% trans "To change your password - please enter the new one twice, then submit" %}
+ {% trans %}To change your password - please enter the new one twice, then submit{% endtrans %}
</h2>
<p>
- <label for="id_new_password">{% trans "New password" %}</label>
+ <label for="id_new_password">{% trans %}New password{% endtrans %}</label>
{{login_form.new_password}}
- <span class="error">{{login_form.new_password.errors.0}}</span>
+ <span class="error">{{login_form.new_password.errors[0]}}</span>
</p>
<p>
- <label for="id_new_password_retyped">{% trans "Please, retype" %}</label>
+ <label for="id_new_password_retyped">{% trans %}Please, retype{% endtrans %}</label>
{{login_form.new_password_retyped}}
- <span class="error">{{login_form.new_password_retyped.errors.0}}</span>
+ <span class="error">{{login_form.new_password_retyped.errors[0]}}</span>
</p>
<p id="local_login_buttons">
- <input class="submit-b" name="change_password" type="submit" value="{% trans "Change password" %}" />
+ <input class="submit-b" name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
</p>
{% endif %}
</fieldset>
{% endif %}
</form>
- {% if user.is_authenticated and existing_login_methods %}
+ {% if user.is_authenticated() and existing_login_methods %}
<div
id='existing-login-methods'
{% if login_form.password_change_failed %}
@@ -190,13 +185,13 @@ {% endif %}
>
<h2 id='ab-show-login-methods'>
- {% trans "Here are your current login methods" %}
+ {% trans %}Here are your current login methods{% endtrans %}
</h2>
<table id='ab-existing-login-methods'>
<tr>
- <th>{% trans "provider" %}</th>
- <th>{% trans "last used" %}</th>
- <th>{% trans "delete, if you like" %}</th>
+ <th>{% trans %}provider{% endtrans %}</th>
+ <th>{% trans %}last used{% endtrans %}</th>
+ <th>{% trans %}delete, if you like{% endtrans %}</th>
</tr>
{% for login_method in existing_login_methods %}
<tr class="ab-provider-row">
@@ -205,11 +200,11 @@ </td>
<td>
{% if login_method.last_used_timestamp %}
- {% diff_date login_method.last_used_timestamp %}
+ {{login_method.last_used_timestamp|diff_date}}
{% endif %}
</td>
<td>
- <button>{% trans "delete" %}</button>
+ <button>{% trans %}delete{% endtrans %}</button>
</td>
</tr>
{% endfor %}
@@ -218,33 +213,33 @@ {% endif %}
{% endif %}
{% if view_subtype != 'email_sent' or view_subtype == 'bad_key' %}
- {% if user.is_anonymous %}
+ {% if user.is_anonymous() %}
<form id="account-recovery-form" action="{% url user_account_recover %}" method="post">
{% if view_subtype != 'bad_key' %}
- <h2 id='account-recovery-heading'>{% trans "Still have trouble signing in?" %}</h2>
+ <h2 id='account-recovery-heading'>{% trans %}Still have trouble signing in?{% endtrans %}</h2>
{% endif %}
<p class="hint">
<span class="text">
{% if view_subtype == 'bad_key' %}
- {% trans "Please, enter your email address below and obtain a new key" %}
+ {% trans %}Please, enter your email address below and obtain a new key{% endtrans %}
{% else %}
- {% trans "Please, enter your email address below to recover your account" %}
+ {% trans %}Please, enter your email address below to recover your account{% endtrans %}
{% endif %}
</span>
- <span style="display:none" class="link"> - <a href="#">{% trans "recover your account via email" %}</a></span>
+ <span style="display:none" class="link"> - <a href="#">{% trans %}recover your account via email{% endtrans %}</a></span>
</p>
<fieldset id='email-input-fs'>
{% if account_recovery_form.email.errors %}
- <p class="error">{{account_recovery_form.email.errors.0}}</p>
+ <p class="error">{{account_recovery_form.email.errors[0]}}</p>
{% endif %}
{{ account_recovery_form.email }}
<input
class="submit-b"
type="submit"
{% if view_subtype == 'bad_key' %}
- value="{% trans "Send a new recovery key" %}"
+ value="{% trans %}Send a new recovery key{% endtrans %}"
{% else %}
- value="{% trans "Recover your account via email" %}"
+ value="{% trans %}Recover your account via email{% endtrans %}"
{% endif %}
/>
</fieldset>
@@ -255,25 +250,24 @@ {% block sidebar %}
<div class="boxC">
- <h3 class="subtitle">{% trans "Why use OpenID?" %}</h3>
+ <h3 class="subtitle">{% trans %}Why use OpenID?{% endtrans %}</h3>
<ul class="list-item">
<li>
- {% trans "with openid it is easier" %}
+ {% trans %}with openid it is easier{% endtrans %}
</li>
<li>
- {% trans "reuse openid" %}
+ {% trans %}reuse openid{% endtrans %}
</li>
<li>
- {% trans "openid is widely adopted" %}
+ {% trans %}openid is widely adopted{% endtrans %}
</li>
<li>
- {% trans "openid is supported open standard" %}
+ {% trans %}openid is supported open standard{% endtrans %}
</li>
-
</ul>
<p class="info-box-follow-up-links">
- <a href="http://openid.net/what/" target="_blank">{% trans "Find out more" %} »</a><br/>
- <a href="http://openid.net/get/" target="_blank">{% trans "Get OpenID" %} »</a>
+ <a href="http://openid.net/what/" target="_blank">{% trans %}Find out more{% endtrans %} »</a><br/>
+ <a href="http://openid.net/get/" target="_blank">{% trans %}Get OpenID{% endtrans %} »</a>
</p>
</div>
{% if settings.FACEBOOK_KEY and settings.FACEBOOK_SECRET %}
diff --git a/askbot/skins/default/templates/authopenid/signup_with_password.html b/askbot/skins/default/templates/authopenid/signup_with_password.html index 009c7592..b14a1270 100644 --- a/askbot/skins/default/templates/authopenid/signup_with_password.html +++ b/askbot/skins/default/templates/authopenid/signup_with_password.html @@ -1,13 +1,11 @@ {% extends "base_content.html" %} <!--signup.html--> -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Signup" %}{% endspaceless %}{% endblock %} - +{% block title %}{% spaceless %}{% trans %}Signup{% endtrans %}{% endspaceless %}{% endblock %} {% block content %} <div class="headNormal"> - {% trans "Create login name and password" %} + {% trans %}Create login name and password{% endtrans %} </div> -<p class="message">{% trans "Traditional signup info" %}</p> +<p class="message">{% trans %}Traditional signup info{% endtrans %}</p> <form action="{% url user_signup_with_password %}" method="post" accept-charset="utf-8"> {{form.login_provider}} <ul class="form-horizontal-rows"> @@ -16,18 +14,18 @@ <li><label for="password1_id">{{form.password1.label}}</label>{{form.password1}}{{form.password1.errors}}</li> <li><label for="password2_id">{{form.password2.label}}</label>{{form.password2}}{{form.password2.errors}}</li> </ul> - <p class="margin-top">{% trans "receive updates motivational blurb" %}</p> + <p class="margin-top">{% trans %}receive updates motivational blurb{% endtrans %}</p> <div class='simple-subscribe-options'> {{email_feeds_form.subscribe}} {% if email_feeds_form.errors %} - <p class="error">{% trans "please select one of the options above" %}</p> + <p class="error">{% trans %}please select one of the options above{% endtrans %}</p> {% endif %} </div> - <p class="signup_p">{% trans "Please read and type in the two words below to help us prevent automated account creation." %}</p> + <p class="signup_p">{% trans %}Please read and type in the two words below to help us prevent automated account creation.{% endtrans %}</p> {{form.recaptcha}} - <div class="submit-row"><input type="submit" class="submit" value="{% trans "Create Account" %}" /> - <strong>{% trans "or" %} - <a href="{% url user_signin %}">{% trans "return to OpenID login" %}</a></strong></div> + <div class="submit-row"><input type="submit" class="submit" value="{% trans %}Create Account{% endtrans %}" /> + <strong>{% trans %}or{% endtrans %} + <a href="{% url user_signin %}">{% trans %}return to OpenID login{% endtrans %}</a></strong></div> </form> {% endblock %} <!--end signup.html--> diff --git a/askbot/skins/default/templates/authopenid/yadis.xrdf b/askbot/skins/default/templates/authopenid/yadis.xrdf deleted file mode 100644 index a9ed44fe..00000000 --- a/askbot/skins/default/templates/authopenid/yadis.xrdf +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<xrds:XRDS - xmlns:xrds='xri://$xrds' - xmlns:openid='http://openid.net/xmlns/1.0' - xmlns='xri://$xrd*($v*2.0)'> - <XRD> - <Service> - <Type>http://specs.openid.net/auth/2.0/return_to</Type> - {% for uri in return_to %} - <URI>{{ uri }}</URI> - {% endfor %} - </Service> - </XRD> -</xrds:XRDS>
\ No newline at end of file diff --git a/askbot/skins/default/templates/badge.html b/askbot/skins/default/templates/badge.html index 322836ad..88ee6db6 100644 --- a/askbot/skins/default/templates/badge.html +++ b/askbot/skins/default/templates/badge.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} {% import "macros.html" as macros %} <!-- template badge.html --> {% block title %}{% spaceless %}{% trans name=badge.name %}{{name}}{% endtrans %} - {% trans %}Badge{% endtrans %}{% endspaceless %}{% endblock %} diff --git a/askbot/skins/default/templates/badges.html b/askbot/skins/default/templates/badges.html index 6e5ef6b6..d9c7fc4f 100644 --- a/askbot/skins/default/templates/badges.html +++ b/askbot/skins/default/templates/badges.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template badges.html --> {% block title %}{% spaceless %}{% trans %}Badges summary{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html index f310b90b..f425304f 100644 --- a/askbot/skins/default/templates/base.html +++ b/askbot/skins/default/templates/base.html @@ -6,20 +6,20 @@ {% load i18n %} <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE }}</title> + <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title> {% spaceless %} {% block meta %}{% endblock %} {% block meta_description %} - <meta name="description" content="{{settings.APP_DESCRIPTION}}" /> + <meta name="description" content="{{settings.APP_DESCRIPTION|escape}}" /> {% endblock %} {% endspaceless %} <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS}}" /> + <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS|escape}}" /> {% if settings.GOOGLE_SITEMAP_CODE %} <meta name="google-site-verification" content="{{settings.GOOGLE_SITEMAP_CODE}}" /> {% endif %} - <link rel="shortcut icon" href="{% media "/images/favicon.gif" %}" /> - <link href="{% media "/style/style.css" %}" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="{{ "/images/favicon.gif"|media }}" /> + <link href="{{"/style/style.css"|media }}" rel="stylesheet" type="text/css" /> <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"> @@ -32,9 +32,9 @@ var enableMathJax = false; {% endif %} </script> - <script type='text/javascript' src='{% media "/js/com.cnprog.i18n.js" %}'></script> - <script type='text/javascript' src='{% media "/js/jquery.i18n.js" %}'></script> - <script type='text/javascript' src='{% media "/js/com.cnprog.utils.js" %}'></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({ @@ -56,7 +56,7 @@ </script> {% endif %} {% if active_tab != "tags" and active_tab != "users" %} - {% comment %}start asking question with title from search query{% endcomment %} + {# start asking question with title from search query #} <script type="text/javascript"> $(document).ready(function(){ $('#nav_ask').click( @@ -69,7 +69,7 @@ ); }); </script> - {% comment %}focus input on the search bar{% endcomment %} + {# focus input on the search bar endcomment #} <script type="text/javascript"> $(document).ready(function() { {% if active_tab != "ask" %} @@ -89,13 +89,11 @@ <body> {% endif %} <div class="notify" style="display:none"> - {% autoescape off %} {% if user_messages %} {% for message in user_messages %} <p class="darkred">{{ message }}</p> {% endfor %} {% endif %} - {% endautoescape %} <a id="close-notify" onclick="notify.close(true)">×</a> </div> {% include "header.html" %} @@ -110,7 +108,6 @@ <div id="CARight"> {% block sidebar%} {% endblock%} - </div> <div id="tail" style="clear:both;"> {% block tail %} diff --git a/askbot/skins/default/templates/base.jinja.html b/askbot/skins/default/templates/base.jinja.html deleted file mode 100644 index 6cf23a26..00000000 --- a/askbot/skins/default/templates/base.jinja.html +++ /dev/null @@ -1,124 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<!-- template base.jinja.html --> -{% load extra_filters %} -{% load extra_tags %} -{% load smart_if %} -{% load i18n %} -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title> - {% spaceless %} - {% block meta %}{% endblock %} - {% block meta_description %} - <meta name="description" content="{{settings.APP_DESCRIPTION|escape}}" /> - {% endblock %} - {% endspaceless %} - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS|escape}}" /> - {% 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" /> - <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() { - $('#validate_email_alert').click(function(){notify.close(true)}) - notify.show(); - }); - </script> - {% endif %} - {% if active_tab != "tags" and active_tab != "users" %} - {# start asking question with title from search query #} - <script type="text/javascript"> - $(document).ready(function(){ - $('#nav_ask').click( - function(){ - var starting_title = $('#keywords').attr('value'); - var new_url = $(this).attr('href') + '?title=' + starting_title; - window.location.href = new_url; - return false; - } - ); - }); - </script> - {# focus input on the search bar endcomment #} - <script type="text/javascript"> - $(document).ready(function() { - {% if active_tab != "ask" %} - $('#keywords').focus(); - {% else %} - $('#id_title').focus(); - {% endif %} - }); - </script> - {% endif %} - {% block forejs %} - {% endblock %} - </head> - {% if page_class %} - <body class="{{page_class}}"> - {% else %} - <body> - {% endif %} - <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="CALeft"> - {% include "input_bar.jinja.html" %} - {% block content%} - {% endblock%} - - </div> - <div id="CARight"> - {% block sidebar%} - {% 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.jinja.html --> diff --git a/askbot/skins/default/templates/base_content.html b/askbot/skins/default/templates/base_content.html index a07dc14d..ff2bfe02 100644 --- a/askbot/skins/default/templates/base_content.html +++ b/askbot/skins/default/templates/base_content.html @@ -1,20 +1,18 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- base_content.html --> -{% load i18n %} -{% load extra_tags %} <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE }}</title> + <title>{% block title %}{% endblock %} - {{ settings.APP_TITLE|escape }}</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS}}" /> + <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS|escape}}" /> {% block meta_description %} - <meta name="description" content="{{settings.APP_DESCRIPTION}}" /> + <meta name="description" content="{{settings.APP_DESCRIPTION|escape}}" /> {% endblock %} {% if settings.GOOGLE_SITEMAP_CODE %} <meta name="google-site-verification" content="{{ settings.GOOGLE_SITEMAP_CODE }}" /> {% endif %} - <link rel="shortcut icon" href="{% media "/images/favicon.gif" %}" /> - <link href="{% media "/style/style.css" %}" rel="stylesheet" type="text/css" /> + <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 %} @@ -30,9 +28,9 @@ var enableMathJax = false; {% endif %} </script> - <script type='text/javascript' src='{% media "/js/com.cnprog.i18n.js" %}'></script> - <script type='text/javascript' src='{% media "/js/jquery.i18n.js" %}'></script> - <script type='text/javascript' src='{% media "/js/com.cnprog.utils.js" %}'></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({ @@ -54,19 +52,16 @@ }); </script> {% endif %} - {% block forejs %} {% endblock %} </head> <body> <div class="notify" style="display:none"> - {% autoescape off %} {% if user_messages %} {% for message in user_messages %} <p class="darkred">{{ message }}</p> {% endfor %} {% endif %} - {% endautoescape %} <a id="close-notify" onclick="notify.close(true)">×</a> </div> {% include "header.html" %} @@ -76,7 +71,6 @@ {% include "input_bar.html" %} {% block content%} {% endblock%} - </div> <div id="tail" style="clear:both;"> {% block tail %} diff --git a/askbot/skins/default/templates/base_content.jinja.html b/askbot/skins/default/templates/base_content.jinja.html deleted file mode 100644 index a2895c33..00000000 --- a/askbot/skins/default/templates/base_content.jinja.html +++ /dev/null @@ -1,87 +0,0 @@ -<!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|escape }}</title> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta name="keywords" content="{%block keywords%}{%endblock%},{{settings.APP_KEYWORDS|escape}}" /> - {% block meta_description %} - <meta name="description" content="{{settings.APP_DESCRIPTION|escape}}" /> - {% 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/close.html b/askbot/skins/default/templates/close.html index 0f113876..eddf84f0 100644 --- a/askbot/skins/default/templates/close.html +++ b/askbot/skins/default/templates/close.html @@ -1,4 +1,4 @@ -{% extends "base_content.jinja.html" %} +{% extends "base_content.html" %} <!-- template close.html --> {% block title %}{% spaceless %}{% trans %}Close question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/faq.html b/askbot/skins/default/templates/faq.html index 74c9aefd..2c1dcfcc 100644 --- a/askbot/skins/default/templates/faq.html +++ b/askbot/skins/default/templates/faq.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template faq.html --> {% block title %}{% spaceless %}{% trans %}FAQ{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/fbconnect/xd_receiver.html b/askbot/skins/default/templates/fbconnect/xd_receiver.html deleted file mode 100755 index 60c02a22..00000000 --- a/askbot/skins/default/templates/fbconnect/xd_receiver.html +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" >
-{% load i18n %}
- <head>
- <title>{% blocktrans %}Connect to {{settings.APP_SHORT_NAME}} with Facebook!{% endblocktrans %}
- </head>
- <body>
- <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
- </body>
-</html>
diff --git a/askbot/skins/default/templates/feedback.html b/askbot/skins/default/templates/feedback.html index 8b76fbd7..ee381679 100644 --- a/askbot/skins/default/templates/feedback.html +++ b/askbot/skins/default/templates/feedback.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- template feedback.html --> {% block title %}{% spaceless %}{% trans %}Feedback{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/feeds/rss_description.html b/askbot/skins/default/templates/feeds/rss_description.html deleted file mode 100755 index fa781907..00000000 --- a/askbot/skins/default/templates/feeds/rss_description.html +++ /dev/null @@ -1 +0,0 @@ -{{ obj.html|safe }}
\ No newline at end of file diff --git a/askbot/skins/default/templates/feeds/rss_title.html b/askbot/skins/default/templates/feeds/rss_title.html deleted file mode 100755 index 7899fce3..00000000 --- a/askbot/skins/default/templates/feeds/rss_title.html +++ /dev/null @@ -1 +0,0 @@ -{{ obj.title }}
\ No newline at end of file diff --git a/askbot/skins/default/templates/footer.html b/askbot/skins/default/templates/footer.html index 58989f36..b57e0fbb 100644 --- a/askbot/skins/default/templates/footer.html +++ b/askbot/skins/default/templates/footer.html @@ -1,48 +1,44 @@ <!-- template footer.html --> -{% load extra_tags %} -{% load i18n %} -<!-- 页面底部开始: --> - <div id="ground"> - <div> - <div class="footerLinks" > - <a href="{% url about %}">{% trans "about" %}</a><span class="link-separator"> |</span> - <a href="{% url faq %}">{% trans "faq" %}</a><span class="link-separator"> |</span> - <a href="{% url privacy %}">{% trans "privacy policy" %}</a><span class="link-separator"> |</span> - {% spaceless %} - <a href= - {% if settings.FEEDBACK_SITE_URL %} - "{{settings.FEEDBACK_SITE_URL}}" - target="_blank"> - {% else %} - "{% url feedback %}?next={{request.path}}"> - {% endif %} - {% trans "give feedback" %} - </a> - {% endspaceless %} - </div> - <p> - <a href="http://askbot.org" target="_blank"> - powered by ASKBOT - </a><br/>{{settings.APP_COPYRIGHT}} - </p> - </div> - <div id="licenseLogo"> - <a href="http://creativecommons.org/licenses/by/3.0/"> - <img src="{% media "/images/cc-wiki.png" %}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /> - </a> - </div> - </div> - <!-- 页面底部结束: --> - {% if settings.GOOGLE_ANALYTICS_KEY %} - <script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); - </script> - <script type="text/javascript"> - try { - var pageTracker = _gat._getTracker('{{ settings.GOOGLE_ANALYTICS_KEY }}'); - pageTracker._trackPageview(); - } catch(err) {} +<div id="ground"> + <div> + <div class="footerLinks" > + <a href="{% url about %}">{% trans %}about{% endtrans %}</a><span class="link-separator"> |</span> + <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a><span class="link-separator"> |</span> + <a href="{% url privacy %}">{% trans %}privacy policy{% endtrans %}</a><span class="link-separator"> |</span> + {% spaceless %} + <a href= + {% if settings.FEEDBACK_SITE_URL %} + "{{settings.FEEDBACK_SITE_URL}}" + target="_blank"> + {% else %} + "{% url feedback %}?next={{request.path}}"> + {% endif %} + {% trans %}give feedback{% endtrans %} + </a> + {% endspaceless %} + </div> + <p> + <a href="http://askbot.org" target="_blank"> + powered by ASKBOT + </a><br/>{{settings.APP_COPYRIGHT}} + </p> + </div> + <div id="licenseLogo"> + <a href="http://creativecommons.org/licenses/by/3.0/"> + <img src="{{"/images/cc-wiki.png"|media }}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /> + </a> + </div> +</div> +{% if settings.GOOGLE_ANALYTICS_KEY %} +<script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> - {% endif %} + <script type="text/javascript"> + try { + var pageTracker = _gat._getTracker('{{ settings.GOOGLE_ANALYTICS_KEY }}'); + pageTracker._trackPageview(); + } catch(err) {} +</script> +{% endif %} <!-- end template footer.html --> diff --git a/askbot/skins/default/templates/footer.jinja.html b/askbot/skins/default/templates/footer.jinja.html deleted file mode 100644 index 5ed39eb3..00000000 --- a/askbot/skins/default/templates/footer.jinja.html +++ /dev/null @@ -1,44 +0,0 @@ -<!-- template footer.jinja.html --> -<div id="ground"> - <div> - <div class="footerLinks" > - <a href="{% url about %}">{% trans %}about{% endtrans %}</a><span class="link-separator"> |</span> - <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a><span class="link-separator"> |</span> - <a href="{% url privacy %}">{% trans %}privacy policy{% endtrans %}</a><span class="link-separator"> |</span> - {% spaceless %} - <a href= - {% if settings.FEEDBACK_SITE_URL %} - "{{settings.FEEDBACK_SITE_URL}}" - target="_blank"> - {% else %} - "{% url feedback %}?next={{request.path}}"> - {% endif %} - {% trans %}give feedback{% endtrans %} - </a> - {% endspaceless %} - </div> - <p> - <a href="http://askbot.org" target="_blank"> - powered by ASKBOT - </a><br/>{{settings.APP_COPYRIGHT}} - </p> - </div> - <div id="licenseLogo"> - <a href="http://creativecommons.org/licenses/by/3.0/"> - <img src="{{"/images/cc-wiki.png"|media }}" title="Creative Commons: Attribution - Share Alike" alt="cc-wiki" width="50" height="68" /> - </a> - </div> -</div> -{% if settings.GOOGLE_ANALYTICS_KEY %} -<script type="text/javascript"> - var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); - document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); - </script> - <script type="text/javascript"> - try { - var pageTracker = _gat._getTracker('{{ settings.GOOGLE_ANALYTICS_KEY }}'); - pageTracker._trackPageview(); - } catch(err) {} -</script> -{% endif %} -<!-- end template footer.jinja.html --> diff --git a/askbot/skins/default/templates/header.html b/askbot/skins/default/templates/header.html index 11ca38f8..4c280acc 100644 --- a/askbot/skins/default/templates/header.html +++ b/askbot/skins/default/templates/header.html @@ -1,35 +1,33 @@ <!-- template header.html --> -{% load extra_tags %} -{% load smart_if %} -{% load i18n %} +{% import "macros.html" as macros %} <div id="roof"> <div id="navBar"> <div id="top"> - {% if request.user.is_authenticated %} - <a href="{% url user_profile id=request.user.id,slug=request.user.username|slugify %}">{{ request.user.username }}</a> + {% if request.user.is_authenticated() %} + <a href="{{ request.user.get_absolute_url() }}">{{ request.user.username }}</a> {% spaceless %} - <a class='ab-responses-envelope' href="{{request.user.get_absolute_url}}?sort=responses"> + <a class='ab-responses-envelope' href="{{request.user.get_absolute_url()}}?sort=responses"> <img - alt="{%blocktrans with request.user.username as username %}responses for {{username}}{% endblocktrans %}" + alt="{% trans username=request.user.username %}responses for {{username}}{% endtrans %}" {% if request.user.response_count > 0 %} - src="{% media "/images/mail-envelope-full.png" %}" - title="{% blocktrans count request.user.response_count as response_count %}you have a new response{% plural %}you nave {{response_count}} new responses{% endblocktrans %}" + src="{{ "/images/mail-envelope-full.png"|media }}" + title="{% trans response_count=request.user.response %}you have a new response{% pluralize %}you nave {{response_count}} new responses{% endtrans %}" {% else %} - src="{% media "/images/mail-envelope-empty.png" %}" - title="{% trans "no new responses yet" %}" + src="{{ "/images/mail-envelope-empty.png"|media }}" + title="{% trans %}no new responses yet{% endtrans %}" {% endif %} /> </a> {% endspaceless %} - ({% get_long_score_and_badge_report user %}) - <a href="{% url logout %}">{% trans "logout" %}</a> + ({{ macros.user_long_score_and_badge_summary(user) }}) + <a href="{% url logout %}">{% trans %}logout{% endtrans %}</a> {% else %} - <a href="{% url user_signin %}">{% trans "login" %}</a> + <a href="{% url user_signin %}">{% trans %}login{% endtrans %}</a> {% endif %} - <a href="{% url about %}">{% trans "about" %}</a> - <a href="{% url faq %}">{% trans "faq" %}</a> + <a href="{% url about %}">{% trans %}about{% endtrans %}</a> + <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a> {% if request.user.is_administrator %} - <a href="{% url site_settings %}">{% trans "settings" %}</a> + <a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a> {% endif %} </div> <table border="0" cellspacing="0" cellpadding="0"> @@ -37,16 +35,18 @@ <td id="logoContainer"> <div id="logo"> <a href="{% url questions %}?start_over=true"><img - src="{% media settings.SITE_LOGO_URL %}" title="{% trans "back to home page" %}" alt="{{settings.APP_TITLE}} logo"/></a> + src="{{ settings.SITE_LOGO_URL|media }}" + title="{% trans %}back to home page{% endtrans %}" + alt="{% trans site=settings.APP_SHORT_NAME %}{{site}} logo{% endtrans %}"/></a> </div> </td> <td id="navTabContainer" valign="bottom" align="left"> <div class="nav"> - <a id="nav_questions" href="{% url questions %}" >{% trans "questions" %}</a> - <a id="nav_tags" href="{% url tags %}">{% trans "tags" %}</a> - <a id="nav_users" href="{% url users %}">{% trans "users" %}</a> - <a id="nav_badges" href="{% url badges %}">{% trans "badges" %}</a> - <a id="nav_ask" href="{% url ask %}" class="special">{% trans "ask a question" %}</a> + <a id="nav_questions" href="{% url questions %}" >{% trans %}questions{% endtrans %}</a> + <a id="nav_tags" href="{% url tags %}">{% trans %}tags{% endtrans %}</a> + <a id="nav_users" href="{% url users %}">{% trans %}users{% endtrans %}</a> + <a id="nav_badges" href="{% url badges %}">{% trans %}badges{% endtrans %}</a> + <a id="nav_ask" href="{% url ask %}" class="special">{% trans %}ask a question{% endtrans %}</a> </div> </td> </tr> diff --git a/askbot/skins/default/templates/header.jinja.html b/askbot/skins/default/templates/header.jinja.html deleted file mode 100644 index 7c2da527..00000000 --- a/askbot/skins/default/templates/header.jinja.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- template header.jinja.html --> -{% import "macros.html" as macros %} -<div id="roof"> - <div id="navBar"> - <div id="top"> - {% if request.user.is_authenticated() %} - <a href="{{ request.user.get_absolute_url() }}">{{ request.user.username }}</a> - {% spaceless %} - <a class='ab-responses-envelope' href="{{request.user.get_absolute_url()}}?sort=responses"> - <img - alt="{% trans username=request.user.username %}responses for {{username}}{% endtrans %}" - {% if request.user.response_count > 0 %} - src="{{ "/images/mail-envelope-full.png"|media }}" - title="{% trans response_count=request.user.response %}you have a new response{% pluralize %}you nave {{response_count}} new responses{% endtrans %}" - {% else %} - src="{{ "/images/mail-envelope-empty.png"|media }}" - title="{% trans %}no new responses yet{% endtrans %}" - {% endif %} - /> - </a> - {% endspaceless %} - ({{ macros.user_long_score_and_badge_summary(user) }}) - <a href="{% url logout %}">{% trans %}logout{% endtrans %}</a> - {% else %} - <a href="{% url user_signin %}">{% trans %}login{% endtrans %}</a> - {% endif %} - <a href="{% url about %}">{% trans %}about{% endtrans %}</a> - <a href="{% url faq %}">{% trans %}faq{% endtrans %}</a> - {% if request.user.is_administrator %} - <a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a> - {% endif %} - </div> - <table border="0" cellspacing="0" cellpadding="0"> - <tr> - <td id="logoContainer"> - <div id="logo"> - <a href="{% url questions %}?start_over=true"><img - src="{{ settings.SITE_LOGO_URL|media }}" - title="{% trans %}back to home page{% endtrans %}" - alt="{% trans site=settings.APP_SHORT_NAME %}{{site}} logo{% endtrans %}"/></a> - </div> - </td> - <td id="navTabContainer" valign="bottom" align="left"> - <div class="nav"> - <a id="nav_questions" href="{% url questions %}" >{% trans %}questions{% endtrans %}</a> - <a id="nav_tags" href="{% url tags %}">{% trans %}tags{% endtrans %}</a> - <a id="nav_users" href="{% url users %}">{% trans %}users{% endtrans %}</a> - <a id="nav_badges" href="{% url badges %}">{% trans %}badges{% endtrans %}</a> - <a id="nav_ask" href="{% url ask %}" class="special">{% trans %}ask a question{% endtrans %}</a> - </div> - </td> - </tr> - </table> - </div> -</div> -<!-- end template header.html --> diff --git a/askbot/skins/default/templates/html.list b/askbot/skins/default/templates/html.list index ddb3f444..1f2c46c8 100644 --- a/askbot/skins/default/templates/html.list +++ b/askbot/skins/default/templates/html.list @@ -1,24 +1,24 @@ -==todo== -question_retag.html - todo debug +==TODO== +yadis.xrdf - inline into .py file +signup_with_password.html - create password protected account - a variation of complete.html + +==not used yet, but are linked to in code== +confirm_email.txt - new user greeting - not used yet +email_validation.txt - not used now +changeemail.html - used only is EMAIL_VALIDATION == True, but the setting is disabled now + +==done== +authopenid/signin.html - main signin template +authopenid/complete.html - main registration template 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 -questions_ajax.html -question_summary_list_roll.html -user_favorites.html -users_questions.html -user_footer.html +question_retag.html +paginator.html user_responses.html +users_questions.html users.html - -==done== +user_favorites.html +user_recent.html user_info.html user_reputation.html user_moderate.html @@ -31,13 +31,13 @@ revisions.html reopen.html question_edit.html privacy.html -tag_selector.jinja.html -questions.jinja.html -ask_form.jinja.html -base.jinja.html -footer.jinja.html -header.jinja.html -input_bar.jinja.html +tag_selector..html +questions..html +ask_form..html +base..html +footer..html +header..html +input_bar..html answer_edit_tips.html answer_edit.html ask.html @@ -53,3 +53,4 @@ instant_notification.html macros.html question_edit_tips.html question.html + diff --git a/askbot/skins/default/templates/input_bar.html b/askbot/skins/default/templates/input_bar.html index 1ba11848..c3453955 100644 --- a/askbot/skins/default/templates/input_bar.html +++ b/askbot/skins/default/templates/input_bar.html @@ -1,9 +1,7 @@ -{% load i18n %} -{% load smart_if %} {% if active_tab != "ask" %} {% spaceless %} <div id="searchBar"> - {% comment %}url action depends on which tab is active{% endcomment %} + {# url action depends on which tab is active #} <form {% if active_tab == "tags" or active_tab == "users" %} action="{% url search %}" @@ -11,7 +9,7 @@ action="{% url questions %}" {% endif %} method="get"> - {% comment %} class was searchInput {% endcomment %} + {# class was searchInput #} <input {% if query %} class="searchInputCancelable" @@ -20,18 +18,18 @@ {% endif %} type="text" autocomplete="off" - value="{{ query|default_if_none:"" }}" + value="{{ query|default_if_none('') }}" name="query" id="keywords"/> - {% if query %}{% comment %}query is only defined by questions view{% endcomment %} + {% if query %}{# query is only defined by questions view #} <input type="button" value="x" name="reset_query" - {% comment %}todo - make sure it works on Enter keypress{% endcomment %} + {# todo - make sure it works on Enter keypress #} onclick="window.location.href='{% url questions %}?reset_query=true'" class="cancelSearchBtn"/> {% endif %} - <input type="submit" value="{% trans "search" %}" name="search" class="searchBtn" /> + <input type="submit" value="{% trans %}search{% endtrans %}" name="search" class="searchBtn" /> {% if active_tab == "tags" %} <input type="hidden" name="t" value="tag"/> {% else %} diff --git a/askbot/skins/default/templates/input_bar.jinja.html b/askbot/skins/default/templates/input_bar.jinja.html deleted file mode 100644 index e9f759ba..00000000 --- a/askbot/skins/default/templates/input_bar.jinja.html +++ /dev/null @@ -1,45 +0,0 @@ -{% if active_tab != "ask" %} -{% spaceless %} -<div id="searchBar"> - {# url action depends on which tab is active #} - <form - {% if active_tab == "tags" or active_tab == "users" %} - action="{% url search %}" - {% else %} - action="{% url questions %}" - {% endif %} - method="get"> - {# class was searchInput #} - <input - {% if query %} - class="searchInputCancelable" - {% else %} - class="searchInput" - {% endif %} - type="text" - autocomplete="off" - value="{{ query|default_if_none('') }}" - name="query" - id="keywords"/> - {% if query %}{# query is only defined by questions view #} - <input type="button" - value="x" - name="reset_query" - {# todo - make sure it works on Enter keypress #} - onclick="window.location.href='{% url questions %}?reset_query=true'" - class="cancelSearchBtn"/> - {% endif %} - <input type="submit" value="{% trans %}search{% endtrans %}" name="search" class="searchBtn" /> - {% if active_tab == "tags" %} - <input type="hidden" name="t" value="tag"/> - {% else %} - {% if active_tab == "users" %} - <input type="hidden" name="t" value="user"/> - {% endif %} - {% endif %} - </form> -</div> -{% endspaceless %} -{% else %} - {% include "ask_form.jinja.html" %} -{% endif %} diff --git a/askbot/skins/default/templates/logout.html b/askbot/skins/default/templates/logout.html index 297e1862..067fec2e 100644 --- a/askbot/skins/default/templates/logout.html +++ b/askbot/skins/default/templates/logout.html @@ -1,4 +1,4 @@ -{% extends "base_content.jinja.html" %} +{% extends "base_content.html" %} <!-- template logout.html --> {% block title %}{% spaceless %}{% trans %}Logout{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/paginator.html b/askbot/skins/default/templates/paginator.html index 4c1f55b0..9782407f 100644 --- a/askbot/skins/default/templates/paginator.html +++ b/askbot/skins/default/templates/paginator.html @@ -1,38 +1,4 @@ <!-- paginator.html --> -{% spaceless %} -{% load i18n %} -{% if is_paginated %} -<div class="paginator"> -{% if has_previous %}<span class="prev"><a href="{{base_url}}page={{ previous }}{{ extend_url }}" title="{% trans "previous" %}"> -« {% trans "previous" %}</a></span>{% endif %} -{% if not in_leading_range %} - {% for num in pages_outside_trailing_range %} - <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" >{{ num }}</a></span> - {% endfor %} - ... -{% endif %} - -{% for num in page_numbers %} - {% ifequal num page %} - {% ifequal pages 1 %} - {% else %} - <span class="curr" title="{% trans "current page" %}">{{ num }}</span> - {% endifequal %} - {% else %} - <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="{% blocktrans %}page number {{num}}{% endblocktrans %}">{{ num }}</a></span> - {% endifequal %} -{% endfor %} - -{% if not in_trailing_range %} - ... - {% for num in pages_outside_leading_range reversed %} - <span class="page"><a href="{{base_url}}page={{ num }}{{ extend_url }}" title="{% blocktrans %}page number {{ num }}{% endblocktrans %}">{{ num }}</a></span> - {% endfor %} -{% endif %} - -{% if has_next %}<span class="next"><a href="{{base_url}}page={{ next }}{{ extend_url }}" title="{% trans "next page" %}">{% trans "next page" %} »</a></span>{% endif %} -</div> -{% endif %} - -{% endspaceless %} +{% import "macros.html" as macros %} +{{ macros.paginator(paginator_context)}} <!-- end paginator.html --> diff --git a/askbot/skins/default/templates/privacy.html b/askbot/skins/default/templates/privacy.html index 309a5c68..de6ff879 100644 --- a/askbot/skins/default/templates/privacy.html +++ b/askbot/skins/default/templates/privacy.html @@ -1,4 +1,4 @@ -{% extends "base_content.jinja.html" %} +{% extends "base_content.html" %} <!-- privacy.html --> {% block title %}{% spaceless %}{% trans %}Privacy policy{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index a79e687f..66359f6d 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} {% import "macros.html" as macros %} <!-- question.html --> {% block title %}{% spaceless %}{{ question.get_question_title() }}{% endspaceless %}{% endblock %} @@ -143,12 +143,10 @@ <span class="action-link"> <a href="{% url edit_question question.id %}">{% trans %}edit{% endtrans %}</a> </span> - {% else %} - {% if request.user|can_retag_question(question) %} + {% elif request.user|can_retag_question(question) %} <span class="action-link"> <a href="{% url retag_question question.id %}">{% trans %}retag{% endtrans %}</a> </span> - {% endif %} {% endif %} {% if question.closed %} {% if request.user|can_reopen_question(question) %}{{ pipe() }} diff --git a/askbot/skins/default/templates/question_counter_widget.html b/askbot/skins/default/templates/question_counter_widget.html deleted file mode 100644 index 5b35651f..00000000 --- a/askbot/skins/default/templates/question_counter_widget.html +++ /dev/null @@ -1,47 +0,0 @@ -{% load extra_filters %} -{% load i18n %} -<div class="counts"> - <div class="votes" - style="background:{{votes_bg}};color:{{votes_fg}}" - title="{% trans "Please decide if you like this question or not by voting" %}"> - {% spaceless %} - <div class="item-count"> - {{question.score|humanize_counter}} - </div> - <div> - {% blocktrans count question.score as cnt %} - vote - {% plural %} - votes - {% endblocktrans %} - </div> - {% endspaceless %} - </div > - {% comment %} - <div {% if question.answer_accepted %}title="{% trans "this 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 %}"> - {% endcomment %} - <div class="votes" style="background:{{answers_bg}};color:{{answers_fg}}"> - <div class="item-count">{{question.answer_count|humanize_counter}}</div> - {% spaceless %} - <div> - {% blocktrans count question.answer_count as cnt %} - answer - {% plural %} - answers - {% endblocktrans %} - </div> - {% endspaceless %} - </div> - <div class="views" style="background:{{views_bg}};color:{{views_fg}}"> - {% spaceless %} - <div class="item-count">{{question.view_count|humanize_counter}}</div> - <div> - {% blocktrans count question.view_count as cnt %} - view - {% plural %} - views - {% endblocktrans %} - </div> - {% endspaceless %} - </div> -</div> diff --git a/askbot/skins/default/templates/question_edit.html b/askbot/skins/default/templates/question_edit.html index 7a01b48e..23cf3dcf 100644 --- a/askbot/skins/default/templates/question_edit.html +++ b/askbot/skins/default/templates/question_edit.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- question_edit.html --> {% block title %}{% spaceless %}{% trans %}Edit question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/question_retag.html b/askbot/skins/default/templates/question_retag.html index 90eaef37..df3a1b1f 100644 --- a/askbot/skins/default/templates/question_retag.html +++ b/askbot/skins/default/templates/question_retag.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- question_retag.html --> {% block title %}{% spaceless %}{% trans %}Change tags{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} @@ -73,13 +73,14 @@ <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> </form> </div> +</div> {% endblock %} {% block sidebar %} <div class="boxC"> - <p class="subtitle">{% trans %}Why use and modify tags?{% endtrans %}</p> + <h3>{% trans %}Why use and modify tags?{% endtrans %}</h3> <ul class="list-item"> - <li> + <li>{% trans %}Tags help to keep the content better organized and searchable{% endtrans %}</li> <li> {% trans %}tag editors receive special awards from the community{% endtrans %} </li> diff --git a/askbot/skins/default/templates/questions.html b/askbot/skins/default/templates/questions.html index fffd20db..6563e772 100644 --- a/askbot/skins/default/templates/questions.html +++ b/askbot/skins/default/templates/questions.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- questions.html --> {% import "macros.html" as macros %} {% block title %}{% spaceless %}{% trans %}Questions{% endtrans %}{% endspaceless %}{% endblock %} @@ -281,7 +281,7 @@ {% endif %} {% if request.user.is_authenticated() %} - {% include "tag_selector.jinja.html" %} + {% include "tag_selector.html" %} {% endif %} {% if tags %} diff --git a/askbot/skins/default/templates/reopen.html b/askbot/skins/default/templates/reopen.html index a2617150..0f859eee 100644 --- a/askbot/skins/default/templates/reopen.html +++ b/askbot/skins/default/templates/reopen.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} <!-- reopen.html --> {% block title %}{% spaceless %}{% trans %}Reopen question{% endtrans %}{% endspaceless %}{% endblock %} {% block forejs %} diff --git a/askbot/skins/default/templates/revisions.html b/askbot/skins/default/templates/revisions.html index 0ed0e959..d5884dfc 100644 --- a/askbot/skins/default/templates/revisions.html +++ b/askbot/skins/default/templates/revisions.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} {% import "macros.html" as macros %} <!-- revisions.html --> {% block title %}{% spaceless %}{% trans %}Revision history{% endtrans %}{% endspaceless %}{% endblock %} diff --git a/askbot/skins/default/templates/revisions_question.html b/askbot/skins/default/templates/revisions_question.html deleted file mode 100644 index 4c9153c5..00000000 --- a/askbot/skins/default/templates/revisions_question.html +++ /dev/null @@ -1,83 +0,0 @@ -{% extends "base_content.html" %} -<!-- revisions_question.html --> -<!--somehow very similar to revisions_answer.html--> -{% load extra_tags %} -{% load i18n %} -{% load extra_filters %} -{% load humanize %} -{% block title %}{% spaceless %}{% trans "Revision history" %}{% 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"> - //todo - take this out into .js file - $().ready(function(){ - $("#nav_questions").attr('className',"on"); - $('div.revision div[id^=rev-header-]').bind('click', function(){ - var revId = this.id.substr(11); - toggleRev(revId); - - }); - lanai.highlightSyntax(); - }); - - function toggleRev(id) { - var arrow = $("#rev-arrow-" + id); - var visible = arrow.attr("src").indexOf("hide") > -1; - - var path = $.i18n._('/') + "media/images/expander-arrow-" + - (visible ? "show" : "hide") + ".gif" + "?v={{settings.MEDIA_RESOURCE_REVISION}}"; - arrow.attr("src", path); - $("#rev-body-" + id).slideToggle("fast"); - } - </script> -{% endblock %} - -{% block content %} -<div id="main-bar" class="headNormal"> - {% trans "Revision history" %}[<a href="{{ post.get_absolute_url }}">{% trans "back" %}</a>] -</div> -<div id="main-body" class=""> - <div id="revisions"> - {% for revision in revisions %} - <div class="revision"> - <div id="rev-header-{{ revision.revision }}" class="header {% ifequal post.author_id revision.author_id %}author{% endifequal %}"> - <div class="header-controls"> - <table width="100%"> - <tr> - <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" - src="{% media "/images/expander-arrow-show.gif" %}" - alt="{% trans "click to hide/show revision" %}"/> - </td> - <td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.revision }}">{{ revision.revision }}</span></td> - <td width="200px" style="vertical-align:middle"> - {% if revision.summary %} - <div class="summary"><span>{{ revision.summary }}</span></div> - {% endif %} - {% if request.user|can_edit_post:post %} - <a href="{% url edit_question post.id %}?revision={{ revision.revision }}">{% trans "edit" %}</a> - {% endif %} - - </td> - <td align="right"> - <div class="revision-mark" > - {% post_contributor_info revision %} - </div> - </td> - </tr> - - </table> - </div> - </div> - <div id="rev-body-{{ revision.revision }}" class="diff body"> - {{ revision.diff|safe }} - </div> - </div> - {% endfor %} - </div> -</div> -{% endblock %} - -{% block endjs %} -{% endblock %} -<!-- end revisions_question.html --> diff --git a/askbot/skins/default/templates/tag_selector.html b/askbot/skins/default/templates/tag_selector.html index 2dd30f51..6f6b8dc6 100644 --- a/askbot/skins/default/templates/tag_selector.html +++ b/askbot/skins/default/templates/tag_selector.html @@ -1,43 +1,41 @@ -{% load i18n %} -{% load extra_tags %} -{% comment %}todo - maybe disable navigation from ignored tags here when "hide" is on - with js?{%endcomment%} +{# todo - maybe disable navigation from ignored tags here when "hide" is on - with js? #} <div id="tagSelector" class="boxC"> - <h3 class="subtitle">{% trans "Interesting tags" %}</h3> + <h3 class="subtitle">{% trans %}Interesting tags{% endtrans %}</h3> <div class="tags interesting marked-tags"> {% for tag_name in interesting_tag_names %} {% spaceless %} <span class="deletable-tag" id="interesting-tag-{{tag_name}}"> <a rel="tag" - title="{% blocktrans %}see questions tagged '{{ tag_name }}'{% endblocktrans %}" + title="{% trans %}see questions tagged '{{ tag_name }}'{% endtrans %}" href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}}</a> <img class="delete-icon" - src="{% media "/images/close-small-dark.png" %}" - title="{% blocktrans %}remove '{{tag_name}}' from the list of interesting tags{% endblocktrans %}"/> + src="{{'/images/close-small-dark.png'|media}}" + title="{% trans %}remove '{{tag_name}}' from the list of interesting tags{% endtrans %}"/> </span> {% endspaceless %} {% endfor %} </div> <input id="interestingTagInput" autocomplete="off" type="text"/> - <input id="interestingTagAdd" type="submit" value="{% trans "Add" %}"/> - <h3 class="subtitle">{% trans "Ignored tags" %}</h3> + <input id="interestingTagAdd" type="submit" value="{% trans %}Add{% endtrans %}"/> + <h3 class="subtitle">{% trans %}Ignored tags{% endtrans %}</h3> <div class="tags ignored marked-tags"> {% for tag_name in ignored_tag_names %} {% spaceless %} <span class="deletable-tag" id="ignored-tag-{{tag_name}}"> <a rel="tag" - title="{% blocktrans %}see questions tagged '{{ tag_name }}'{% endblocktrans %}" + title="{% trans %}see questions tagged '{{ tag_name }}'{% endtrans %}" href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}}</a> <img class="delete-icon" - src="{% media "/images/close-small-dark.png" %}" - title="{% blocktrans %}remove '{{tag_name}}' from the list of ignored tags{% endblocktrans %}"/> + src="{{'/images/close-small-dark.png'|media}}" + title="{% trans %}remove '{{tag_name}}' from the list of ignored tags{% endtrans %}"/> </span> {% endspaceless %} {% endfor %} </div> <input id="ignoredTagInput" autocomplete="off" type="text"/> - <input id="ignoredTagAdd" type="submit" value="{% trans "Add" %}"/> + <input id="ignoredTagAdd" type="submit" value="{% trans %}Add{% endtrans%}"/> <p id="hideIgnoredTagsControl"> <input id="hideIgnoredTagsCb" type="checkbox" {% if request.user.hide_ignored_questions %}checked="checked"{% endif %} /> - <label id="hideIgnoredTagsLabel" for="hideIgnoredTagsCb">{% trans "keep ignored questions hidden" %}</label> + <label id="hideIgnoredTagsLabel" for="hideIgnoredTagsCb">{% trans %}keep ignored questions hidden{% endtrans %}</label> <p> </div> diff --git a/askbot/skins/default/templates/tag_selector.jinja.html b/askbot/skins/default/templates/tag_selector.jinja.html deleted file mode 100644 index 6f6b8dc6..00000000 --- a/askbot/skins/default/templates/tag_selector.jinja.html +++ /dev/null @@ -1,41 +0,0 @@ -{# todo - maybe disable navigation from ignored tags here when "hide" is on - with js? #} -<div id="tagSelector" class="boxC"> - <h3 class="subtitle">{% trans %}Interesting tags{% endtrans %}</h3> - <div class="tags interesting marked-tags"> - {% for tag_name in interesting_tag_names %} - {% spaceless %} - <span class="deletable-tag" id="interesting-tag-{{tag_name}}"> - <a rel="tag" - title="{% trans %}see questions tagged '{{ tag_name }}'{% endtrans %}" - href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}}</a> - <img class="delete-icon" - src="{{'/images/close-small-dark.png'|media}}" - title="{% trans %}remove '{{tag_name}}' from the list of interesting tags{% endtrans %}"/> - </span> - {% endspaceless %} - {% endfor %} - </div> - <input id="interestingTagInput" autocomplete="off" type="text"/> - <input id="interestingTagAdd" type="submit" value="{% trans %}Add{% endtrans %}"/> - <h3 class="subtitle">{% trans %}Ignored tags{% endtrans %}</h3> - <div class="tags ignored marked-tags"> - {% for tag_name in ignored_tag_names %} - {% spaceless %} - <span class="deletable-tag" id="ignored-tag-{{tag_name}}"> - <a rel="tag" - title="{% trans %}see questions tagged '{{ tag_name }}'{% endtrans %}" - href="{% url questions %}?tags={{tag_name|urlencode}}">{{tag_name}}</a> - <img class="delete-icon" - src="{{'/images/close-small-dark.png'|media}}" - title="{% trans %}remove '{{tag_name}}' from the list of ignored tags{% endtrans %}"/> - </span> - {% endspaceless %} - {% endfor %} - </div> - <input id="ignoredTagInput" autocomplete="off" type="text"/> - <input id="ignoredTagAdd" type="submit" value="{% trans %}Add{% endtrans%}"/> - <p id="hideIgnoredTagsControl"> - <input id="hideIgnoredTagsCb" type="checkbox" {% if request.user.hide_ignored_questions %}checked="checked"{% endif %} /> - <label id="hideIgnoredTagsLabel" for="hideIgnoredTagsCb">{% trans %}keep ignored questions hidden{% endtrans %}</label> - <p> -</div> diff --git a/askbot/skins/default/templates/tags.html b/askbot/skins/default/templates/tags.html index 91184aa0..598c239d 100644 --- a/askbot/skins/default/templates/tags.html +++ b/askbot/skins/default/templates/tags.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} {% import "macros.html" as macros %} <!-- tags.html --> {% block title %}{% spaceless %}{% trans %}Tag list{% endtrans %}{% endspaceless %}{% endblock %} diff --git a/askbot/skins/default/templates/email_base.html b/askbot/skins/default/templates/unused/email_base.html index 406041e4..406041e4 100644 --- a/askbot/skins/default/templates/email_base.html +++ b/askbot/skins/default/templates/unused/email_base.html diff --git a/askbot/skins/default/templates/notarobot.html b/askbot/skins/default/templates/unused/notarobot.html index 17e907ce..17e907ce 100644 --- a/askbot/skins/default/templates/notarobot.html +++ b/askbot/skins/default/templates/unused/notarobot.html diff --git a/askbot/skins/default/templates/unused/question_counter_widget.html b/askbot/skins/default/templates/unused/question_counter_widget.html new file mode 100644 index 00000000..ce9d38cf --- /dev/null +++ b/askbot/skins/default/templates/unused/question_counter_widget.html @@ -0,0 +1,119 @@ +{% comment %} +this template was at one point used with the following template tag +for the django templates +the tag was removed from use because it was slowing down the template +rendering partly because of parsing the template many times over +and partly because of too many calls into askbot_settings +which added up to the total time + + +@register.inclusion_tag('question_counter_widget.html') #too slow +def question_counter_widget(question): + """todo: maybe worth trying again. it could have been too slow + because of all the calls to the askbot_settings + + returns colorized counter widget for a question + + .. versionchanged:: 0.6.6 + switched from inclusion tag style to in-code template string + for the better speed of the front page rendering + """ + view_count = functions.get_from_dict_or_object(question, 'view_count') + answer_count = functions.get_from_dict_or_object(question, 'answer_count') + vote_count = functions.get_from_dict_or_object(question, 'score') + answer_accepted = functions.get_from_dict_or_object(question, 'answer_accepted') + + #background and foreground colors for each item + (views_fg, views_bg) = colors.get_counter_colors( + view_count, + counter_max = askbot_settings.VIEW_COUNTER_EXPECTED_MAXIMUM, + zero_bg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_BG, + zero_fg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_FG, + min_bg = askbot_settings.COLORS_VIEW_COUNTER_MIN_BG, + min_fg = askbot_settings.COLORS_VIEW_COUNTER_MIN_FG, + max_bg = askbot_settings.COLORS_VIEW_COUNTER_MAX_BG, + max_fg = askbot_settings.COLORS_VIEW_COUNTER_MAX_FG, + ) + #views_fg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_FG + #views_bg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_BG + + (answers_fg, answers_bg) = colors.get_counter_colors( + answer_count, + counter_max = askbot_settings.ANSWER_COUNTER_EXPECTED_MAXIMUM, + zero_bg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_BG, + zero_fg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_FG, + min_bg = askbot_settings.COLORS_ANSWER_COUNTER_MIN_BG, + min_fg = askbot_settings.COLORS_ANSWER_COUNTER_MIN_FG, + max_bg = askbot_settings.COLORS_ANSWER_COUNTER_MAX_BG, + max_fg = askbot_settings.COLORS_ANSWER_COUNTER_MAX_FG, + ) + #answers_fg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_FG + #answers_bg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_BG + if answer_accepted: + #todo: maybe recalculate the foreground color too + answers_bg = askbot_settings.COLORS_ANSWER_COUNTER_ACCEPTED_BG + answers_fg = askbot_settings.COLORS_ANSWER_COUNTER_ACCEPTED_FG + + (votes_fg, votes_bg) = colors.get_counter_colors( + vote_count, + counter_max = askbot_settings.VOTE_COUNTER_EXPECTED_MAXIMUM, + zero_bg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_BG, + zero_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_FG, + min_bg = askbot_settings.COLORS_VOTE_COUNTER_MIN_BG, + min_fg = askbot_settings.COLORS_VOTE_COUNTER_MIN_FG, + max_bg = askbot_settings.COLORS_VOTE_COUNTER_MAX_BG, + max_fg = askbot_settings.COLORS_VOTE_COUNTER_MAX_FG, + ) + votes_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_FG + votes_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_BG + + return locals() +{% endcomment %} + +{% load extra_filters %} +{% load i18n %} +<div class="counts"> + <div class="votes" + style="background:{{votes_bg}};color:{{votes_fg}}" + title="{% trans "Please decide if you like this question or not by voting" %}"> + {% spaceless %} + <div class="item-count"> + {{question.score|humanize_counter}} + </div> + <div> + {% blocktrans count question.score as cnt %} + vote + {% plural %} + votes + {% endblocktrans %} + </div> + {% endspaceless %} + </div > + {% comment %} + <div {% if question.answer_accepted %}title="{% trans "this 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 %}"> + {% endcomment %} + <div class="votes" style="background:{{answers_bg}};color:{{answers_fg}}"> + <div class="item-count">{{question.answer_count|humanize_counter}}</div> + {% spaceless %} + <div> + {% blocktrans count question.answer_count as cnt %} + answer + {% plural %} + answers + {% endblocktrans %} + </div> + {% endspaceless %} + </div> + <div class="views" style="background:{{views_bg}};color:{{views_fg}}"> + {% spaceless %} + <div class="item-count">{{question.view_count|humanize_counter}}</div> + <div> + {% blocktrans count question.view_count as cnt %} + view + {% plural %} + views + {% endblocktrans %} + </div> + {% endspaceless %} + </div> +</div> diff --git a/askbot/skins/default/templates/question_list.html b/askbot/skins/default/templates/unused/question_list.html index 95e4834a..95e4834a 100644 --- a/askbot/skins/default/templates/question_list.html +++ b/askbot/skins/default/templates/unused/question_list.html diff --git a/askbot/skins/default/templates/question_summary_list_roll.html b/askbot/skins/default/templates/unused/question_summary_list_roll.html index 04297c68..04297c68 100644 --- a/askbot/skins/default/templates/question_summary_list_roll.html +++ b/askbot/skins/default/templates/unused/question_summary_list_roll.html diff --git a/askbot/skins/default/templates/questions_ajax.html b/askbot/skins/default/templates/unused/questions_ajax.html index d2df8015..d2df8015 100644 --- a/askbot/skins/default/templates/questions_ajax.html +++ b/askbot/skins/default/templates/unused/questions_ajax.html diff --git a/askbot/skins/default/templates/user_footer.html b/askbot/skins/default/templates/unused/user_footer.html index ee347742..ee347742 100644 --- a/askbot/skins/default/templates/user_footer.html +++ b/askbot/skins/default/templates/unused/user_footer.html diff --git a/askbot/skins/default/templates/user.html b/askbot/skins/default/templates/user.html index bd95deeb..2193fa61 100644 --- a/askbot/skins/default/templates/user.html +++ b/askbot/skins/default/templates/user.html @@ -1,9 +1,5 @@ {% extends "base.html" %} <!-- user.html --> -{% load extra_tags %} -{% load extra_filters %} -{% load humanize %} -{% load i18n %} {% block title %}{% spaceless %}{{ page_title }}{% endspaceless %}{% endblock %} {% block forestyle%} <style type="text/css"> @@ -12,10 +8,10 @@ </style> {% endblock %} {% block forejs %} - {% if request.user|can_moderate_user:view_user %} + {% if request.user|can_moderate_user(view_user) %} <!-- todo: add condition that scripts are loaded for admins only --> - <script type='text/javascript' src='{% media "/js/com.cnprog.admin.js" %}'></script> - <script type='text/javascript' src='{% media "/js/jquery.form.js" %}'></script> + <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}}; @@ -30,14 +26,13 @@ <div id="mainbar-full"> <div id="subheader" class="headUser"> {% spaceless %} - <a href="{% url user_profile view_user.id view_user.username|slugify %}"> - {% blocktrans with view_user.username as username %}{{username}}'s profile{% endblocktrans %} + <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.html" %} {% block usercontent %} {% endblock %} - {%comment%}{% include "user_footer.html" %}{%endcomment%} </div> {% endblock %}<!-- end user.html --> diff --git a/askbot/skins/default/templates/user.jinja.html b/askbot/skins/default/templates/user.jinja.html deleted file mode 100644 index 941b0c92..00000000 --- a/askbot/skins/default/templates/user.jinja.html +++ /dev/null @@ -1,39 +0,0 @@ -{% 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_edit.html b/askbot/skins/default/templates/user_edit.html index 42a5e269..3c6a0b1b 100644 --- a/askbot/skins/default/templates/user_edit.html +++ b/askbot/skins/default/templates/user_edit.html @@ -1,4 +1,4 @@ -{% extends "base_content.jinja.html" %} +{% extends "base_content.html" %} {% import "macros.html" as macros %} <!-- user_edit.html --> {% block title %}{% spaceless %}{% trans %}Edit user profile{% endtrans %}{% endspaceless %}{% endblock %} diff --git a/askbot/skins/default/templates/user_email_subscriptions.html b/askbot/skins/default/templates/user_email_subscriptions.html index 4c2c9cce..c14834a3 100644 --- a/askbot/skins/default/templates/user_email_subscriptions.html +++ b/askbot/skins/default/templates/user_email_subscriptions.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_email_subscriptions.html --> {% block usercontent %} <h2>{% trans %}Email subscription settings{% endtrans %}</h2> diff --git a/askbot/skins/default/templates/user_favorites.html b/askbot/skins/default/templates/user_favorites.html index 458cd620..c346bbb6 100644 --- a/askbot/skins/default/templates/user_favorites.html +++ b/askbot/skins/default/templates/user_favorites.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_favorites.html --> {% block usercontent %} {% include "users_questions.html" %} diff --git a/askbot/skins/default/templates/user_moderate.html b/askbot/skins/default/templates/user_moderate.html index 168fe661..75ea970e 100644 --- a/askbot/skins/default/templates/user_moderate.html +++ b/askbot/skins/default/templates/user_moderate.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_moderate.html --> {% block usercontent %} {% if request.user != view_user %} diff --git a/askbot/skins/default/templates/user_recent.html b/askbot/skins/default/templates/user_recent.html index e6cde5ed..82565c4a 100644 --- a/askbot/skins/default/templates/user_recent.html +++ b/askbot/skins/default/templates/user_recent.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_recent.html --> {% block usercontent %} <div style="padding-top:5px;font-size:13px;"> diff --git a/askbot/skins/default/templates/user_reputation.html b/askbot/skins/default/templates/user_reputation.html index 3dd6e014..120e5259 100644 --- a/askbot/skins/default/templates/user_reputation.html +++ b/askbot/skins/default/templates/user_reputation.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_reputation.html --> {% block userjs %} <script type='text/javascript' src='{{"/js/excanvas.min.js"|media}}'></script> diff --git a/askbot/skins/default/templates/user_responses.html b/askbot/skins/default/templates/user_responses.html index 432a74c7..6cf65b1f 100644 --- a/askbot/skins/default/templates/user_responses.html +++ b/askbot/skins/default/templates/user_responses.html @@ -1,7 +1,6 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} {% import "macros.html" as macros %} <!-- user_responses.html --> - {# This template accepts a list of response list they are a generalized form of any response and @@ -14,7 +13,6 @@ response_url - link to the question response_title - title of the question response_snippet - abbreviated content of the response #} - {% block usercontent %} <div style="padding-top:5px;font-size:13px;"> {% for response in responses %} diff --git a/askbot/skins/default/templates/user_stats.html b/askbot/skins/default/templates/user_stats.html index 67d9a4d2..b772b833 100644 --- a/askbot/skins/default/templates/user_stats.html +++ b/askbot/skins/default/templates/user_stats.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_stats.html --> {% block usercontent %} {% include "user_info.html" %} diff --git a/askbot/skins/default/templates/user_tabs.html b/askbot/skins/default/templates/user_tabs.html index 6e1f973a..9ea39682 100644 --- a/askbot/skins/default/templates/user_tabs.html +++ b/askbot/skins/default/templates/user_tabs.html @@ -1,40 +1,37 @@ <!-- user_tabs.html --> -{% load extra_filters %} -{% load i18n %} -{% load smart_if %} <div class="tabBar"> <div class="tabsA"> - <a id="stats" {% ifequal tab_name "stats" %}class="on"{% endifequal %} - title="{% trans "User profile" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=stats">{% trans "overview" %}</a> - <a id="recent" {% ifequal tab_name "recent" %}class="on"{% endifequal %} - title="{% trans "recent activity" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=recent">{% trans "activity" %}</a> - {% if request.user == view_user or request.user|can_moderate_user:view_user %} - <a id="responses" {% ifequal tab_name "responses" %}class="on"{% endifequal %} - title="{% trans "comments and answers to others questions" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=responses">{% trans "responses" %}</a> + <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" {% ifequal tab_name "reputation" %}class="on"{% endifequal %} - title="{% trans "graph of user reputation" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=reputation">{% trans "reputation history" %}</a> - {% if request.user == view_user or request.user|can_moderate_user:view_user %} - <a id="votes" {% ifequal tab_name "votes" %}class="on"{% endifequal %} - title="{% trans "user vote record" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=votes">{% trans "casted votes" %}</a> + <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" {% ifequal tab_name "favorites" %}class="on"{% endifequal %} - title="{% trans "questions that user selected as his/her favorite" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=favorites">{% trans "favorites" %}</a> - {% if request.user == view_user or request.user|can_moderate_user:view_user %} - <a id="email_subscriptions" {% ifequal tab_name "email_subscriptions" %}class="on"{% endifequal %} - title="{% trans "email subscription settings" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=email_subscriptions">{% trans "subscriptions" %}</a> + <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" {% ifequal tab_name "moderation" %}class="on"{% endifequal %} - title="{% trans "moderate this user" %}" - href="{% url user_profile view_user.id view_user.username|slugify %}?sort=moderation">{% trans "moderation" %}</a> + {% 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> diff --git a/askbot/skins/default/templates/user_tabs.jinja.html b/askbot/skins/default/templates/user_tabs.jinja.html deleted file mode 100644 index 9ea39682..00000000 --- a/askbot/skins/default/templates/user_tabs.jinja.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- 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/default/templates/user_votes.html b/askbot/skins/default/templates/user_votes.html index 9b738cd9..33f6f1fe 100644 --- a/askbot/skins/default/templates/user_votes.html +++ b/askbot/skins/default/templates/user_votes.html @@ -1,4 +1,4 @@ -{% extends "user.jinja.html" %} +{% extends "user.html" %} <!-- user_votes.html --> {% block usercontent %} <div style="padding-top:5px;font-size:13px;"> diff --git a/askbot/skins/default/templates/users.html b/askbot/skins/default/templates/users.html index 61ac7b57..2c5a5cf9 100644 --- a/askbot/skins/default/templates/users.html +++ b/askbot/skins/default/templates/users.html @@ -1,4 +1,4 @@ -{% extends "base.jinja.html" %} +{% extends "base.html" %} {% import "macros.html" as macros %} <!-- users.html --> {% block title %}{% spaceless %}{% trans %}Users{% endtrans %}{% endspaceless %}{% endblock %} diff --git a/askbot/templatetags/extra_tags.py b/askbot/templatetags/extra_tags.py index c39bfe5c..80ccf251 100644 --- a/askbot/templatetags/extra_tags.py +++ b/askbot/templatetags/extra_tags.py @@ -21,6 +21,7 @@ from askbot.utils import colors from askbot.utils import functions from askbot.utils.slug import slugify from askbot.templatetags import extra_filters +from askbot.skins.loaders import ENV register = template.Library() @@ -369,6 +370,33 @@ def joinitems(parser,token): return JoinItemListNode(separator=sep_node,last_separator=last_sep_node,items=nodelist) +class IncludeJinja(template.Node): + """http://www.mellowmorning.com/2010/08/24/""" + def __init__(self, filename): + self.filename = filename + def render(self, context): + jinja_template = ENV.get_template(self.filename) + return jinja_template.render(context) + +@register.tag +def include_jinja(parser, token): + bits = token.contents.split() + + #Check if a filename was given + if len(bits) != 2: + error_message = '%r tag requires the name of the ' + \ + 'template to be included included' + raise template.TemplateSyntaxError(error_message % bits[0]) + filename = bits[1] + + #Remove quotes or raise error + if filename[0] in ('"', "'") and filename[-1] == filename[0]: + filename = filename[1:-1] + else: + raise template.TemplateSyntaxError('file name must be quoted') + + return IncludeJinja(filename) + class BlockMediaUrlNode(template.Node): def __init__(self,nodelist): self.items = nodelist @@ -418,68 +446,6 @@ def fullmedia(url): path = media(url) return "%s%s" % (domain, path) -@register.inclusion_tag('question_counter_widget.html') #too slow -def question_counter_widget(question): - """todo: maybe worth trying again. it could have been too slow - because of all the calls to the askbot_settings - - returns colorized counter widget for a question - - .. versionchanged:: 0.6.6 - switched from inclusion tag style to in-code template string - for the better speed of the front page rendering - """ - view_count = functions.get_from_dict_or_object(question, 'view_count') - answer_count = functions.get_from_dict_or_object(question, 'answer_count') - vote_count = functions.get_from_dict_or_object(question, 'score') - answer_accepted = functions.get_from_dict_or_object(question, 'answer_accepted') - - #background and foreground colors for each item - (views_fg, views_bg) = colors.get_counter_colors( - view_count, - counter_max = askbot_settings.VIEW_COUNTER_EXPECTED_MAXIMUM, - zero_bg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_BG, - zero_fg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_FG, - min_bg = askbot_settings.COLORS_VIEW_COUNTER_MIN_BG, - min_fg = askbot_settings.COLORS_VIEW_COUNTER_MIN_FG, - max_bg = askbot_settings.COLORS_VIEW_COUNTER_MAX_BG, - max_fg = askbot_settings.COLORS_VIEW_COUNTER_MAX_FG, - ) - #views_fg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_FG - #views_bg = askbot_settings.COLORS_VIEW_COUNTER_EMPTY_BG - - (answers_fg, answers_bg) = colors.get_counter_colors( - answer_count, - counter_max = askbot_settings.ANSWER_COUNTER_EXPECTED_MAXIMUM, - zero_bg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_BG, - zero_fg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_FG, - min_bg = askbot_settings.COLORS_ANSWER_COUNTER_MIN_BG, - min_fg = askbot_settings.COLORS_ANSWER_COUNTER_MIN_FG, - max_bg = askbot_settings.COLORS_ANSWER_COUNTER_MAX_BG, - max_fg = askbot_settings.COLORS_ANSWER_COUNTER_MAX_FG, - ) - #answers_fg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_FG - #answers_bg = askbot_settings.COLORS_ANSWER_COUNTER_EMPTY_BG - if answer_accepted: - #todo: maybe recalculate the foreground color too - answers_bg = askbot_settings.COLORS_ANSWER_COUNTER_ACCEPTED_BG - answers_fg = askbot_settings.COLORS_ANSWER_COUNTER_ACCEPTED_FG - - (votes_fg, votes_bg) = colors.get_counter_colors( - vote_count, - counter_max = askbot_settings.VOTE_COUNTER_EXPECTED_MAXIMUM, - zero_bg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_BG, - zero_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_FG, - min_bg = askbot_settings.COLORS_VOTE_COUNTER_MIN_BG, - min_fg = askbot_settings.COLORS_VOTE_COUNTER_MIN_FG, - max_bg = askbot_settings.COLORS_VOTE_COUNTER_MAX_BG, - max_fg = askbot_settings.COLORS_VOTE_COUNTER_MAX_FG, - ) - votes_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_FG - votes_fg = askbot_settings.COLORS_VOTE_COUNTER_EMPTY_BG - - return locals() - class IsManyNode(template.Node): def __init__(self, test_items, true_nodelist, false_nodelist): self.true_nodelist = true_nodelist diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py index bcdfa199..fa4416b8 100644 --- a/askbot/tests/page_load_tests.py +++ b/askbot/tests/page_load_tests.py @@ -66,7 +66,7 @@ class PageLoadTests(PageLoadTestCase): self.try_url('sitemap') self.try_url('feeds', kwargs={'url':'rss'}) - self.try_url('about', template='about.jinja.html') + self.try_url('about', template='about.html') self.try_url('privacy', template='privacy.html') self.try_url('logout', template='logout.html') self.try_url('user_signin', template='authopenid/signin.html') diff --git a/askbot/views/meta.py b/askbot/views/meta.py index 6b2564a4..62e7da8a 100644 --- a/askbot/views/meta.py +++ b/askbot/views/meta.py @@ -15,11 +15,21 @@ from askbot.models import Badge, Award from askbot.skins.loaders import ENV import askbot -def about(request): - template = ENV.get_template('about.jinja.html') +def generic_view(request, template = None): + print 'in generic view' + template = ENV.get_template(template) context = RequestContext(request) return HttpResponse(template.render(context)) +def about(request, template='about.html'): + return generic_view(request, template) + +def page_not_found(request, template='404.html'): + return generic_view(request, template) + +def server_error(request, template='500.html'): + return generic_view(request, template) + def faq(request): template = ENV.get_template('faq.html') data = { diff --git a/askbot/views/readers.py b/askbot/views/readers.py index c669f02d..29bc821f 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -14,7 +14,6 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404 from django.core.paginator import Paginator, EmptyPage, InvalidPage from django.template import RequestContext, Context -from django.template import loader from django.template import defaultfilters from django.utils.html import * from django.utils import simplejson @@ -158,16 +157,13 @@ def questions(request): 'q_num': humanize.intcomma(q_count), } - paginator_tpl = loader.get_template('paginator.html') + paginator_tpl = ENV.get_template('paginator.html') #todo: remove this patch on context after all templates are moved to jinja paginator_context['base_url'] = request.path + '?sort=%s&' % search_state.sort - paginator_html = paginator_tpl.render( - Context( - extra_tags.cnprog_paginator( - paginator_context - ) - ) - ) + data = { + 'paginator_context': extra_tags.cnprog_paginator(paginator_context) + } + paginator_html = paginator_tpl.render(Context(data)) ajax_data = { #current page is 1 by default now #because ajax is only called by update in the search button @@ -196,7 +192,7 @@ def questions(request): for tag in related_tags: tag_data = { 'name': tag.name, - 'used_count': humanize.intcomma(tag.used_count) + 'used_count': humanize.intcomma(tag.local_used_count) } ajax_data['related_tags'].append(tag_data) @@ -329,22 +325,15 @@ def questions(request): 'context' : paginator_context, }) - #todo: organize variables by type - if request.is_ajax(): - #this branch should be dead now - raise NotImplementedError() - template = loader.get_template('questions_ajax.html') - question_snippet = template.render(template_context) - output = {'question_snippet': question_snippet} - #print simplejson.dumps(output) - return HttpResponse(simplejson.dumps(output), mimetype='application/json') - else: - #before = datetime.datetime.now() - template = ENV.get_template('questions.html') - response = HttpResponse(template.render(template_context)) - #after = datetime.datetime.now() - #print after - before - return response + assert(request.is_ajax() == False) + #ajax request is handled in a separate branch above + + #before = datetime.datetime.now() + template = ENV.get_template('questions.html') + response = HttpResponse(template.render(template_context)) + #after = datetime.datetime.now() + #print after - before + return response def search(request): #generates listing of questions matching a search query - including tags and just words """redirects to people and tag search pages |