From e232a9cfcbdf3178a887aafec9c53f142e361dd6 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 14 Aug 2010 14:46:40 -0400 Subject: simplified media specification in templates and made a function to lookup media url at startup time - so that images could be added to live settings --- askbot/conf/skin_general_settings.py | 31 ++++++++++--- askbot/deps/livesettings/values.py | 7 +++ askbot/skins/default/templates/answer_edit.html | 12 ++--- askbot/skins/default/templates/ask.html | 12 ++--- .../skins/default/templates/authopenid/signin.html | 38 ++++++++-------- askbot/skins/default/templates/base.html | 10 ++--- askbot/skins/default/templates/base_content.html | 10 ++--- askbot/skins/default/templates/book.html | 4 +- askbot/skins/default/templates/email_base.html | 4 +- askbot/skins/default/templates/footer.html | 2 +- askbot/skins/default/templates/header.html | 6 +-- askbot/skins/default/templates/question.html | 40 ++++++++--------- askbot/skins/default/templates/question_edit.html | 12 ++--- askbot/skins/default/templates/question_retag.html | 6 +-- askbot/skins/default/templates/questions.html | 6 +-- .../skins/default/templates/revisions_answer.html | 6 +-- .../default/templates/revisions_question.html | 6 +-- askbot/skins/default/templates/tag_selector.html | 4 +- askbot/skins/default/templates/user.html | 4 +- askbot/skins/default/templates/user_edit.html | 2 +- .../skins/default/templates/user_reputation.html | 4 +- askbot/skins/default/templates/user_stats.html | 4 +- askbot/skins/default/templates/user_votes.html | 4 +- .../skins/default/templates/users_questions.html | 4 +- askbot/skins/loaders.py | 35 --------------- askbot/skins/utils.py | 51 ++++++++++++++++++++++ askbot/templatetags/extra_tags.py | 15 +++---- 27 files changed, 187 insertions(+), 152 deletions(-) diff --git a/askbot/conf/skin_general_settings.py b/askbot/conf/skin_general_settings.py index 56102453..d71fe7fc 100644 --- a/askbot/conf/skin_general_settings.py +++ b/askbot/conf/skin_general_settings.py @@ -4,14 +4,31 @@ General skin settings from askbot.conf.settings_wrapper import settings from askbot.deps.livesettings import ConfigurationGroup from askbot.deps.livesettings import StringValue, IntegerValue, BooleanValue +#from askbot.deps.livesettings import ImageValue from django.utils.translation import ugettext as _ -from askbot.skins.utils import get_skin_choices +from askbot.skins import utils as skin_utils GENERAL_SKIN_SETTINGS = ConfigurationGroup( 'GENERAL_SKIN_SETTINGS', _('Skin and User Interface settings'), ) +#settings.register( +# ImageValue( +# GENERAL_SKIN_SETTINGS, +# 'SITE_LOGO', +# description = _('Q&A site logo'), +# help_text = _( +# 'To change logo, click "change button", ' +# 'select new logo file, then submit this ' +# 'whole form.' +# ), +# upload_directory = django_settings.ASKBOT_FILE_UPLOAD_DIR, +# default_image_url = skin_utils.get_media_url('logo.gif') +# ) +#) +print skin_utils.get_media_url('/images/logo.gif') + settings.register( BooleanValue( GENERAL_SKIN_SETTINGS, @@ -32,9 +49,9 @@ settings.register( StringValue( GENERAL_SKIN_SETTINGS, 'ASKBOT_DEFAULT_SKIN', - default='default', - choices=get_skin_choices(), - description=_('Select skin'), + default = 'default', + choices = skin_utils.get_skin_choices(), + description = _('Select skin'), ) ) @@ -42,9 +59,9 @@ settings.register( IntegerValue( GENERAL_SKIN_SETTINGS, 'MEDIA_RESOURCE_REVISION', - default=1, - description=_('Skin media revision number'), - help_text=_( + default = 1, + description = _('Skin media revision number'), + help_text = _( 'Increment this number when you change ' 'image in skin media or stylesheet. ' 'This helps avoid showing your users ' diff --git a/askbot/deps/livesettings/values.py b/askbot/deps/livesettings/values.py index 6bde7f5a..0b6e1d20 100644 --- a/askbot/deps/livesettings/values.py +++ b/askbot/deps/livesettings/values.py @@ -561,6 +561,13 @@ class LongStringValue(Value): to_editor = to_python +#class ImageValue(Value): +# +# class field(dddd.forms.ImageField): +# def __init__(self, *args, **kwargs): +# kwargs['required'] = False +# kwargs['widget'] = ddd.forms.ImageInput() +# ddd.forms.ImageField.__init__(self, *args, **kwargs) class MultipleStringValue(Value): diff --git a/askbot/skins/default/templates/answer_edit.html b/askbot/skins/default/templates/answer_edit.html index afcb8efe..9d46bb17 100644 --- a/askbot/skins/default/templates/answer_edit.html +++ b/askbot/skins/default/templates/answer_edit.html @@ -4,12 +4,12 @@ {% load extra_tags %} {% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %} {% block forejs %} - - - - - - + + + + + + - - - - - + + + + + + + - - + + @@ -97,44 +97,44 @@ {% endcomment %} {% comment %}
  • - icon + icon http://{your-openid-url}
  • {% endcomment %} - icon + icon http://username.myopenid.com/ - icon + icon http://flickr.com/username/ - icon + icon http://technorati.com/people/technorati/username/ - icon + icon http://username.wordpress.com - icon + icon http://username.blogspot.com/ - icon + icon http://username.livejournal.com - icon + icon http://claimid.com/username - icon + icon http://username.myvidoop.com/ - icon + icon http://username.pip.verisignlabs.com/ diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html index 5823c1ac..822a69ad 100644 --- a/askbot/skins/default/templates/base.html +++ b/askbot/skins/default/templates/base.html @@ -18,8 +18,8 @@ {% if settings.GOOGLE_SITEMAP_CODE %} {% endif %} - - + + - - - + + + {% if user_messages %}