diff options
44 files changed, 494 insertions, 274 deletions
diff --git a/askbot/__init__.py b/askbot/__init__.py index 8cbc9790..25057b43 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -34,14 +34,14 @@ REQUIREMENTS = { 'openid': 'python-openid', 'pystache': 'pystache==0.3.1', 'pytz': 'pytz', - 'tinymce': 'django-tinymce', + 'tinymce': 'django-tinymce==1.5.1b2', 'longerusername': 'longerusername', 'bs4': 'beautifulsoup4' } if platform.system() != 'Windows': REQUIREMENTS['lamson'] = 'Lamson' - + #necessary for interoperability of django and coffin try: from askbot import patches diff --git a/askbot/conf/__init__.py b/askbot/conf/__init__.py index fd62bc88..c1989f8d 100644 --- a/askbot/conf/__init__.py +++ b/askbot/conf/__init__.py @@ -8,6 +8,7 @@ import askbot.conf.karma_and_badges_visibility import askbot.conf.email import askbot.conf.forum_data_rules import askbot.conf.moderation +import askbot.conf.main_pages import askbot.conf.flatpages import askbot.conf.site_settings import askbot.conf.license diff --git a/askbot/conf/forum_data_rules.py b/askbot/conf/forum_data_rules.py index e8a2b539..524ab16a 100644 --- a/askbot/conf/forum_data_rules.py +++ b/askbot/conf/forum_data_rules.py @@ -15,7 +15,7 @@ FORUM_DATA_RULES = livesettings.ConfigurationGroup( EDITOR_CHOICES = ( ('markdown', 'markdown'), - ('tinymce', 'WISYWIG (tinymce)') + ('tinymce', 'WYSIWYG (tinymce)') ) settings.register( @@ -354,7 +354,7 @@ settings.register( ) ) -#todo: looks like there is a bug in askbot.deps.livesettings +#todo: looks like there is a bug in askbot.deps.livesettings #that does not allow Integer values with defaults and choices settings.register( livesettings.StringValue( diff --git a/askbot/conf/main_pages.py b/askbot/conf/main_pages.py new file mode 100644 index 00000000..940d2e91 --- /dev/null +++ b/askbot/conf/main_pages.py @@ -0,0 +1,83 @@ +""" +Settings responsible for display of questions lists +""" +from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import DATA_AND_FORMATTING +from askbot.deps import livesettings +from django.utils.translation import ugettext_lazy as _ + +MAIN_PAGES = livesettings.ConfigurationGroup( + 'MAIN_PAGES', + _('Logic of the questions page'), + super_group=DATA_AND_FORMATTING + ) + +settings.register( + livesettings.BooleanValue( + MAIN_PAGES, + 'ALL_SCOPE_ENABLED', + default=True, + description=_('Enable "All Questions" selector'), + help_text=_('At least one of these selectors must be enabled') + ) +) + +settings.register( + livesettings.BooleanValue( + MAIN_PAGES, + 'UNANSWERED_SCOPE_ENABLED', + default=True, + description=_('Enable "Unanswered Questions" selector'), + help_text=_('At least one of these selectors must be enabled') + ) +) + +settings.register( + livesettings.BooleanValue( + MAIN_PAGES, + 'FOLLOWED_SCOPE_ENABLED', + default=True, + description=_('Enable "Followed Questions" selector'), + help_text=_('At least one of these selectors must be enabled') + ) +) + +def enable_default_selector_if_disabled(old_value, new_value): + scope_switch_name = new_value.upper() + '_SCOPE_ENABLED' + is_enabled = getattr(settings, scope_switch_name) + if is_enabled is False: + settings.update(scope_switch_name, True) + return new_value + +SCOPE_CHOICES_AUTHENTICATED = ( + ('all', _('All Questions')), + ('unanswered', _('Unanswered Questions')), + ('followed', _('Followed Questions')) +) + +settings.register( + livesettings.StringValue( + MAIN_PAGES, + 'DEFAULT_SCOPE_AUTHENTICATED', + choices=SCOPE_CHOICES_AUTHENTICATED, + default='all', + description=_('Default questions selector for the authenticated users'), + update_callback=enable_default_selector_if_disabled + ) +) + +SCOPE_CHOICES_ANONYMOUS = (#anonymous users can't see followed questions + ('all', _('All Questions')), + ('unanswered', _('Unanswered Questions')), +) + +settings.register( + livesettings.StringValue( + MAIN_PAGES, + 'DEFAULT_SCOPE_ANONYMOUS', + choices=SCOPE_CHOICES_ANONYMOUS, + default='all', + description=_('Default questions selector for the anonymous users'), + update_callback=enable_default_selector_if_disabled + ) +) diff --git a/askbot/conf/questions_page.py b/askbot/conf/questions_page.py new file mode 100644 index 00000000..b1a9b689 --- /dev/null +++ b/askbot/conf/questions_page.py @@ -0,0 +1,71 @@ +""" +Settings responsible for display of questions lists +""" +from askbot.conf.settings_wrapper import settings +from askbot.conf.super_groups import DATA_AND_FORMATTING +from askbot.deps import livesettings +from django.utils.translation import ugettext_lazy as _ + +MAIN_PAGES = livesettings.ConfigurationGroup( + 'MAIN_PAGES', + _('Questions page'), + super_group=DATA_AND_FORMATTING + ) + +settings.register( + livesettings.StringValue( + MAIN_PAGES, + 'ALL_SCOPE_ENABLED', + default=True, + description=_('Enable "All Questions" selector'), + ) +) + +settings.register( + livesettings.BooleanValue( + MAIN_PAGES, + 'UNANSWERED_SCOPE_ENABLED', + default=True, + description=_('Enable "Unanswered Questions" selector'), + ) +) + +settings.register( + livesettings.BooleanValue( + MAIN_PAGES, + 'FOLLOWED_SCOPE_ENABLED', + default=True, + description=_('Enable "Followed Questions" selector'), + ) +) + +SCOPE_CHOICES_AUTHENTICATED = ( + ('all', _('All Questions')), + ('unanswered', _('Unanswered Questions')), + ('followed', _('Followed Questions')) +) + +settings.register( + livesettings.StringValue( + MAIN_PAGES, + 'DEFAULT_SCOPE_AUTHENTICATED', + choices=SCOPE_CHOICES_AUTHENTICATED, + default='all', + description=_('Default questions selector for the authenticated users') + ) +) + +SCOPE_CHOICES_ANONYMOUS = (#anonymous users can't see followed questions + ('all', _('All Questions')), + ('unanswered', _('Unanswered Questions')), +) + +settings.register( + livesettings.StringValue( + MAIN_PAGES, + 'DEFAULT_SCOPE_ANONYMOUS', + choices=SCOPE_CHOICES_ANONYMOUS, + default='all', + description=_('Default questions selector for the anonymous users') + ) +) diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py index 0240d7f5..b9f9325c 100644 --- a/askbot/const/__init__.py +++ b/askbot/const/__init__.py @@ -112,7 +112,7 @@ DEFAULT_POST_SORT_METHOD = 'activity-desc' POST_SCOPE_LIST = ( ('all', _('all')), ('unanswered', _('unanswered')), - ('favorite', _('favorite')), + ('followed', _('followed')), ) DEFAULT_POST_SCOPE = 'all' diff --git a/askbot/deps/django_authopenid/views.py b/askbot/deps/django_authopenid/views.py index 8f33e8c0..9ddb6414 100644 --- a/askbot/deps/django_authopenid/views.py +++ b/askbot/deps/django_authopenid/views.py @@ -99,7 +99,7 @@ def create_authenticated_user_account( user = User.objects.create_user(username, email) user_registered.send(None, user=user) - logging.debug('creating new openid user association for %s') + logging.debug('creating new openid user association for %s', username) if password: user.set_password(password) diff --git a/askbot/deps/livesettings/views.py b/askbot/deps/livesettings/views.py index d12eb602..0f43987c 100644 --- a/askbot/deps/livesettings/views.py +++ b/askbot/deps/livesettings/views.py @@ -7,6 +7,7 @@ from django.views.decorators.cache import never_cache from askbot.deps.livesettings import ConfigurationSettings, forms from askbot.deps.livesettings import ImageValue from askbot.deps.livesettings.overrides import get_overrides +from django.contrib import messages import logging log = logging.getLogger('configuration.views') @@ -15,7 +16,7 @@ def group_settings(request, group, template='livesettings/group_settings.html'): # Determine what set of settings this editor is used for use_db, overrides = get_overrides(); - + mgr = ConfigurationSettings() settings = mgr[group] @@ -42,10 +43,13 @@ def group_settings(request, group, template='livesettings/group_settings.html'): else: continue - if cfg.update(value): - # Give user feedback as to which settings were changed - message='Updated %s on %s' % (cfg.key, cfg.group.key) - request.user.message_set.create(message = message) + try: + if cfg.update(value): + message='Updated %s on %s' % (cfg.key, cfg.group.key) + messages.success(request, message) + #the else if for the settings that are not updated. + except Exception, e: + messages.error(request, e.message) return HttpResponseRedirect(request.path) else: @@ -71,31 +75,31 @@ def site_settings(request): default_group= mgr.groups()[0].key return HttpResponseRedirect(reverse('group_settings', args=[default_group])) #return group_settings(request, group=None, template='livesettings/site_settings.html') - + def export_as_python(request): """Export site settings as a dictionary of dictionaries""" - + from askbot.deps.livesettings.models import Setting, LongSetting import pprint - + work = {} both = list(Setting.objects.all()) both.extend(list(LongSetting.objects.all())) - + for s in both: if not work.has_key(s.site.id): work[s.site.id] = {} sitesettings = work[s.site.id] - + if not sitesettings.has_key(s.group): sitesettings[s.group] = {} sitegroup = sitesettings[s.group] - + sitegroup[s.key] = s.value - + pp = pprint.PrettyPrinter(indent=4) pretty = pp.pformat(work) return render_to_response('livesettings/text.txt', { 'text' : pretty }, mimetype='text/plain') - + export_as_python = never_cache(staff_member_required(export_as_python)) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index d34b1df4..24b72181 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -4,6 +4,7 @@ Changes in Askbot Development version ------------------- * Some support for the media compression (Tyler Mandry) +* Allowed to enable and disable question scopes on the main page * Added full text support for some languages with Postgresql: Danish, Dutch, English, Finnish, French, German, Hungarian, Italian, Japanese (requires package textsearch_ja), Norwegian, diff --git a/askbot/doc/source/contributors.rst b/askbot/doc/source/contributors.rst index b964c7dd..3fa086df 100644 --- a/askbot/doc/source/contributors.rst +++ b/askbot/doc/source/contributors.rst @@ -44,6 +44,7 @@ Programming, bug fixes and documentation * `jtrain <https://github.com/jtrain>`_ * Niki Rocco * `Tyler Mandry <https://github.com/tmandry>`_ +* `Jorge López Pérez <https://github.com/adobo>`_ Translations ------------ diff --git a/askbot/media/bootstrap/css/bootstrap.css b/askbot/media/bootstrap/css/bootstrap.css index e6190005..396e05c6 100644 --- a/askbot/media/bootstrap/css/bootstrap.css +++ b/askbot/media/bootstrap/css/bootstrap.css @@ -935,7 +935,6 @@ input[type="file"] { line-height: 18px \9; } select { - width: 220px; background-color: #ffffff; } select[multiple], @@ -968,6 +967,7 @@ textarea { -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s; } +/* input:focus, textarea:focus { border-color: rgba(82, 168, 236, 0.8); @@ -975,10 +975,9 @@ textarea:focus { -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); outline: 0; - outline: thin dotted \9; - /* IE6-9 */ - + outline: thin dotted \9; ***** for IE6-9 * } +*/ input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus, diff --git a/askbot/media/js/post.js b/askbot/media/js/post.js index 6a583166..5b9bf4ee 100644 --- a/askbot/media/js/post.js +++ b/askbot/media/js/post.js @@ -1544,9 +1544,9 @@ EditCommentForm.prototype.createDom = function(){ div.append(this._textarea); this._text_counter = $('<span></span>').attr('class', 'counter'); div.append(this._text_counter); - this._submit_btn = $('<button class="submit small"></button>'); + this._submit_btn = $('<button class="submit"></button>'); div.append(this._submit_btn); - this._cancel_btn = $('<button class="submit small"></button>'); + this._cancel_btn = $('<button class="submit"></button>'); this._cancel_btn.html(gettext('cancel')); div.append(this._cancel_btn); @@ -2107,7 +2107,7 @@ var socialSharing = function(){ URL = window.location.href; var urlBits = URL.split('/'); URL = urlBits.slice(0, -2).join('/') + '/'; - TEXT = escape($('h1 > a').html()); + TEXT = encodeURIComponent($('h1 > a').html()); var hashtag = encodeURIComponent( askbot['settings']['sharingSuffixText'] ); diff --git a/askbot/media/style/lib_style.less b/askbot/media/style/lib_style.less index 05ab38f5..5e454173 100644 --- a/askbot/media/style/lib_style.less +++ b/askbot/media/style/lib_style.less @@ -17,29 +17,6 @@ @main-font:'Open Sans Condensed', Arial, sans-serif; @secondary-font:Arial; -/* Buttons */ - -.button-style(@h:20px, @f:14px){ - 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%){ diff --git a/askbot/media/style/style.less b/askbot/media/style/style.less index 5dce292c..bd3299cd 100644 --- a/askbot/media/style/style.less +++ b/askbot/media/style/style.less @@ -38,6 +38,9 @@ input, select { font-family: Trebuchet MS, "segoe ui", Helvetica, Tahoma, Verdana, MingLiu, PMingLiu, Arial, sans-serif; margin-left:0px; } +select { + width: 100%; +} input[type="text"].prompt, input[type="password"].prompt, @@ -208,7 +211,7 @@ body.user-messages { .wait-icon-box { text-align: center; - margin-bottom: 8px; + margin: 5px 0 8px; } #closeNotify { @@ -443,6 +446,10 @@ body.user-messages { .sprites(-51px,-36px); } +#scopeNav { + height: 41px; +} + .scope-selector { display:block; float:left; @@ -500,9 +507,7 @@ body.user-messages { width: 100%; margin: 8px 0 6px 0; padding: 0; - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; + .box-shadow(0, 0, 0); } div.input-tool-tip { @@ -552,13 +557,13 @@ body.user-messages { .footer { text-align: center; - padding-bottom: 10px; + padding: 9px 0 10px 0; } } .search-drop-menu.empty { ul { - padding: 5px; + padding: 1px; margin: 0; } } @@ -579,9 +584,11 @@ input[type="submit"].searchBtn { line-height: 22px; text-align: center; float:right; - margin: 7px 28px 0 0; + margin: -33px 28px 0 0; width: 48px; - .sprites(-98px,-36px); + .sprites(-98px,-37px); + .rounded-corners(0); + .box-shadow(0, 0, 0); cursor:pointer; position: relative; z-index: 10001; @@ -604,8 +611,14 @@ input[type="submit"].searchBtn { } } -.searchBtn:hover { - .sprites(-98px-48,-36px); +input[type="submit"].searchBtn:hover { + background-image: none; + background-image: none; + background-image: none; + background-image: none; + background-image: none; + background-image: none; + .sprites(-98px-48,-37px); } .cancelSearchBtn { @@ -616,11 +629,12 @@ input[type="submit"].searchBtn { line-height: 42px; border:0px; border-left:#deded0 1px solid; + .box-shadow(0, 0, 0); text-align: center; width: 35px; cursor:pointer; float: right; - margin-top: 7px; + margin: 7px 0 0 0; position: relative; z-index: 10001; } @@ -629,17 +643,63 @@ input[type="submit"].searchBtn { color: #d84040; } -#askButton{ /* check blocks/secondary_header.html and widgets/ask_button.html*/ - line-height:44px; - margin-top:6px; - float:right; - text-transform:uppercase; - .button-style(42px, 20px); - width: 200px;/* to match width of sidebar */ +button, +input[type="submit"], +input[type="button"], +input[type="reset"], +.button { + cursor: pointer; + color: @button-label; + height: 27px; + font-family: @main-font; + font-size: 14px; + font-weight: bold; + text-align: center; + text-decoration: none; + .text-shadow(0px,1px,0px,#c6d9dd); + border: 0 !important; + border-top: #eaf2f3 1px solid; + .linear-gradient(#d1e2e5,#a9c2c7); + .rounded-corners(4px); + .box-shadow(1px, 1px, 2px, #636363) +} +button.large, +input[type="submit"].large, +input[type="button"].large, +input[type="reset"].large, +.button.large { + font-size: 20px; + height: 35px; + line-height: 35px; + padding: 0 10px; +} + +button:hover, +input[type="submit"]:hover, +.button:hover { + .linear-gradient(#cde5e9,#94b3ba); + text-decoration:none; + .text-shadow(0px, 1px, 0px, #c6d9dd); +} + +input[type="submit"].link { + .box-shadow(0, 0, 0); + .text-shadow(0, 0, 0); + font-weight: normal; } -#askButton:hover{ - .button-style-hover; +input[type="submit"].link:hover { + text-decoration: underline; +} + +#askButton { /* check blocks/secondary_header.html and widgets/ask_button.html*/ + float:right; + font-size: 20px; + height: 42px; + line-height: 44px; + margin-top: -35px; + text-transform: uppercase; + width: 200px;/* to match width of sidebar */ } /* @@ -662,12 +722,21 @@ input[type="submit"].searchBtn { body.anon.ask-page .search-drop-menu { margin: 0; } -body.anon { - #searchBar, - .search-drop-menu { - margin-left: 227px;/* we don't have the "followed" scope */ - } +#searchBar.scopes-True-True-False { + margin-left: 228px; +} +#searchBar.scopes-True-False-True { + margin-left: 203px; +} +#searchBar.scopes-False-True-True { + margin-left: 286px; +} +#searchBar.scopes-True-False-False, +#searchBar.scopes-False-True-False, +#searchBar.scopes-False-False-True { + margin-left: 52px; } + #searchBar.cancelable { padding-right: 82px; } @@ -697,7 +766,7 @@ body.anon { .box { background: #fff; - padding: 4px 0px 10px 0px; + padding: 4px 0px 10px 1px; width:200px; overflow: hidden; @@ -800,16 +869,8 @@ body.anon { #subscribedTagAdd, #ab-tag-search-add { border:0; - font-weight:bold; margin-top:-2px; - .button-style(27px, 14px); - .rounded-corners(4px); } - #interestingTagAdd:hover, - #ignoredTagAdd:hover, - #ab-tag-search-add:hover { - .button-style-hover; - } #ab-tag-search-add { width: 47px; } @@ -822,21 +883,17 @@ body.anon { /* widgets for question template */ a.followed, a.follow{ + height: 34px; + font-size: 21px; line-height:34px; border:0; font-weight:normal; margin-top:3px; display:block; - .button-style(34px,21px); .center; width: 130px; } - a.followed:hover, a.follow:hover{ - .button-style-hover; - .text-shadow(0px, 1px, 0px, #c6d9dd); - } - a.followed div.unfollow{ display:none; } @@ -1334,7 +1391,7 @@ ul.tags.marked-tags, ul#related-tags { list-style: none; margin: 0; - padding: 0; + padding: 0 0 0 1px; line-height: 170%; display: block; } @@ -1357,9 +1414,7 @@ ul.tags.marked-tags li, } #tagSelector div.inputs { - clear: both; - float: none; - margin-bottom:10px; + margin: 6px 0 12px 0; } .tags-page ul.tags li, @@ -1660,10 +1715,7 @@ ul#related-tags li { .add-groups, .add-users { border:0; - font-weight:bold; margin-top:-2px; - .button-style(27px, 14px); - .rounded-corners(4px); } .share-input-col { @@ -1679,10 +1731,6 @@ ul#related-tags li { height: 25px; } -.add-groups:hover { - .button-style-hover; -} - #id_user, #id_user_author { border:#cce6ec 3px solid; @@ -1704,10 +1752,7 @@ ul#related-tags li { .add-groups, .add-users { border:0; - font-weight:bold; margin-top:-2px; - .button-style(27px, 14px); - .rounded-corners(4px); } .add-everyone-group { @@ -1717,10 +1762,6 @@ ul#related-tags li { padding: 0 10px; } -.add-groups:hover { - .button-style-hover; -} - #id_user, #id_user_author { border:#cce6ec 3px solid; @@ -1749,18 +1790,12 @@ ul#related-tags li { .edit-question-page input.submit { float: left; font-weight:normal; + height: 35px; + font-size: 20px; margin-top:3px; - .button-style(34px,21px); margin-right:7px; } -#fmanswer input.submit:hover, -.ask-page input.submit:hover, -.edit-question-page input.submit:hover{ - .button-style-hover; - .text-shadow(0px, 1px, 0px, #c6d9dd) -} - .wmd-container { border:#cce6ec 3px solid; textarea { @@ -1768,7 +1803,7 @@ ul#related-tags li { } } .users-page .wmd-container { - width: 200px; + width: auto; } .ask-page, .question-page, @@ -1803,7 +1838,7 @@ ul#related-tags li { } .users-page #editor { - width: 192px; + width: 187px; } #id_title { @@ -2264,22 +2299,25 @@ ul#related-tags li { clear: both; div.controls { - clear: both; + clear: both; float:left; width: 100%; margin: 3px 0 20px 5px; } .controls a { - color: #988e4c; - padding: 0 3px 2px 22px; - font-family:@body-font; - font-size:13px; - background:url(../images/comment.png) no-repeat center left; + border: none; + color: #988e4c; + padding: 0 3px 5px 22px; + font-family: @body-font; + font-size: 13px; + font-weight: normal; + background: url(../images/comment.png) no-repeat center left; + .box-shadow(0, 0, 0); + .text-shadow(0, 0, 0); } .controls a:hover { - background-color: #f5f0c9; text-decoration: none; } @@ -2296,43 +2334,35 @@ ul#related-tags li { } form.post-comments { - margin: 3px 26px 0 42px; - textarea{ - font-size: 13px; - line-height: 1.3; - - } + padding: 6px 6px 7px 42px; + border-bottom: 1px solid #edeeeb; + margin-bottom: 0; } textarea { - height: 42px; - width:100%; - margin: 7px 0 5px 1px; + box-sizing: border-box; + border: #cce6ec 3px solid; font-family: @body-font; + font-size: 13px; + height: 54px; + line-height: 1.3; + margin: -1px 0 7px 1px; outline: none; overflow:auto; - font-size: 12px; - line-height: 140%; - padding-left:2px; - padding-top:3px; - border:#cce6ec 3px solid; + padding: 0px 19px 2px 3px; + width:100%; } - input { margin-left: 10px; margin-top: 1px; vertical-align: top; width: 100px; } - button{ - line-height:25px; - margin-bottom:5px; - .button-style(27px, 12px); - font-family:@body-font; - font-weight:bold; - } - button:hover{ - .button-style-hover; + button.submit { + height: 26px; + line-height: 26px; + padding: 0 8px; + margin-right: 6px; } .counter { display: inline-block; @@ -2346,16 +2376,13 @@ ul#related-tags li { } .comment { border-bottom: 1px solid #edeeeb; - clear:both; + clear: both; margin: 0; - margin-top:8px; - padding-bottom:4px; + padding-bottom: 4px; overflow: auto; - font-family:@body-font; - font-size:11px; + font-family: @body-font; + font-size: 11px; min-height: 25px; - background:#fff url(../images/comment-background.png) bottom repeat-x; - .rounded-corners(5px); } div.comment:hover { background-color: #efefef; @@ -2402,29 +2429,32 @@ ul#related-tags li { padding-left:6px; } - .convert-comment{ - display: inline; - white-space: nowrap; - padding-left: 0px; - } + .convert-comment { + display: inline; + white-space: nowrap; + padding-left: 0px; + input { + background: none; + padding: 0px; + color: #1B79BD; + border:none; + height: 13px; + width:auto; + font-family: Arial; + font-size: 13px; + font-weight: normal; + line-height: 13px; + margin: 0 0 0 8px; + .box-shadow(0, 0, 0); + .text-shadow(0, 0, 0); + } - .convert-comment input{ - background: none; - padding: 0px; - color: #1B79BD; - border:none; - width:auto; - font-family: Arial; - line-height: 14px; - margin-left: 6px; - font-size: 13px; - box-shadow: none; + input:hover { + text-decoration: underline; + cursor: pointer; + } } - .convert-comment input:hover{ - text-decoration:underline; - cursor:pointer; - } } .comment-body p{ @@ -2708,11 +2738,6 @@ ul#related-tags li { input.submit{ font-weight:normal; margin:5px 0px; - .button-style(26px,15px); - font-family:@body-font; - } - input.submit:hover{ - .button-style-hover; } .cancel{ background:url(../images/small-button-cancel.png) repeat-x top !important; @@ -2727,6 +2752,18 @@ ul#related-tags li { } } +.user-profile-page.inbox-group-join-requests { + form { + margin-bottom: 0; + } + table { + margin-bottom: 13px; + } + td { + padding-right: 10px; + } +} + .inbox-flags.user-profile-page { .re { width: 810px; @@ -2759,17 +2796,6 @@ ul#related-tags li { border:#cce6ec 3px solid; width:200px; } - .submit-b{ - .button-style(24px,15px); - font-family:@body-font; - font-weight:bold; - padding-right:10px; - border:0; - } - - .submit-b:hover{ - .button-style-hover; - } } @@ -2901,12 +2927,6 @@ a:hover.medal { .inputs { margin-top: 10px; margin-bottom: 10px; - input[type='submit']{ - .button-style(26px,15px); - } - } - input[type='submit'].select-language { - .button-style(26px,15px); } select { margin-bottom: 12px; @@ -2930,16 +2950,17 @@ a:hover.medal { p{font-size:13px;} } +.follow-toggle { + height: auto; +} + .follow-toggle,.submit { - border:0 !important; font-weight:bold; line-height:26px; margin-top:-2px; - .button-style(26px,14px); } .follow-toggle:hover, .submit:hover { - .button-style-hover; text-decoration:none !important; } @@ -4332,10 +4353,6 @@ textarea.tipped-input { border-spacing: 10px; border-collapse: separate; - button { - .button-style(27px, 14px); - } - form { display: inline-block; margin-bottom: 0; diff --git a/askbot/models/question.py b/askbot/models/question.py index 51a7c24b..5526d3a8 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -336,7 +336,7 @@ class ThreadManager(BaseQuerySetManager): else: raise Exception('UNANSWERED_QUESTION_MEANING setting is wrong') - elif search_state.scope == 'favorite': + elif search_state.scope == 'followed': favorite_filter = models.Q(favorited_by=request_user) if 'followit' in django_settings.INSTALLED_APPS: followed_users = request_user.get_followed_users() diff --git a/askbot/search/state_manager.py b/askbot/search/state_manager.py index 7b6b746c..efefbc40 100644 --- a/askbot/search/state_manager.py +++ b/askbot/search/state_manager.py @@ -9,6 +9,7 @@ from django.utils.encoding import smart_str import askbot import askbot.conf +from askbot.conf import settings as askbot_settings from askbot import const from askbot.utils.functions import strip_plus @@ -90,8 +91,11 @@ class SearchState(object): def __init__(self, scope, sort, query, tags, author, page, user_logged_in): # INFO: zip(*[('a', 1), ('b', 2)])[0] == ('a', 'b') - if (scope not in zip(*const.POST_SCOPE_LIST)[0]) or (scope == 'favorite' and not user_logged_in): - self.scope = const.DEFAULT_POST_SCOPE + if (scope not in zip(*const.POST_SCOPE_LIST)[0]) or (scope == 'followed' and not user_logged_in): + if user_logged_in: + self.scope = askbot_settings.DEFAULT_SCOPE_AUTHENTICATED + else: + self.scope = askbot_settings.DEFAULT_SCOPE_ANONYMOUS else: self.scope = scope diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index ee5f8935..3b41dfbd 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -169,6 +169,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.humanize', 'django.contrib.sitemaps', + 'django.contrib.messages', #'debug_toolbar', #'haystack', 'askbot', @@ -263,7 +264,7 @@ TINYMCE_COMPRESSOR = True TINYMCE_SPELLCHECKER = False TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'default/media/js/tinymce/') -TINYMCE_URL = STATIC_URL + 'default/media/js/tinymce/' +#TINYMCE_JS_URL = STATIC_URL + 'default/media/js/tinymce/tiny_mce.js' TINYMCE_DEFAULT_CONFIG = { 'plugins': 'askbot_imageuploader,askbot_attachment', 'convert_urls': False, @@ -283,8 +284,16 @@ TINYMCE_DEFAULT_CONFIG = { 'theme_advanced_resizing': True, 'theme_advanced_resize_horizontal': False, 'theme_advanced_statusbar_location': 'bottom', + 'width': '730', 'height': '250' } #delayed notifications, time in seconds, 15 mins by default NOTIFICATION_DELAY_TIME = 60 * 15 + +GROUP_MESSAGING = { + 'BASE_URL_GETTER_FUNCTION': 'askbot.models.user_get_profile_url', + 'BASE_URL_PARAMS': {'section': 'messages', 'sort': 'inbox'} +} + +ASKBOT_MULTILINGUAL = False diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index bd77e82e..61ee5993 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -163,6 +163,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.humanize', 'django.contrib.sitemaps', + 'django.contrib.messages', #'debug_toolbar', #Optional, to enable haystack search #'haystack', @@ -250,10 +251,10 @@ HAYSTACK_SITECONF = 'askbot.search.haystack' #http://django-haystack.readthedocs.org/en/v1.2.7/settings.html HAYSTACK_SEARCH_ENGINE = 'simple' -TINYMCE_COMPRESSOR = True +TINYMCE_COMPRESSOR = True TINYMCE_SPELLCHECKER = False TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'default/media/js/tinymce/') -TINYMCE_URL = STATIC_URL + 'default/media/js/tinymce/' +#TINYMCE_JS_URL = STATIC_URL + 'default/media/js/tinymce/tiny_mce.js' TINYMCE_DEFAULT_CONFIG = { 'plugins': 'askbot_imageuploader,askbot_attachment', 'convert_urls': False, @@ -274,7 +275,7 @@ TINYMCE_DEFAULT_CONFIG = { 'theme_advanced_resizing': True, 'theme_advanced_resize_horizontal': False, 'theme_advanced_statusbar_location': 'bottom', - 'width': '723', + 'width': '730', 'height': '250' } @@ -285,3 +286,5 @@ GROUP_MESSAGING = { 'BASE_URL_GETTER_FUNCTION': 'askbot.models.user_get_profile_url', 'BASE_URL_PARAMS': {'section': 'messages', 'sort': 'inbox'} } + +ASKBOT_MULTILINGUAL = False diff --git a/askbot/setup_templates/urls.py b/askbot/setup_templates/urls.py index 35f1c5b3..4c76781b 100644 --- a/askbot/setup_templates/urls.py +++ b/askbot/setup_templates/urls.py @@ -30,7 +30,7 @@ urlpatterns += patterns('', (r'^tinymce/', include('tinymce.urls')), (r'^robots.txt$', include('robots.urls')), url( # TODO: replace with django.conf.urls.static ? - r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], + r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT.replace('\\','/')}, ), diff --git a/askbot/skins/loaders.py b/askbot/skins/loaders.py index eb72cf09..88dc2ef0 100644 --- a/askbot/skins/loaders.py +++ b/askbot/skins/loaders.py @@ -5,6 +5,7 @@ from django.template import TemplateDoesNotExist from django.http import HttpResponse from django.utils import translation from django.conf import settings as django_settings +from django.core.exceptions import ImproperlyConfigured from coffin.common import CoffinEnvironment from jinja2 import loaders as jinja_loaders from jinja2.exceptions import TemplateNotFound @@ -92,7 +93,12 @@ SKINS = load_skins() def get_skin(request = None): """retreives the skin environment for a given request (request var is not used at this time)""" - return SKINS[askbot_settings.ASKBOT_DEFAULT_SKIN] + skin_name = askbot_settings.ASKBOT_DEFAULT_SKIN + try: + return SKINS[skin_name] + except KeyError: + msg_fmt = 'skin "%s" not found, check value of "ASKBOT_EXTRA_SKINS_DIR"' + raise ImproperlyConfigured(msg_fmt % skin_name) def get_askbot_template(template, request = None): """ diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 7b1aa709..7d2e0216 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -251,7 +251,7 @@ def test_template_loader(): errors.append( '"%s" must be the first element of TEMPLATE_LOADERS' % current_loader ) - + print_errors(errors) def test_celery(): @@ -683,7 +683,6 @@ def test_tinymce(): required_attrs = ( 'TINYMCE_COMPRESSOR', 'TINYMCE_JS_ROOT', - 'TINYMCE_URL', 'TINYMCE_DEFAULT_CONFIG' ) @@ -738,16 +737,6 @@ def test_tinymce(): error_tpl += '\nNote: we have moved files from "common" into "default"' errors.append(error_tpl % relative_js_path) - #check url setting - url = getattr(django_settings, 'TINYMCE_URL', '') - expected_url = django_settings.STATIC_URL + relative_js_path - old_expected_url = django_settings.STATIC_URL + old_relative_js_path - if urls_equal(url, expected_url) is False: - error_tpl = "add line: TINYMCE_URL = STATIC_URL + '%s'" - if urls_equal(url, old_expected_url): - error_tpl += '\nNote: we have moved files from "common" into "default"' - errors.append(error_tpl % relative_js_path) - if errors: header = 'Please add the tynymce editor configuration ' + \ 'to your settings.py file.' @@ -795,7 +784,7 @@ def test_template_context_processors(): required_processors.append(new_auth_processor) if old_auth_processor in django_settings.TEMPLATE_CONTEXT_PROCESSORS: invalid_processors.append(old_auth_processor) - + missing_processors = list() for processor in required_processors: if processor not in django_settings.TEMPLATE_CONTEXT_PROCESSORS: @@ -864,7 +853,7 @@ def test_group_messaging(): errors.append( "make setting 'GROUP_MESSAGING to be exactly:\n" + settings_sample ) - + url_params = settings.get('BASE_URL_PARAMS', None) else: errors.append('add this to your settings.py:\n' + settings_sample) @@ -893,7 +882,7 @@ def test_multilingual(): errors.append('ASKBOT_MULTILINGUAL=True works only with django >= 1.4') if is_multilang: - middleware = 'django.middleware.locale.LocaleMiddleware' + middleware = 'django.middleware.locale.LocaleMiddleware' if middleware not in django_settings.MIDDLEWARE_CLASSES: errors.append( "add 'django.middleware.locale.LocaleMiddleware' to your MIDDLEWARE_CLASSES " @@ -909,6 +898,10 @@ def test_multilingual(): print_errors(errors) +def test_messages_framework(): + if not 'django.contrib.messages' in django_settings.INSTALLED_APPS: + errors = ('Add to the INSTALLED_APPS section of your settings.py:\n "django.contrib.messages"', ) + print_errors(errors) def run_startup_tests(): """function that runs @@ -932,6 +925,7 @@ def run_startup_tests(): test_new_skins() test_media_url() #test_postgres() + test_messages_framework() test_middleware() test_multilingual() #test_csrf_cookie_domain() diff --git a/askbot/templates/answer_edit.html b/askbot/templates/answer_edit.html index f80715ec..875eec5b 100644 --- a/askbot/templates/answer_edit.html +++ b/askbot/templates/answer_edit.html @@ -40,8 +40,18 @@ {% endif %} </div> <div class="after-editor"> - <input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> - <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> + <input + id="edit_post_form_submit_button" + type="submit" + value="{% trans %}Save edit{% endtrans %}" + class="large submit" + /> + <input + type="button" + value="{% trans %}Cancel{% endtrans %}" + class="large submit" + onclick="history.back(-1);" + /> </div> </form> diff --git a/askbot/templates/authopenid/authopenid_macros.html b/askbot/templates/authopenid/authopenid_macros.html index 9d35ac6f..d0dca8bf 100644 --- a/askbot/templates/authopenid/authopenid_macros.html +++ b/askbot/templates/authopenid/authopenid_macros.html @@ -63,7 +63,7 @@ <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{% endtrans %}"/> + <input type="submit" name="openid_login_with_extra_token" value="{% trans %}Sign in{% endtrans %}"/> </fieldset> {% endif %} {% endmacro %} diff --git a/askbot/templates/authopenid/signin.html b/askbot/templates/authopenid/signin.html index c5a5c47f..ff7d47a4 100644 --- a/askbot/templates/authopenid/signin.html +++ b/askbot/templates/authopenid/signin.html @@ -115,7 +115,7 @@ </tr>
</table>
<p id="local_login_buttons">
- <input class="submit-b" name="login_with_password" type="submit" value="{% trans %}Sign in{% endtrans %}" />
+ <input name="login_with_password" type="submit" value="{% trans %}Sign in{% endtrans %}" />
{% if settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
<a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}?login_provider=local">{% trans %}Create a password-protected account{% endtrans %}</a>
{% endif %}
@@ -145,7 +145,7 @@ </tr>
</table>
<p id="local_login_buttons">
- <input class="submit-b" name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
+ <input name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
</p>
{% endif %}
</fieldset>
@@ -212,7 +212,6 @@ {% endif %}
{{ account_recovery_form.email }}
<input
- class="submit-b"
type="submit"
{% if view_subtype == 'bad_key' %}
value="{% trans %}Send a new recovery key{% endtrans %}"
diff --git a/askbot/templates/authopenid/widget_signin.html b/askbot/templates/authopenid/widget_signin.html index c3dbcfde..72860120 100644 --- a/askbot/templates/authopenid/widget_signin.html +++ b/askbot/templates/authopenid/widget_signin.html @@ -115,7 +115,7 @@ </tr>
</table>
<p id="local_login_buttons">
- <input class="submit-b" name="login_with_password" type="submit" value="{% trans %}Sign in{% endtrans %}" />
+ <input name="login_with_password" type="submit" value="{% trans %}Sign in{% endtrans %}" />
{% if settings.USE_LDAP_FOR_PASSWORD_LOGIN == False %}
<a class="create-password-account" style="vertical-align:middle" href="{% url user_signup_with_password %}?login_provider=local">{% trans %}Create a password-protected account{% endtrans %}</a>
{% endif %}
@@ -145,7 +145,7 @@ </tr>
</table>
<p id="local_login_buttons">
- <input class="submit-b" name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
+ <input name="change_password" type="submit" value="{% trans %}Change password{% endtrans %}" />
</p>
{% endif %}
</fieldset>
@@ -212,7 +212,6 @@ {% endif %}
{{ account_recovery_form.email }}
<input
- class="submit-b"
type="submit"
{% if view_subtype == 'bad_key' %}
value="{% trans %}Send a new recovery key{% endtrans %}"
diff --git a/askbot/templates/list_suggested_tags.html b/askbot/templates/list_suggested_tags.html index 31e48c09..660c8308 100644 --- a/askbot/templates/list_suggested_tags.html +++ b/askbot/templates/list_suggested_tags.html @@ -31,8 +31,8 @@ {% if tag.threads.count() == 0 %} <tr class="thread-info" data-thread-id="0"> <td class="per-thread-controls"> - <button class="btn accept">{% trans %}Accept{% endtrans %}</button> - <button class="btn reject">{% trans %}Reject{% endtrans %}</button> + <button class="accept">{% trans %}Accept{% endtrans %}</button> + <button class="reject">{% trans %}Reject{% endtrans %}</button> </td> <td class="thread-links-col"> <span>{% trans %}There are no questions with this tag yet{% endtrans %}</span> @@ -42,8 +42,8 @@ {% for thread in tag.threads.all() %} <tr class="thread-info" data-thread-id="{{ thread.id }}"> <td class="per-thread-controls"> - <button class="btn accept">{% trans %}Accept{% endtrans %}</button> - <button class="btn reject">{% trans %}Reject{% endtrans %}</button> + <button class="accept">{% trans %}Accept{% endtrans %}</button> + <button class="reject">{% trans %}Reject{% endtrans %}</button> </td> <td class="thread-links-col"> <a title="{{ thread._question_post().summary|escape }}" @@ -59,8 +59,8 @@ <tr class="per-tag-controls" data-tag-id="{{ tag.id }}"> <td colspan="4"> {% if tag.threads.count() > 1 %} - <button class="btn accept">{% trans name=tag.name %}Apply tag "{{ name }}" to all above questions{% endtrans %}</button> - <button class="btn reject">{% trans %}Reject tag{% endtrans %}</button> + <button class="accept">{% trans name=tag.name %}Apply tag "{{ name }}" to all above questions{% endtrans %}</button> + <button class="reject">{% trans %}Reject tag{% endtrans %}</button> {% endif %} </td> </tr> diff --git a/askbot/templates/macros.html b/askbot/templates/macros.html index f94fc12d..6c6b22d4 100644 --- a/askbot/templates/macros.html +++ b/askbot/templates/macros.html @@ -258,7 +258,7 @@ poor design of the data or methods on data objects #} -%} {% if acceptance_level in ('open', 'moderated') %} <button - class="group-join-btn follow-toggle {% if membership_level != 'none' %}on on-state{% endif %}" + class="group-join-btn button follow-toggle {% if membership_level != 'none' %}on on-state{% endif %}" data-group-id="{{group_id}}" {% if acceptance_level == 'open' %} data-off-prompt-text="{% trans %}Leave this group{% endtrans %}" @@ -564,7 +564,7 @@ answer {% if answer.accepted() %}accepted-answer{% endif %} {% if answer.author_ {%- macro follow_toggle(follow, name, alias, id) -%} {# follow - boolean; name - object type name; alias - e.g. users name; id - object id #} <div - class="follow-toggle follow-user-toggle" + class="button follow-toggle follow-user-toggle" id="follow-{{ name|escape }}-{{ id }}" > {% if follow %} diff --git a/askbot/templates/main_page/nothing_found.html b/askbot/templates/main_page/nothing_found.html index 1e2c5445..98629476 100644 --- a/askbot/templates/main_page/nothing_found.html +++ b/askbot/templates/main_page/nothing_found.html @@ -3,7 +3,7 @@ {% if search_state.scope == "unanswered" %} {% trans %}There are no unanswered questions here{% endtrans %} {% endif %} -{% if search_state.scope == "favorite" %} +{% if search_state.scope == "followed" %} {% trans %}No questions here. {% endtrans %} {% trans %}Please follow some questions or follow some users.{% endtrans %} {% endif %} diff --git a/askbot/templates/question.html b/askbot/templates/question.html index e40fcda1..482f5e72 100644 --- a/askbot/templates/question.html +++ b/askbot/templates/question.html @@ -150,6 +150,14 @@ if (flags.length > 0) { removeNode(flags[0]); } + var closeBtn = findChildrenByClassName(controls, 'question-close'); + if ( + closeBtn.length === 1 && + data['userReputation'] < + {{ settings.MIN_REP_TO_CLOSE_OTHERS_QUESTIONS }} + ) { + removeNode(closeBtn[0]); + } if (//maybe remove "edit" button data['userReputation'] < {{settings.MIN_REP_TO_EDIT_OTHERS_POSTS}} diff --git a/askbot/templates/question/answer_controls.html b/askbot/templates/question/answer_controls.html index c7d3c4d9..21aafe47 100644 --- a/askbot/templates/question/answer_controls.html +++ b/askbot/templates/question/answer_controls.html @@ -67,6 +67,7 @@ <input type="hidden" name="answer_id" id="id_answer_id" value="{{answer.id}}"/> <input type="submit" + class="link" value="{% trans %}repost as a question comment{% endtrans %}" /> </form> @@ -80,6 +81,7 @@ <input type="hidden" name="answer_id" value="{{ answer.id }}"/> <input type="submit" + class="link" value="{% trans %}repost as a comment under the older answer{% endtrans %}" /> </form> diff --git a/askbot/templates/question/content.html b/askbot/templates/question/content.html index 7efc1d54..4481fb9a 100644 --- a/askbot/templates/question/content.html +++ b/askbot/templates/question/content.html @@ -27,7 +27,7 @@ {# buttons below cannot be cached yet #} {% if user_already_gave_answer %} <a - class="submit" + class="button submit" href="{% url "edit_answer" previous_answer.id %}" >{% trans %}Edit Your Previous Answer{% endtrans %}</a> <span>{% trans %}(only one answer per question is allowed){% endtrans %}</span> diff --git a/askbot/templates/question/new_answer_form.html b/askbot/templates/question/new_answer_form.html index bc51f44a..f9559c4d 100644 --- a/askbot/templates/question/new_answer_form.html +++ b/askbot/templates/question/new_answer_form.html @@ -10,7 +10,7 @@ {% if request.user.is_anonymous() and settings.ALLOW_POSTING_BEFORE_LOGGING_IN == False %} {% if not thread.closed %} <a - class="submit" + class="button submit" href="{{settings.LOGIN_URL}}?next={% url question question.id %}" >{% trans %}Login/Signup to Answer{% endtrans %}</a> {% endif %} diff --git a/askbot/templates/question_edit.html b/askbot/templates/question_edit.html index 7cf1c143..1aaa972c 100644 --- a/askbot/templates/question_edit.html +++ b/askbot/templates/question_edit.html @@ -54,8 +54,8 @@ </div> {% endif %} </div> - <input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" /> - <input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" /> + <input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="large submit" /> + <input type="button" value="{% trans %}Cancel{% endtrans %}" class="large submit" onclick="history.back(-1);" /> </div> </form> diff --git a/askbot/templates/tags/form_bulk_tag_subscription.html b/askbot/templates/tags/form_bulk_tag_subscription.html index d588cfaf..95168e45 100644 --- a/askbot/templates/tags/form_bulk_tag_subscription.html +++ b/askbot/templates/tags/form_bulk_tag_subscription.html @@ -9,7 +9,7 @@ <form action="." method="POST" accept-charset="utf-8"> <table border="0"> {{form.as_table()}} -<tr><td colspan='2' style='text-align: right;'><input type="submit" class="submit" value="Save"></td></tr> +<tr><td/><td><input type="submit" class="submit" value="Save"></td></tr> </table> </form> {% endblock %} diff --git a/askbot/templates/user_inbox/group_join_requests.html b/askbot/templates/user_inbox/group_join_requests.html index 2defe5e1..c4c4d29d 100644 --- a/askbot/templates/user_inbox/group_join_requests.html +++ b/askbot/templates/user_inbox/group_join_requests.html @@ -22,7 +22,6 @@ /> <input type="hidden" name="action" value="approve"/> <input - class="btn" type="submit" value="{% trans %}Approve{% endtrans %}" /> @@ -38,7 +37,6 @@ /> <input type="hidden" name="action" value="deny"/> <input - class="btn" type="submit" value="{% trans %}Deny{% endtrans %}" /> diff --git a/askbot/templates/widgets/ask_button.html b/askbot/templates/widgets/ask_button.html index e202b110..f8ea82bd 100644 --- a/askbot/templates/widgets/ask_button.html +++ b/askbot/templates/widgets/ask_button.html @@ -4,6 +4,7 @@ {% endif %} <a id="askButton" + class="button" href="{{ search_state.full_ask_url() }}{% if group %}{% if '?' in search_state.full_ask_url() %}&{% else %}?{% endif %}group_id={{ group.id }}{% endif %}" >{% if group %}{% trans %}Ask the Group{% endtrans %}{% else %}{% trans %}Ask Your Question{% endtrans %}{% endif %}</a> {% endif %} diff --git a/askbot/templates/widgets/scope_nav.html b/askbot/templates/widgets/scope_nav.html index b68d899c..254c3b48 100644 --- a/askbot/templates/widgets/scope_nav.html +++ b/askbot/templates/widgets/scope_nav.html @@ -1,17 +1,33 @@ +{% set need_scope_links = ( + settings.ALL_SCOPE_ENABLED|to_int + + settings.UNANSWERED_SCOPE_ENABLED|to_int + + (request.user.is_authenticated() and settings.FOLLOWED_SCOPE_ENABLED)|to_int + > 1 + ) +%} <div id="scopeNav"> -{% if active_tab != "ask" %} - {% if not search_state %} {# get empty SearchState() if there's none #} - {% set search_state=search_state|get_empty_search_state %} +{% if need_scope_links %} + {% if active_tab != "ask" %} + {% if not search_state %} {# get empty SearchState() if there's none #} + {% set search_state=search_state|get_empty_search_state %} + {% endif %} + {% if settings.ALL_SCOPE_ENABLED %} + <a class="scope-selector {% if scope == 'all' %}on{% endif %}" + href="{{ search_state.change_scope('all').full_url() }}" + title="{% trans %}see all questions{% endtrans %}">{% trans %}ALL{% endtrans %}</a> + {% endif %} + {% if settings.UNANSWERED_SCOPE_ENABLED %} + <a class="scope-selector {% if scope == 'unanswered' %}on{% endif %}" + href="{{ search_state.change_scope('unanswered').change_sort('answers-asc').full_url() }}" + title="{% trans %}see unanswered questions{% endtrans %}">{% trans %}UNANSWERED{% endtrans %}</a> + {% endif %} + {% if request.user.is_authenticated() and settings.FOLLOWED_SCOPE_ENABLED %} + <a class="scope-selector {% if scope == 'followed' %}on{% endif %}" + href="{{ search_state.change_scope('followed').full_url() }}" + title="{% trans %}see your followed questions{% endtrans %}">{% trans %}FOLLOWED{% endtrans %}</a> + {% endif %} + {% else %} + <div class="scope-selector ask-message">{% trans %}Please ask your question here{% endtrans %}</div> {% endif %} - <a class="scope-selector {% if scope == 'all' %}on{% endif %}" - href="{{ search_state.change_scope('all').full_url() }}" title="{% trans %}see all questions{% endtrans %}">{% trans %}ALL{% endtrans %}</a> - <a class="scope-selector {% if scope == 'unanswered' %}on{% endif %}" - href="{{ search_state.change_scope('unanswered').change_sort('answers-asc').full_url() }}" title="{% trans %}see unanswered questions{% endtrans %}">{% trans %}UNANSWERED{% endtrans %}</a> - {% if request.user.is_authenticated() %} - <a class="scope-selector {% if scope == 'favorite' %}on{% endif %}" - href="{{ search_state.change_scope('favorite').full_url() }}" title="{% trans %}see your followed questions{% endtrans %}">{% trans %}FOLLOWED{% endtrans %}</a> - {% endif %} -{% else %} - <div class="scope-selector ask-message">{% trans %}Please ask your question here{% endtrans %}</div> {% endif %} </div> diff --git a/askbot/templates/widgets/search_bar.html b/askbot/templates/widgets/search_bar.html index 8c485c73..d1e9e531 100644 --- a/askbot/templates/widgets/search_bar.html +++ b/askbot/templates/widgets/search_bar.html @@ -1,6 +1,14 @@ {% if active_tab != "ask" %} {% spaceless %} -<div id="searchBar" {% if query %}class="cancelable"{% endif %}> +{% set enabled_scopes_class = 'scopes-' + + '%s'|format(settings.ALL_SCOPE_ENABLED) + '-' + + '%s'|format(settings.UNANSWERED_SCOPE_ENABLED) + '-' + + '%s'|format((request.user.is_authenticated() and settings.FOLLOWED_SCOPE_ENABLED)) +%} +<div + id="searchBar" + class="{% if query %}cancelable{% endif %} {{ enabled_scopes_class }}" +> {# url action depends on which tab is active #} {% if active_tab == "tags" %} <input type="hidden" name="t" value="tag"/> diff --git a/askbot/templates/widgets/tag_selector.html b/askbot/templates/widgets/tag_selector.html index 7c6fe92e..ba304d2c 100644 --- a/askbot/templates/widgets/tag_selector.html +++ b/askbot/templates/widgets/tag_selector.html @@ -14,6 +14,7 @@ "remove '%(tag_name)s' from the list of interesting tags"| format(tag_name = tag_name) #} + <div class="clearfix"></div> <div class="inputs"> <input id="interestingTagInput" autocomplete="off" type="text"/> <input id="interestingTagAdd" type="submit" value="{% trans %}add{% endtrans %}"/> @@ -49,6 +50,7 @@ "remove '%(tag_name)s' from the list of ignored tags"| format(tag_name = tag_name) #} + <div class="clearfix"></div> <div class="inputs"> <input id="subscribedTagInput" autocomplete="off" type="text"/> <input id="subscribedTagAdd" type="submit" value="{% trans %}add{% endtrans%}"/> diff --git a/askbot/templatetags/extra_filters_jinja.py b/askbot/templatetags/extra_filters_jinja.py index cbd9956a..6fd12aab 100644 --- a/askbot/templatetags/extra_filters_jinja.py +++ b/askbot/templatetags/extra_filters_jinja.py @@ -49,6 +49,10 @@ def is_current_language(lang): return lang == django_get_language() @register.filter +def to_int(value): + return int(value) + +@register.filter def safe_urlquote(text, quote_plus = False): if quote_plus: return urllib.quote_plus(text.encode('utf8')) diff --git a/askbot/tests/page_load_tests.py b/askbot/tests/page_load_tests.py index c4ee8554..ef43ebf8 100644 --- a/askbot/tests/page_load_tests.py +++ b/askbot/tests/page_load_tests.py @@ -256,7 +256,7 @@ class PageLoadTestCase(AskbotTestCase): template='main_page.html', ) self.try_url( - url_name=reverse('questions') + SearchState.get_empty().change_scope('favorite').query_string(), + url_name=reverse('questions') + SearchState.get_empty().change_scope('followed').query_string(), plain_url_passed=True, status_code=status_code, @@ -724,7 +724,9 @@ class CommandViewTests(AskbotTestCase): def test_load_object_description_fails(self): response = self.client.get(reverse('load_object_description')) - self.assertEqual(response.status_code, 404)#bad request + soup = BeautifulSoup(response.content) + title = soup.find_all('h1')[0].contents[0] + self.assertEqual(title, 'Page not found') def test_set_tag_filter_strategy(self): user = self.create_user('someuser') diff --git a/askbot/tests/search_state_tests.py b/askbot/tests/search_state_tests.py index 18f5eb36..27622629 100644 --- a/askbot/tests/search_state_tests.py +++ b/askbot/tests/search_state_tests.py @@ -64,7 +64,7 @@ class SearchStateTests(AskbotTestCase): def test_edge_cases_1(self): ss = SearchState( - scope='favorite', # this is not a valid choice for non-logger users + scope='followed', # this is not a valid choice for non-logger users sort='age-desc', query=' alfa', tags='miki, mini', @@ -83,7 +83,7 @@ class SearchStateTests(AskbotTestCase): ) ss = SearchState( - scope='favorite', + scope='followed', sort='age-desc', query=' alfa', tags='miki, mini', @@ -93,11 +93,11 @@ class SearchStateTests(AskbotTestCase): user_logged_in=True ) self.assertEqual( - 'scope:favorite/sort:age-desc/query:alfa/tags:miki,mini/author:12/page:2/', + 'scope:followed/sort:age-desc/query:alfa/tags:miki,mini/author:12/page:2/', ss.query_string() ) self.assertEqual( - 'scope:favorite/sort:age-desc/query:alfa/tags:miki,mini/author:12/page:2/', + 'scope:followed/sort:age-desc/query:alfa/tags:miki,mini/author:12/page:2/', ss.deepcopy().query_string() ) diff --git a/askbot/views/users.py b/askbot/views/users.py index 0305eb48..a1304dfb 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -726,6 +726,7 @@ def show_group_join_requests(request, user, context): ).order_by('-active_at') data = { 'active_tab':'users', + 'inbox_section': 'group-join-requests', 'page_class': 'user-profile-page', 'tab_name' : 'join_requests', 'tab_description' : _('group joining requests'), diff --git a/askbot_requirements.txt b/askbot_requirements.txt index a9a939b4..ea9dd005 100644 --- a/askbot_requirements.txt +++ b/askbot_requirements.txt @@ -20,6 +20,6 @@ python-openid pystache==0.3.1 pytz sanction -django-tinymce +django-tinymce==1.5.1b2 longerusername beautifulsoup4 |