diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2012-05-08 10:22:35 -0600 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2012-05-08 10:22:35 -0600 |
commit | fe88a995f4b096d952df56026a04bb9b148e03ba (patch) | |
tree | 5b41ecf72a6b123f6909ef35abaf693846d76ad4 | |
parent | 347b5788df39c1c2c16fd3409ec2391420993ebc (diff) | |
parent | 91e2e7f7b871f0860e06379f76bf7e09ae0acad5 (diff) | |
download | askbot-fe88a995f4b096d952df56026a04bb9b148e03ba.tar.gz askbot-fe88a995f4b096d952df56026a04bb9b148e03ba.tar.bz2 askbot-fe88a995f4b096d952df56026a04bb9b148e03ba.zip |
Merge branch 'master' of github.com:fitoria/askbot-devel
Conflicts:
askbot/skins/utils.py
-rwxr-xr-x | .gitignore | 1 | ||||
-rw-r--r-- | askbot/conf/skin_general_settings.py | 38 | ||||
-rw-r--r-- | askbot/middleware/locale.py | 26 | ||||
-rw-r--r-- | askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py | 14 | ||||
-rw-r--r-- | askbot/setup_templates/settings.py | 1 | ||||
-rw-r--r-- | askbot/setup_templates/settings.py.mustache | 1 | ||||
-rw-r--r-- | askbot/skins/default/media/style/lib_style.css | 22 | ||||
-rw-r--r-- | askbot/skins/default/media/style/lib_style.less | 37 | ||||
-rw-r--r-- | askbot/skins/default/media/style/style.less | 150 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/question_card.html | 2 | ||||
-rw-r--r-- | askbot/skins/utils.py | 2 | ||||
-rw-r--r-- | askbot/startup_procedures.py | 15 |
12 files changed, 189 insertions, 120 deletions
@@ -47,3 +47,4 @@ run recaptcha /.ve /db.sq3 +*.DS_Store diff --git a/askbot/conf/skin_general_settings.py b/askbot/conf/skin_general_settings.py index ccecdaba..6abee90a 100644 --- a/askbot/conf/skin_general_settings.py +++ b/askbot/conf/skin_general_settings.py @@ -30,6 +30,40 @@ settings.register( ) ) +LANGUAGE_CHOICES = ( + ('en', _("English")), + ('es', _("Spanish")), + ('ca', _("Catalan")), + ('de', _("German")), + ('el', _("Greek")), + ('fi', _("Finnish")), + ('fr', _("French")), + ('hi', _("Hindi")), + ('hu', _("Hungarian")), + ('it', _("Italian")), + ('ja', _("Japanese")), + ('ko', _("Korean")), + ('pt', _("Portuguese")), + ('pt_BR', _("Brazilian Portuguese")), + ('ro', _("Romanian")), + ('ru', _("Russian")), + ('sr', _("Serbian")), + ('tr', _("Turkish")), + ('vi', _("Vietnamese")), + ('zh_CN', _("Chinese")), + ('zh_TW', _("Chinese (Taiwan)")), + ) + +settings.register( + values.StringValue( + GENERAL_SKIN_SETTINGS, + 'ASKBOT_LANGUAGE', + default = 'en', + choices = LANGUAGE_CHOICES, + description = _('Select Language'), + ) +) + settings.register( values.BooleanValue( GENERAL_SKIN_SETTINGS, @@ -198,7 +232,7 @@ settings.register( description = _('Apply custom style sheet (CSS)'), help_text = _( 'Check if you want to change appearance ' - 'of your form by adding custom style sheet rules ' + 'of your form by adding custom style sheet rules ' '(please see the next item)' ), default = False @@ -214,7 +248,7 @@ settings.register( '<strong>To use this function</strong>, check ' '"Apply custom style sheet" option above. ' 'The CSS rules added in this window will be applied ' - 'after the default style sheet rules. ' + 'after the default style sheet rules. ' 'The custom style sheet will be served dynamically at ' 'url "<forum url>/custom.css", where ' 'the "<forum url> part depends (default is ' diff --git a/askbot/middleware/locale.py b/askbot/middleware/locale.py new file mode 100644 index 00000000..c92e977a --- /dev/null +++ b/askbot/middleware/locale.py @@ -0,0 +1,26 @@ +"Taken from django.middleware.locale: this is the locale selecting middleware that will look at accept headers" + +from django.utils.cache import patch_vary_headers +from django.utils import translation +from askbot.conf import settings + +class LocaleMiddleware(object): + """ + This is a very simple middleware that parses a request + and decides what translation object to install in the current + thread context. This allows pages to be dynamically + translated to the language the user desires (if the language + is available, of course). + """ + + def process_request(self, request): + language = settings.ASKBOT_LANGUAGE + translation.activate(language) + request.LANGUAGE_CODE = translation.get_language() + + def process_response(self, request, response): + patch_vary_headers(response, ('Accept-Language',)) + if 'Content-Language' not in response: + response['Content-Language'] = translation.get_language() + translation.deactivate() + return response diff --git a/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py b/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py index d26bdeb0..70ef2f8d 100644 --- a/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py +++ b/askbot/migrations/0032_auto__del_field_badgedata_multiple__del_field_badgedata_description__d.py @@ -5,7 +5,7 @@ from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): - + def forwards(self, orm): # Removing unique constraint on 'BadgeData', fields ['type', 'name'] @@ -34,10 +34,10 @@ class Migration(SchemaMigration): except: db.rollback_transaction() - - + + def backwards(self, orm): - + # Adding field 'BadgeData.multiple' db.add_column('askbot_badgedata', 'multiple', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default=False) @@ -55,8 +55,8 @@ class Migration(SchemaMigration): # Removing unique constraint on 'BadgeData', fields ['slug'] db.delete_unique('askbot_badgedata', ['slug']) - - + + models = { 'askbot.activity': { 'Meta': {'object_name': 'Activity', 'db_table': "u'activity'"}, @@ -335,5 +335,5 @@ class Migration(SchemaMigration): 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) } } - + complete_apps = ['askbot'] diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 191d13f3..b326ea85 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -98,6 +98,7 @@ TEMPLATE_LOADERS = ( MIDDLEWARE_CLASSES = ( #'django.middleware.gzip.GZipMiddleware', + 'askbot.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', #'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index 3287fb18..eb1cb1c1 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -97,6 +97,7 @@ TEMPLATE_LOADERS = ( MIDDLEWARE_CLASSES = ( #'django.middleware.gzip.GZipMiddleware', + 'askbot.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', #'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', diff --git a/askbot/skins/default/media/style/lib_style.css b/askbot/skins/default/media/style/lib_style.css new file mode 100644 index 00000000..a92af477 --- /dev/null +++ b/askbot/skins/default/media/style/lib_style.css @@ -0,0 +1,22 @@ +/* General Predifined classes, read more in lesscss.org */ +/* Variables for Colors*/ +/* Variables for fonts*/ +/* "Trebuchet MS", sans-serif;*/ +/* Buttons */ +.button-style-hover { + background-color: #cde5e9; + background-repeat: no-repeat; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#cde5e9), color-stop(25%, #cde5e9), to(#94b3ba)); + background-image: -webkit-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba); + background-image: -moz-linear-gradient(top, #cde5e9, #cde5e9 25%, #94b3ba); + background-image: -ms-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba); + background-image: -o-linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba); + background-image: linear-gradient(#cde5e9, #cde5e9 25%, #94b3ba); + text-decoration: none; + text-shadow: 0px 1px 0px #c6d9dd; + -moz-text-shadow: 0px 1px 0px #c6d9dd; + -webkit-text-shadow: 0px 1px 0px #c6d9dd; +} +/* General styles for gradients */ +/* Receive exactly positions for background Sprite */ +/* CSS3 Elements */ diff --git a/askbot/skins/default/media/style/lib_style.less b/askbot/skins/default/media/style/lib_style.less index 941c83ff..bedd8c60 100644 --- a/askbot/skins/default/media/style/lib_style.less +++ b/askbot/skins/default/media/style/lib_style.less @@ -17,6 +17,43 @@ @main-font:'Yanone Kaffeesatz', sans-serif; @secondary-font:Arial; +/* Buttons */ + +.button-style(@w:100px ,@h:20px, @f:14px){ + width:@w; + height:@h; + font-size:@f; + text-align:center; + text-decoration:none; + cursor:pointer; + color:@button-label; + font-family:@main-font; + .text-shadow(0px,1px,0px,#c6d9dd); + border-top:#eaf2f3 1px solid; + .linear-gradient(#d1e2e5,#a9c2c7); + .rounded-corners(4px); + .box-shadow(1px, 1px, 2px, #636363) +} + +.button-style-hover{ + .linear-gradient(#cde5e9,#94b3ba); + text-decoration:none; + .text-shadow(0px, 1px, 0px, #c6d9dd); +} + +/* General styles for gradients */ + +.linear-gradient(@start:#eee,@end:#fff,@stop:25%){ + background-color: @start; + background-repeat: no-repeat; + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@start), color-stop(@stop, @start), to(@end)); + background-image: -webkit-linear-gradient(@start, @start @stop, @end); + background-image: -moz-linear-gradient(top, @start, @start @stop, @end); + background-image: -ms-linear-gradient(@start, @start @stop, @end); + background-image: -o-linear-gradient(@start, @start @stop, @end); + background-image: linear-gradient(@start, @start @stop, @end); +} + /* Receive exactly positions for background Sprite */ .sprites(@hor,@vert,@back:url(../images/sprites.png)){ diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less index e63ff373..0d1e8112 100644 --- a/askbot/skins/default/media/style/style.less +++ b/askbot/skins/default/media/style/style.less @@ -154,6 +154,7 @@ h1 { padding: 10px 0 5px 0px; } + /* ----- Extra space above for messages ----- */ body.user-messages { @@ -463,24 +464,15 @@ body.anon { #askButton{ /* check blocks/secondary_header.html and widgets/ask_button.html*/ - background: url(../images/bigbutton.png) repeat-x bottom; line-height:44px; - text-align:center; - width:200px; - height:42px; - font-size:23px; - color:@button-label; - margin-top:7px; + margin-top:6px; float:right; text-transform:uppercase; - .rounded-corners(5px); - .box-shadow(1px, 1px, 2px, #636363) + .button-style(200px, 42px, 23px); } #askButton:hover{ - text-decoration:none; - background: url(../images/bigbutton.png) repeat-x top; - .text-shadow(0px, 1px, 0px, #c6d9dd) + .button-style-hover; } /* ----- Content layout, check two_column_body.html or one_column_body.html ----- */ @@ -531,6 +523,7 @@ body.anon { padding-right:10px; margin-bottom:10px; font-family:@main-font; + width:190px; } h3{ color:#4a757f; @@ -590,23 +583,15 @@ body.anon { height:25px; } #interestingTagAdd, #ignoredTagAdd{ - background:url(../images/small-button-blue.png) repeat-x top; border:0; - color:@button-label; font-weight:bold; - font-size:12px; - width:30px; - height:27px; margin-top:-2px; - cursor:pointer; + .button-style(30px,27px,12px); .rounded-corners(4px); - .text-shadow(0px,1px,0px,#E6F6FA); - .box-shadow(1px, 1px, 2px, #808080); - - + .text-shadow(0px,1px,0px,#E6F6FA); } #interestingTagAdd:hover, #ignoredTagAdd:hover{ - background:url(../images/small-button-blue.png) repeat-x bottom; + .button-style-hover; } } @@ -617,28 +602,17 @@ body.anon { /* widgets for question template */ a.followed, a.follow{ - background: url(../images/medium-button.png) top repeat-x; - height:34px; line-height:34px; - text-align:center; border:0; - font-family:@main-font; - color:@button-label; font-weight:normal; - font-size:21px; margin-top:3px; - display:block; - width:120px; - text-decoration:none; - .rounded-corners(4px); - .box-shadow(1px, 1px, 2px, #636363); + .button-style(120px,34px,21px); .center; } a.followed:hover, a.follow:hover{ - text-decoration:none; - background: url(../images/medium-button.png) bottom repeat-x; + .button-style-hover; .text-shadow(0px, 1px, 0px, #c6d9dd); } @@ -1133,7 +1107,7 @@ ul#related-tags { ul.tags li { float:left; display: block; - margin: 0 8px 0 0; + margin: 0 8px 8px 0; padding: 0; height:20px; } @@ -1352,24 +1326,16 @@ ul#related-tags li { .ask-page input.submit, .edit-question-page input.submit { float: left; - background: url(../images/medium-button.png) top repeat-x; - height:34px; - border:0; - font-family:@main-font; - color:@button-label; font-weight:normal; - font-size:21px; margin-top:3px; - .rounded-corners(4px); - .box-shadow(1px, 1px, 2px, #636363); + .button-style(160px,34px,21px); margin-right:7px; } #fmanswer input.submit:hover, .ask-page input.submit:hover, .edit-question-page input.submit:hover{ - text-decoration:none; - background: url(../images/medium-button.png) bottom repeat-x; + .button-style-hover; .text-shadow(0px, 1px, 0px, #c6d9dd) } #editor { /*adjustment for editor preview*/ @@ -1383,7 +1349,13 @@ ul#related-tags li { border-top:0; padding:10px; margin-bottom:10px; - width:717px; + width:710px; +} + +@media screen and (-webkit-min-device-pixel-ratio:0){ + #editor{ + width:717px; + } } #id_title { @@ -1796,24 +1768,14 @@ ul#related-tags li { width: 100px; } button{ - background:url(../images/small-button-blue.png) repeat-x top; - border:0; - color:@button-label; - font-family:@body-font; - font-size:13px; - width:100px; - font-weight:bold; - height:27px; line-height:25px; margin-bottom:5px; - cursor:pointer; - .rounded-corners(4px); - .text-shadow(0px,1px,0px,#E6F6FA); - .box-shadow(1px, 1px, 2px, #808080); + .button-style(100px,27px,12px); + font-family:@body-font; + font-weight:bold; } button:hover{ - background: url(../images/small-button-blue.png) bottom repeat-x; - .text-shadow(0px, 1px, 0px, #c6d9dd); + .button-style-hover; } .counter { display: inline-block; @@ -1958,6 +1920,10 @@ ul#related-tags li { text-align: center; padding-top: 2px; margin:10px 10px 0px 3px; + /* smalls IE fixes */ + *margin:0; + *height:210px; + *width:30px; } .vote-buttons IMG { @@ -2155,23 +2121,13 @@ ul#related-tags li { font-size:14px; } input.submit{ - background:url(../images/small-button-blue.png) repeat-x top; - border:0; - color:@button-label; - font-weight:bold; - font-size:13px; - font-family:@body-font; - height:26px; + font-weight:normal; margin:5px 0px; - width:100px; - cursor:pointer; - .rounded-corners(4px); - .text-shadow(0px,1px,0px,#E6F6FA); - .box-shadow(1px, 1px, 2px, #808080); + .button-style(100px,26px,15px); + font-family:@body-font; } input.submit:hover{ - background:url(../images/small-button-blue.png) repeat-x bottom; - text-decoration:none; + .button-style-hover; } .cancel{ background:url(../images/small-button-cancel.png) repeat-x top !important; @@ -2194,25 +2150,19 @@ ul#related-tags li { width:200px; } .submit-b{ - background:url(../images/small-button-blue.png) repeat-x top; - border:0; - color:@button-label; - font-weight:bold; - font-size:13px; + .button-style(100px,24px,15px); font-family:@body-font; - height:24px; - margin-top:-2px; - padding-left:10px; + font-weight:bold; padding-right:10px; - cursor:pointer; - .rounded-corners(4px); - .text-shadow(0px,1px,0px,#E6F6FA); - .box-shadow(1px, 1px, 2px, #808080) + border:0; } + .submit-b:hover{ - background:url(../images/small-button-blue.png) repeat-x bottom; + .button-style-hover; } } + + .openid-input { background: url(../images/openid.gif) no-repeat; padding-left: 15px; @@ -2357,23 +2307,14 @@ a:hover.medal { .follow-toggle,.submit { border:0 !important; - color:@button-label; font-weight:bold; - font-size:12px; - height:26px; line-height:26px; margin-top:-2px; - font-size:15px; - cursor:pointer; - font-family:@main-font; - background:url(../images/small-button-blue.png) repeat-x top; - .rounded-corners(4px); - .text-shadow(0px,1px,0px,#E6F6FA); - .box-shadow(1px, 1px, 2px, #808080) + .button-style(100px,26px,12px); } .follow-toggle:hover, .submit:hover { - background:url(../images/small-button-blue.png) repeat-x bottom; + .button-style-hover; text-decoration:none !important; } @@ -3383,3 +3324,12 @@ body.anon.lang-es { } } } +a.re_expand{ + color: #616161; + text-decoration:none; +} + +a.re_expand .re_content{ + display:none; + margin-left:77px; +} diff --git a/askbot/skins/default/templates/question/question_card.html b/askbot/skins/default/templates/question/question_card.html index 08f7ccee..dd52ea0f 100644 --- a/askbot/skins/default/templates/question/question_card.html +++ b/askbot/skins/default/templates/question/question_card.html @@ -29,4 +29,4 @@ </div> </div> -<div class="clean"></div> + diff --git a/askbot/skins/utils.py b/askbot/skins/utils.py index 20c29669..4f8e1992 100644 --- a/askbot/skins/utils.py +++ b/askbot/skins/utils.py @@ -192,8 +192,6 @@ def update_media_revision(skin = None): current_hash = hasher.get_hash_of_dirs(media_dirs) if current_hash != askbot_settings.MEDIA_RESOURCE_REVISION_HASH: - askbot_settings.update('MEDIA_RESOURCE_REVISION', resource_revision + 1) - askbot_settings.update('MEDIA_RESOURCE_REVISION_HASH', current_hash) try: askbot_settings.update('MEDIA_RESOURCE_REVISION', resource_revision + 1) logging.debug('media revision worked for MEDIA_RESOURCE_REVISION') diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 9678fdf1..a5b0c940 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -11,7 +11,8 @@ import sys import os import re import askbot -from django.db import transaction +import south +from django.db import transaction, connection from django.conf import settings as django_settings from django.core.exceptions import ImproperlyConfigured from askbot.utils.loading import load_module @@ -166,7 +167,7 @@ def try_import(module_name, pypi_package_name, short_message = False): try: load_module(module_name) except ImportError, error: - message = 'Error: ' + unicode(error) + message = 'Error: ' + unicode(error) message += '\n\nPlease run: >pip install %s' % pypi_package_name if short_message == False: message += '\n\nTo install all the dependencies at once, type:' @@ -306,10 +307,10 @@ class SettingsTester(object): ) if len(self.messages) != 0: raise AskbotConfigError( - '\n\nTime to do some maintenance of your settings.py:\n\n* ' + + '\n\nTime to do some maintenance of your settings.py:\n\n* ' + '\n\n* '.join(self.messages) ) - + def test_staticfiles(): """tests configuration of the staticfiles app""" errors = list() @@ -350,7 +351,7 @@ def test_staticfiles(): if static_url is None or str(static_url).strip() == '': errors.append( 'Add STATIC_URL setting to your settings.py file. ' - 'The setting must be a url at which static files ' + 'The setting must be a url at which static files ' 'are accessible.' ) url = urlparse(static_url).path @@ -407,7 +408,7 @@ def test_staticfiles(): ' python manage.py collectstatic\n' ) - + print_errors(errors) if django_settings.STATICFILES_STORAGE == \ 'django.contrib.staticfiles.storage.StaticFilesStorage': @@ -479,8 +480,6 @@ def test_avatar(): '-e git+git://github.com/ericflo/django-avatar.git#egg=avatar', short_message = True ) - - def run_startup_tests(): """function that runs |